Thursday, November 22, 2007

Recreating Swap Partition for Ubuntu Linux

If you happened to forget to create swap partition or you want to change your swap partition size for your Ubuntu linux, don't worry. You can delete it then recreate a new swap partition. Follow this steps (it worked for my system):
1. Boot your system from CD Resque System or GParted Live CD
2. Delete your existing partition
3. Reboot to your Linux system (don't forget to remove the CD from the drive)
4. Make sure you have something like below on your /etc/fstab file:
/dev/hda8 none swap sw 0 0
(where hda8 is your swap partition. If not sure, boot from CD Resque System or GParted Live CD again and see where is your swap partition)
5. Open terminal window then swapoff all of your swap partition then swapon the new swap partition by executing the following commands:
swapoff -a
/sbin/mkswap /dev/hda8
swapon -a
(replace hda8 accordingly)
Then you need to reboot your system.

To check if everything went well, type
free
from your terminal and then try to run some programs such as openoffice and gimp that usually requiers swap to run. Check if swap used has increased. If so, it means swap partition now has been activated.
For further reading you may click link below:

https://help.ubuntu.com/community/SwapFaq

Good luck.

No comments: