Tuesday, April 28, 2020

Reducing an LVM2 Swap Logical Volume

  1. Disable swapping for the associated logical volume:
    # swapoff -v /dev/VolGroup00/LogVol01
  2. Reduce the LVM2 logical volume by 512 MB:
    # lvreduce /dev/VolGroup00/LogVol01 -L -512M
  3. Format the new swap space:
    # mkswap /dev/VolGroup00/LogVol01
  4. Activate swap on the logical volume:
    # swapon -v /dev/VolGroup00/LogVol01
  5. To test if the swap logical volume was successfully reduced, inspect active swap space:
    $ cat /proc/swaps
    $ free -h

No comments: