Extend a LVM partition after increasing its virtual disk on Virtualbox

No Linux machine at work? the easy way could be to simply install Virtualbox in one of the PC, create a VDI and install Ubuntu 14.04 in it. But the day will come when you need more space! Here is how to resize it:

Resize Virtualbox VDI

Open Virtualbox, make sure to shutdown your virtual machine. Then open a terminal (here windows):

This is the Virtualbox official manual of available commands. And this is a website to convert Gb into Mb (–resize takes Mb as input, 200Gb = 204800Mb).

Boot Gparted to resize the partition

After a default install of Ubuntu Server on one physical disk, you will have a SWAP partition, and then an extended partition in which you’ll have your LVM partition (So 3 partitions). Download Gparted .iso, then in your Virtualbox VM settings add a optical drive that point to Gparted.iso, start the VM, press F12 and choose to boot on CD-ROM. Then in Gparted resize first the extended partition to take all the available space, and then same for the LVM partition. Confirm changes, and reboot the VM on its hard drive.

Resize the LVM stack

Let’s resize the PV (Physical Volume) so it takes all the

Now let’s extend the LV (Logical Volume) to the full size of the PV. First display its name:

And then extend it to full size available (100%):

Now let’s check filesystem of partition:

It’s ext4, and as you can see, the filesystem size is still 99G (and not 200G as wanted). So the last step is to extend the filesystem on the whole LV:

That’s it! Now you can run  df -Th again and see that the available space has increased. Congrats, job done!

2 thoughts on “Extend a LVM partition after increasing its virtual disk on Virtualbox

Comments are closed.