Linux – How to change swap partition in Linux

linuxswap

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?

Best Answer

Do it as root:

swapoff /dev/hda3
mkswap /dev/hda4
swapon /dev/hda4

and edit swap entry in /etc/fstab