Linux also provides tools to manage your swap space. You can add and remove spaces as you need to, as well as turn them on and off, even while they are being used.
To create a file to be used a swap, you need to first create the file. This is most easily done with the dd command. To create a 65 Mb file, you might have this command (from the the mkswap man-page):
# dd if=/dev/zero of=/swapfile bs=1024 count=65536
which displays:
65536+0 records in
65536+0 records out
Next you have to prepare the file for usage as swap space using the mkswap. The simplest form would be:
# mkswap /swapfile
Now add this file to your swap pool
# swapon /swpafile
Now you can check if swap is added to your system by using following command
# free
4 comments:
# swpaon /swpafile.1
should
# swapon /swpafile.1
Thank you, typo mistake, corrected now.
this shd also work quite well
#dd if=/dev/zero of=/swapfile bs=1024 count=65765
#mkswap /swapfile "size_here:eg 32435"
#sync
#swapon /swapfile
notice typo with the "swpafle.1"
Great info. I have a multi boot drive and need to delete my swap file, which i created as primary and replace it with a swapfile.
After creating the swapfile, as per instruction above, how can i get rid of the swap partition? just delete it or is there a proper way?
Post a Comment