5

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 :-)

Klumbe
  • 191

3 Answers3

2

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.

1

It's easiest to:

  1. Use VBoxManage to resize the Virtual Disk. You've already done this.
  2. Download A Gparted Live ISO
  3. Set Virtualbox to boot the GParted Live CD, on the VM Disk you resized in step 1.
  4. Complete the Resizing Operations in GParted, as GParted >=0.14.x supports LVM
  5. Shutdown the VM and remove the ISO from the virtual drive.
  6. Restart the VM.
  7. Twiddle with the LVM Configs in the VM if needed, insde the VM.
eyoung100
  • 6,252
  • 23
  • 53
0

I wanted to add a little more to the above answer. once I ran Gparted and did the resize and then rebooted the O/S (Fedora) still didn't recognize the increase in space. I had to run the following as root:

lvdisplay - this gives you the logical volume information that you want to expand, just in case your naming convention is something unique.

lvextend -l 100%FREE -r /dev/fedora/root - running this command then expanded the logical volume to use the free space.