Create Swap Partition Ubuntu

To check if there are any SWAP files configured run the following command:
sudo swapon -s
It will list all swaps if any.

Ensure there is enough space on the root partition to create the swap:
df -h

Create the partition and replace count with the size of the partition in bytes:
dd if=/dev/zero of=/swap bs=1024 count=2097152

Set the Swap area with the correct settings / permissions:
mkswap /swap && chown root. /swap && chmod 0600 /swap && swapon /swap

Add new swap drive to file system table:
echo /swap swap swap defaults 0 0 >> /etc/fstab

Set the “swappiness” to 0 meaning only use at the very last resort:
echo vm.swappiness = 0 >> /etc/sysctl.conf && sysctl -p

How To Install Nagios On Ubuntu 12.10

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.