Tuesday, November 22, 2011

Tips: 3 How to create swap File ?

You are in a situation where you need more swap. what do you do - Reinstall ???

No et all,

The trick is to make a file and then tell the swapon program to use it. Here's how to create, for example, a 64 megs swap file on your root partition

dd if=/dev/zero of=/swapfile bs=1024 count=65536

This will make a 64 megs (about 68 millions bytes) file on your hard drive. You now need to initialize it:

mkswap /swapfile 65536
sync

And you can then add it to your swap pool:

swapon /swapfile

With that you have 64 megs of swap added. Don't forget to add the swapon command to your startup files so the command will be repeated at each reboot.

No comments:

Post a Comment