Resizing your root file system on Ubuntu with the logical volume manager (LVM)

I recently add some disk space to my root file system on a live, mounted file system using Ubuntu 10.10. I was using a virtual machine, so I changed the size of my disk drive in the virtual machine manager. Then, I logged into Ubuntu as root and executed the following commands.

Partitioned the new drive space with fdisk.
fdisk /dev/hda
In fdisk, “n” (new partition), “p” (primary), “3” (partition number), selected all remaining space on the drive, “t” change the type of partition to “8e” (LVM Volumn), “w” write the changes. I created a new partition on /dev/hda3.

  • partprobe
  • pvcreate /dev/hda3
  • vgextend POC-Ubuntu00 /dev/hda3
  • lvextend /dev/POC-Ubuntu00/root /dev/hda3
  • resize2fs /dev/POC-Ubuntu00/root
  • The volume group is “POC-Ubuntu00”. The logical volume name is “/dev/POC-Ubuntu00/root”.

    Some useful commands: pvdisplay, vgdisplay, lvdisplay.


Leave a Reply