Resizing an LVM 2 filesystem on Ubuntu inside Virtualbox (Mac)

Problem 1, VirtualBox can’t resize this kind of Linux volume, so, on the Mac:

Create a new HD (for me, ~10G)
VBoxManage createhd –filename Ubuntu.vdi –size 10000
Copy contents
VBoxManage clonehd CartoDB.vdi Ubuntu.vdi –existing

Then, Download GParted ISO, latest version so that you can resize LVM volumes
Add as CD volume to the machine and boot it, Gparted runs
Deactivate the volume, and resize to fill space, apply changes
Shutdown, ensure CD is no longer mounted in VirtualBox, reboot to real Ubuntu

Then, back in real Ubuntu (this is live resizing, use at your own risk!)
sudo lvextend /dev/lubuntu-vg/root /dev/sda5
sudo resize2fs /dev/mapper/lubuntu–vg/root


Cobbled together from:

…and quite possibly a few others

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>