Pages

Wednesday, 15 June 2011

Steps to create swap file in Linux


Navigation : Home / , / Article : Quick HOWTO : Steps to create swap file in Linux

Quick HOWTO : Steps to create swap file in Linux

| No Comments | Labels : ,

Step 1:

Create the file.

This file will be 1024*524288 bytes. Generally it is a good
idea to create the swap file twice as big as the amount of
RAM that you have installed if you are under a 1 GB.

However, if you have larger amounts of RAM, it's best to run
your own tests with free to see how you're using the swap
file.


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


Step 2:

Setup the swap area on the file you created.

$ mkswap /swapfile0


Step 3:

Enable the file for swapping

$ swapon /swapfile0


Step 4:

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

/swapfile0 swap swap defaults 0 0


Step 5:

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:

Post a Comment

Twitter Bird Gadget