- Find out the name of the swap logical volume using the “lvs” command
[[email protected] ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_download vg_hostname -wi-ao—- 200.00g
lv_holding vg_hostname -wi-ao—- 200.00g
lv_home vg_hostname -wi-ao—- 4.88g
lv_opt vg_hostname -wi-ao—- 29.49g
lv_root vg_hostname -wi-ao—- 5.08g
lv_swap vg_hostname -wi-ao—- 4.00g
lv_tmp vg_hostname -wi-ao—- 4.98g
lv_usr vg_hostname -wi-ao—- 4.98g
lv_var vg_hostname -wi-ao—- 9.96g
- Find out LV path for swap logical volume
[[email protected] ~]# lvdisplay
— Logical volume —
LV Path /dev/vg_hostname/lv_swap
LV Name lv_swap
VG Name vg_hostname
LV UUID IhGUco-xoJp-zQ6S-o8iw-ivdc-fHWE-XS3zI2
LV Write Access read/write
LV Creation host, time hostname.ipx.com, 2015-06-05 10:37:23 +0200
LV Status available
# open 1
LV Size 4.00 GiB
Current LE 1024
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256 Block device 253:1
- Turn off the swap partition
[[email protected] ~]# swapoff /dev/vg_hostname/lv_swap
- Resize the swap partition, adding 12GB more space to it
[[email protected] ~]# lvresize -L+12G /dev/vg_hostname/lv_swap
Size of logical volume vg_hostname/lv_swap changed from 4.00 GiB (1024 extents) to 16.00 GiB (4096 extents).
Logical volume lv_swap successfully resized
- Format the new swap space to make it usable
[[email protected] ~]# mkswap /dev/vg_hostname/lv_swap
mkswap: /dev/vg_hostname/lv_swap: warning: don’t erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 16777212 KiB
no label, UUID=b6195773-eba1-4af7-aafc-466867757985
Turn the swap volume back on:
[[email protected] ~]# swapon /dev/vg_hostname/lv_swap
- Check swap space
[[email protected] ~]# free -tom| grep -i swap
Swap: 16383 0 16383