Friday, August 20, 2010

Adding Swap Space

I just recently upgraded the amount of RAM in my system. As a result, it's a good to also increase the amount of swap space. Here is how to do it.
1. Create a swap partition using fdisk.
fdisk /dev/sdb
2. Enter n to create a new partition.
3. Enter e for extended or p for primary.
4. Enter the first and last cylinder.
5. Enter t to select the partition id. Swap has id of 82.
6. Enter w to save the changes.
7. Create a swap partition on the sdb2 partition.
mkswap /dev/sdb2
8. Enable the swap partition.
swapon /dev/sdb2
9. To enable it add boot time, add this line in /etc/fstab.
/dev/sdb2   swap   swap   defaults   0 0
10. Verify that the swap partition.
cat /proc/swaps