The swap logical volume cannot be in use (no system locks or processes on the volume).
The easiest way to achieve this it to boot your system in rescue mode.
lvs
returns:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert backup vg01 -wi-ao---- 3.72g home vg01 -wi-ao---- 11.86g opt vg01 -wi-ao---- 1.86g root vg01 -wi-ao---- 3.86g sharewiz vg01 -wi-ao---- 9.86g srv vg01 -wi-ao---- 90.86g swap vg01 -wi-ao---- 4.00g usr vg01 -wi-ao---- 3.86g var vg01 -wi-ao---- 6.86g
Disable swapping for the associated logical volume:
swapoff -v /dev/mapper/vg01-swap
Remove the LVM2 logical volume of size 512 MB:
lvm lvremove /dev/mapper/vg01-swap
Remove the following entry from the /etc/fstab file:
/dev/mapper/vg01-swap none swap sw 0 0
Test that the logical volume has been extended properly:
cat /proc/swaps
returns:
Filename Type Size Used Priority /dev/dm-1 partition 4198396 0 -1