Wednesday, August 12, 2009

Adding SWAP space in Linux

#free –m (To check free space of SWAP memory)

#df –h

We are going to make a swap file in /opt by using dd to create a file 128 Mb in size

#dd if=/dev/zero of=swapfile bs=1024 count=132207

132207+0 records in

132207+0 records out

#ls –l

#chmod 600 swapfile

#mkswap swapfile

#swapon swapfile

#free

Now you can entry this in /etc/fstab file

#vi /etc/fstab

/opt/swapfile swap swap defaults 0 0