Wednesday, February 16, 2011

Swap file in RedHat /CentOS /Fedora

$ dd if=/dev/zero of=/swapfile0 bs=1024 count=524288

Setup the swap area on the file you created.

$ mkswap /swapfile0

Enable the file for swapping

$ swapon /swapfile0

Permanently enable the swap file on boot.
Add the following lines to /etc/fstab.

/swapfile0 swap swap defaults 0 0
          

Check that the swap file is working the the free command. Also,
reboot too to make sure the swap file works on restart and that
/etc/fstab was correctly configured.

No comments: