linux : removing swap space
reducing swap on an LVM2 logical volume
to reduce an LVM2 swap logical volume (ex. /dev/swap is the volume you want to extend):
disable swapping for the associated logical volume:
swapoff -v /dev/swap
reduce the LVM2 logical volume by 512 MB:
lvm lvreduce /dev/swap -L -512M
format the new swap space:
mkswap /dev/swap
enable the extended logical volume:
swapon -va
test that the logical volume has been reduced properly:
cat /proc/swaps free
removing an LVM2 logical volume for swap
to remove a swap volume group (assuming /dev/swap is the swap volume you want to remove):
disable swapping for the associated logical volume:
swapoff -v /dev/swap
remove the LVM2 logical volume of size 512 MB:
lvm lvremove /dev/swap
remove the following entry from the /etc/fstab file:
/dev/swap swap swap defaults 0 0
test that the logical volume has been extended properly:
cat /proc/swaps free
removing a swap file
at a shell prompt as root, execute the following command to disable the swap file (where /swapfile is the swap file):
swapoff -v /swapfile
remove its entry from the /etc/fstab file.
Remove the actual file:
rm /swapfile