Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Adding SWAP space to your machine.

Procedure to add a swap file :

CHECK How much Swap space u r having on ur machine... using "free" command and if u find ur swap is low then add a swap file to ur machine...

You need to use dd command to create swap file. Next you need to use mkswap command to set up a Linux Swap Area on a device or in a file.

1) Login as the root user

2) Type following command to create 512MB swap file (1024 * 512MB = 524288 block size):
# dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

3) Set up a Linux swap area:
# mkswap /swapfile1

4) Activate /swapfile1 swap space immediately:
# swapon /swapfile1

5) To activate /swapfile1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:
# vi /etc/fstab

Append following line:
/swapfile1 swap swap defaults 0 0

So next time Linux comes up after reboot, it enables the new swap file for you automatically.

6) How do I verify swap is activated or not?
Simply use free command:
$ free -m



This post first appeared on Things You Should Know About Linux !!!, please read the originial post: here

Share the post

Adding SWAP space to your machine.

×

Subscribe to Things You Should Know About Linux !!!

Get updates delivered right to your inbox!

Thank you for your subscription

×