Skip to content

Instantly share code, notes, and snippets.

@JeffLabonte
Last active December 15, 2019 19:30
Show Gist options
  • Save JeffLabonte/0a6bdbc1c32f9957d0778522b531a8e9 to your computer and use it in GitHub Desktop.
Save JeffLabonte/0a6bdbc1c32f9957d0778522b531a8e9 to your computer and use it in GitHub Desktop.

Need to be careful with those commands. It made my install crash

  1. Determine the name of the swap logical volume using the "lvs" command:
$ lvs
LV VG Attr LSize Origin Snap% Move Log Copy%
root_lv volgroup0 -wi-ao 7.00G
swap_lv1 volgroup0 -wi-ao 30.00G
tmp_lv volgroup0 -wi-ao 3.00G
usr_lv volgroup0 -wi-ao 7.00G
var_lv volgroup0 -wi-ao 4.00G
  1. Turn off the swap partition:
$ swapoff /dev/volgroup0/swap_lv1
  1. Resize the swap partition, adding 15GB more space to it:
$ lvresize -L+15G /dev/volgroup0/swap_lv1
Extending logical volume swap_lv1 to 30.00 GB
Logical volume swap_lv1 successfully resized
  1. Format the new swap space to make it usable:
$ mkswap /dev/volgroup0/swap_lv1
Setting up swapspace version 1, size = 41875927 kB
  1. Turn the swap volume back on:
$ swapon /dev/volgroup0/swap_lv1
  1. Use free command to show your new swap space:
$ free -t | grep -i swap
Swap: 30719 0 30719

Source: https://askubuntu.com/questions/226520/how-can-i-modify-the-size-of-swap-with-lvm-partitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment