Extend the swap logical volume size

Extend the swap size in a logical volume may be needed.  Assume that there is a swap partition that requires an additional 1G of space.  The following process should work on a CentOS 7 Linux install.

Assuming that the disk space is available, use lvextend will add 1G, disable and flush out the existing swap space.  It may take some time to flush out swap, but once the swap hits zero, use mkswap to add swap.  Although there may be an error message presented, ignore it.  Re-enable the swap and enjoy the extra space.

lvextend /dev/vg01/swap -L +1G
swapoff -a
mkswap /dev/vg01/swap
swapon -va
swapon -s

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *