How do I change swap partition in Linux? If I currently use /dev/hda3 for swap, and I rather would like to use /dev/hda4, which steps should I go through?
feedback
|
|
Do it as root:
and edit swap entry in /etc/fstab | ||||
|
feedback
|
|
If you have decent amount of RAM and your applications aren't memory-intensive, you might consider using a separate file as a swap instead of the whole partition. That way you can easily select the amount of swap space you use, either by adding more swap files, or resizing existing ones. Let's say that your swapfile will reside in root directory as
To automatically use it after reboot, insert in
Adding more swap files is as simple as creating more files ( As for the performance between disk and file version, it's not that terribly different. You can even use swapfile as hibernation disk in laptops (although I always use separate partition for that anyway). | |||
|
feedback
|
|
On the fly:
For bootime, after you have run the mkswap, edit the /etc/fstab file and the change the /dev/hda3 line accordingly. | ||||
|
feedback
|
|
You'll need to format /dev/hda4 as swap, which I think just deletes the file system tables, then just edit /etc/fstab and point swap to /dev/hda4. Then reboot and you should be good. It goes without saying that you'll lose any data on /dev/hda4. You can use gparted as a gui for the formatting. | |||||
feedback
|