14 Dec

How to resize linux logical volume (lvm) in a virtualbox vm

I was installed Fedora VM in to 8 GB Virtual Disk (vdi) but now I need to resize disk to 16 GB

VBoxManage modifyhd “D:\VirtualBox VMs\Fedora\Fedora.vdi” –resize 16384


Now the linux part.

You’d have to unmount it to shrink it (which requires a LiveCD / Rescue Mode.)

  1. pvresize /dev/sda2 (assuming your LVM partition is sda2. Replace as required.)
  2. lvextend /dev/mapper/root -l+100%FREE  (or, whatever your root logical volume is called.)
  3. resize2fs /dev/mapper/root (assuming ext2/3/4)