Linux - Swap

How-to: Reduce LVM Swap

Disable swap:	swapoff -v /dev/vgroot/lvswap
Reduce the LV:	lvreduce /dev/vgroot/lvswap -L -{size}

How-to: Increase LVM Swap

Disable swap:	swapoff -v /dev/vgroot/lvswap
Increase the LV:	lvresize /dev/vgroot/lvswap -L +{size}
Format swap partition:	mkswap /dev/vgroot/lvswap
Turn swap back on:	swapon -av

How-to: Change swappiness

To change on the fly:

# echo 25 > /proc/sys/vm/swappiness

To make permanent:

Edit sysctl.conf

Add/edit line vm.swappiness=25

Force kernel to re-read sysctl.conf

# sysctl -p