Cannot boot after vhd hard drive is resized in VirtualBox
Unfortunately the VirtualBox documentation for the VBoxManage --resize option is misleading. You cannot just increase the size of the disk image and have everything work properly. The disk partition information within the image has to be adjusted so that the guest operating system knows the layout of the "drive" the disk image is simulating. You accomplish this adjustment by downloading a bootable CD image that has a partition editor on it and booting the VM onto that CD. You then use the partition editor to adjust the disk image's partitions to use the added space.
There's a nice writeup of the procedure here; just skip to step 4.
I had the same issue
- create new VHD with desired size
- Use clonhd to copy from old vhd to new vhd
Reference : http://tips.kaali.co.uk/2012/03/16/expand-or-increase-the-size-of-virtual-box-vdi-dis/
I had the same problem and I managed to retrieve the data using the GParted LiveCD
- Create new VHD to receive the copied data (create partitions and format)
- Download the GParted LiveCD and boot on VirtualBox
- Select Device -> Attempt Data Rescue
- Click OK and after the Scan click View (this will mount /tmp/gparted-roview-XXXXXX)
- On the terminal, mount the second VHD (sudo mount /dev/sdb1 /mnt)
- Copy the files (sudo cp -R /tmp/gparted-roview-XXXXXX/* /mnt
After that you can shutdown the Virtual Machine and mount the VHD on Windows Device Manager.
Here they explain the problem (in spanish)
Summary:
a. "vboxmanage modifyhd (resize)" generates error in many systems (Windows NT5, 9x, Server and x86 versions). The result is a corrupt partition, very difficult to recover
b. You need to execute "vboxmanage modifyhd (resize)" (to resize the VDI) In the path that contains all the files and folders associated with the VDI. Look at the image
Recommendation:
Replace "vboxmanage modifyhd" with "vboxmanage clonehd"
-
Create a new virtual disk VDI (With the size you want to expand). Example: Old.vdi had 50gb. New.vdi create it with 100GB
VBoxManage createhd --filename /path/New.vdi --size 100000
-
Clone it with the following command:
vboxmanage clonehd /path/Old.vdi /path/New.vdi --existing
Note: Both VDI should not be on the same path
- Run New.vdi and go to Windows Computer Management and Extend the disk space (assign the empty space). If you do not want to do it manually, you can use any free partitioning application, such as AOMEI Partition Assistant Standard, GParted and many others.