Fedora – Extending/resizing Fedora Guest-OS root-drive in VirtualBox

fedoralvmpartitionvirtualbox

I hope you can help me with that:
My VirtualBox Guest-OS (Fedora 19) told me, that there is not enough free disk-space availabe,
so I first increased the .vdi-file by using the Windows-Commandline:

VBoxManage.exe modifyhd "path" --resize 20480

After that VirtualBox correctly shows a bigger virtual hdd.

Then I booted the VirtualMachine with a Fedora(and later Ubuntu to test)-LiveCD and first set the LVM-size to 20GB with

pvresize /dev/sda2 --setphysicalvolumesize 20G

That worked fine, but then I tried to resize the root-partition with:

lvresize -l+100%FREE -r /dev/fedora/root

And I get this error-message:

Extending logical volume root to 16,71 GiB  
device-mapper: resume ioctl on  failed: invalid argument  
Unable to resume fedora-root (253:1)  
Problem reactivating root

After that it is impossible to use the root. I tried to do it with the swap-partition as well (to find out, if it is just the root) and it didn't work either. I tried lvextend and it didn't work. The drive is suspended after this and I can not reactivate it using

lvchange -a y

Same error there.

Maybe somebody can help me with that? I do have a backup of that machine, so that I can always start at the beginning 🙂

Best Answer

I had a lot of similar troubles. A few things:

  • do the VDI resize whilst the machine is powered off
  • resize the partition with fdisk before resizing anything related to LVM
  • you've possibly set your /dev/sda2 to extend past the end of the disk if you also have /dev/sda1 (you used the full 20G for /dev/sda2, but it probably does not start at 0)

I found this page to be most complete. There are also a couple of answers which you might find handy.

I would guess that you need to either shrink /dev/sda2 with pvresize so the whole of /dev/sda fits into the VDI, or grow the VDI a little more. Then you can use fdisk, then continue with the LVM operations as you did above.

Related Question