System information
To reduce an LVM2 swap logical volume (assuming /d ev/Vo l G ro up0 0 /Lo g Vo l 0 1 is the volume
you want to reduce):
Pro ced u re 15.3. Red u cin g an LVM2 swap lo g ical vo lu me
1. Disable swapping for the associated logical volume:
# swapo ff -v /d ev/Vo l G ro up0 0 /Lo g Vo l 0 1
2. Reduce the LVM2 logical volume by 512 MB:
# l vred uce /d ev/Vo l G ro up0 0 /Lo g Vo l 0 1 -L -512M
3. Format the new swap space:
# mkswap /d ev/Vo l Gro up0 0/Lo gVo l 0 1
4. Enable the extended logical volume:
# swapo n -v /d ev/Vo l G ro up0 0 /Lo gVo l 01
To test if the swap's logical volume size was successfully reduced, use cat /pro c/swaps or free
to inspect the swap space.
15.2.2. Removing an LVM2 Logical Volume for Swap
To remove a swap volume group (assuming /d ev/Vo l G ro up0 0 /Lo g Vo l 0 2 is the swap volume
you want to remove):
Pro ced u re 15.4 . Remo ve a swap vo lume g ro u p
1. Disable swapping for the associated logical volume:
# swapo ff -v /d ev/Vo l G ro up0 0 /Lo g Vo l 0 2
2. Remove the LVM2 logical volume of size 512 MB:
# l vremo ve /d ev/Vo l G ro up0 0 /Lo g Vo l 0 2
3. Remove the following entry from the /etc/fstab file:
/d ev/Vo l Gro up0 0 /Lo gVo l 0 2 swap swap d efaul ts 0 0
To test if the logical volume size was successfully removed, use cat /pro c/swaps or free to
inspect the swap space.
15.2.3. Removing a Swap File
To remove a swap file:
Pro ced u re 15.5. Remo ve a swap f ile
1. At a shell prompt, execute the following command to disable the swap file (where /swapfi l e
is the swap file):
Chapt er 1 5. Swap Space
117