Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Windows 7, I set up another Windows 7 VM in VirtualBox. It worked great. Then, I needed to increase the vhd HD size. So, I used VBoxManage utility to do that with the following comment:

VBoxManage modifyhd "c:\VMs\Win7.vhd" --resize 30000

Then, I tried to run the VM again but it cannot be booted and gives me the following error:

FATAL: No bootable medium found! System halted.

Then, I tried to see what is going on inside the VHD and try to attach it inside Device Management and it says It cannot be attached because The file or directory is corrupted and unreadable.

Any idea what went wrong here and how can I save my VM inside that VHD file?

share|improve this question
    
I just had exactly the same problem and I couldn't find any useful solution online so I started analysing the VHD by hand according to Microsoft's documentation. Currently it seems there's bug in modifyhd's implementation where it didn't adjust the offset to data blocks after it has expanded the block allocation table. I need to do some more expriments to verify this. –  billc.cn Sep 21 '12 at 22:43
add comment

4 Answers

up vote 7 down vote accepted

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.

share|improve this answer
    
Well, that's a bummer. This means that I've just thrown away the 3 hours of work. Thanks for the info. –  tugberk May 9 '12 at 17:49
1  
I followed the nice writeup (after I resized my vhd and couldn't boot from it), and GParted didn't show any partitions on the harddrive, only 50 gigs of unallocated space. Does that mean modifyhd screwed up the drive beyond repair? –  GSerg Feb 5 '13 at 16:15
add comment

I had the same issue

  1. create new VHD with desired size
  2. 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/

share|improve this answer
add comment

I had the same problem and I managed to retrieve the data using the GParted LiveCD

  1. Create new VHD to receive the copied data (create partitions and format)
  2. Download the GParted LiveCD and boot on VirtualBox
  3. Select Device -> Attempt Data Rescue
  4. Click OK and after the Scan click View (this will mount /tmp/gparted-roview-XXXXXX)
  5. On the terminal, mount the second VHD (sudo mount /dev/sdb1 /mnt)
  6. 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.

share|improve this answer
add comment

It's worth to note, that I got the exact same problem, which was due to that I issued the command modifyhd while the guest was running. The official documentation says nothing about, that you have to delete snapshots first and the that guest should have been stopped.

My plan was to resize the disk while the machine was running because I've got a dynamic volume which could also be increased on the fly. However, this was a bad idea as I rebooted the machine to get the full disk size I was left in the dark with a corrupt image, which I couldn't restore even not with testdisk. Testdisk finds the partitions but the filesystem is badly damaged and cannot be repaired.

So be advised:

  1. Merge all Snapshots into the Base Image
  2. Shut down the Guest OS

I've repeated the procedure on my machine with a backup image and the guest os being powered off, this works well.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.