Swap file on Ubuntu PDF Print E-mail
User Rating: / 2
PoorBest 
Written by Bart Dorlandt   
Wednesday, 17 March 2010 11:40

I feel more free when I have a swap file instead of a swap partition and here are the commands to do it.

I'm going to create a swap file of 6GB on the /data partition.

dd if=/dev/zero of=/data/6GB.swap bs=1024 count=6144000
mkswap /data/6GB.swap
swapon /data/6GB.swap

These 3 commands will create a file with blocks of 1mb with a size of 6GB, will then make it a swap file and after it will use the swapfile.

If you put the following in /etc/fstab it will be used at boottime as well.

###  SWAP ###
/data/6GB.swap swap swap defaults 0 0

Now you're done.

 


Related items: