Skip to content

Instantly share code, notes, and snippets.

@jyap808
Last active January 4, 2016 20:49
Show Gist options
  • Save jyap808/8676928 to your computer and use it in GitHub Desktop.
Save jyap808/8676928 to your computer and use it in GitHub Desktop.
Resize an ext4 LVM volume with a boot CD

Find the name of the Volume Group (henceforth “somevg”) that contains the root Logical Volume:

sudo lvs

(If it’s not showing up, try running sudo lvmdiskscan and sudo pvscan then try again.)

If you run ls /dev/mapper/ you may see that the Logical Volumes is not showing up. If it’s not there, you need to run the following command to make the kernel aware of the logical volumes:

sudo vgchange --available y <somevg>

Since we haven’t mounted the root filesystem, it should be safe to resize. Proceed to perform the actual resizing of the Logical Volume. Note that this command (--size -50G) shrinks the volume by 50GB — read the lvreduce(8) man page to learn how to specify a different size.

sudo lvreduce --resizefs --size -50G /dev/<somevg>/root

(My Logical Volume is called “root”, but yours may be named something different.)

This command will first shrink the filesystem, then shrink the Logical Volume that contains it, which is the only safe way to do it.

You can now restart the system and boot into your now-resized root filesystem.

Modified From: http://askubuntu.com/a/124480

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