Michael Svanström

developer, photographer

Extending an LVM volume

The following commands adds a new partition to an existing lvm volume. Tested on Ubuntu 10.04. First, find out your volume name using: sudo vgdisplay

  1. sudo cfdisk /dev/sda <- create the new partition in free space here. note the partition number (sdaX).
  2. sudo pvcreate /dev/sdaX <- creates a new physical volume with this new partition (X is the partition number)
  3. vgextend VOLUME /dev/sdaX
  4. sudo vgdisplay <- find out the amount of free space in lvm
  5. sudo lvextend -L+1G /dev/mapper/VOLUME-root
  6. sudo resize2fs /dev/mapper/VOLUME-root
  7. df -h

With a little help from: http://serverfault.com/questions/148239/expand-disk-space-on-ubuntu-10-04-vmware-guest