Thursday, January 26, 2012

How to add a swap file in Fedora 16

Adding extra swap is sometimes required to meet and fulfill the hunger of resource hungry applications. Below are a few easy simple steps to do it.

As you can see we have total 1503mb of swap.

Type following command to create 512MB swap file.
$ sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

Set up a Linux swap area:
$ sudo mkswap /swapfile

Activate /swapfile1 swap space immediately:
$ sudo swapon /swapfile

To make the changes permanent and active even after reboot we have to add an entry to the /etc/fstab file. Open this file using text editor such as vi or gedit.
$ sudo vi /etc/fstab

Append following line:
/swapfile1 swap swap defaults 0 0

Below shown is my /etc/fstab file.

Verify swap space using free command
$ free -m

As you can see below that the total swap space has increased by 512mb i.e. 2015mb.

Try rebooting to verify.

No comments:

Post a Comment