3

I want to create a bootable Windows 7 vhd using the steps mentioned at: http://www.microsoft.com/downloads/details.aspx?FamilyID=80ede31d-3509-407b-a896-0beea8705589&displaylang=en However, I wanted to know if I will be able to access the vhd using Virtualbox too. I intend to install VS2008 in the VM and use it in Virtualbox when doing quick work and on native hardware when doing a lot of work. I don't want to mess up my actual Win7 installation with VS2008 dev work.

Jared Harley
  • 13,012
0fnt
  • 2,001

4 Answers4

4

I came here looking for an answer to the same question. This issue has been bugging me for a couple of months, so I needed to find a solution and I did. Even though this question has been marked as answered, a solution has not been given, so I'm here to fill the gap for all the other people on the hunt for an answer. Basically, it's the same procedure as making any non-bootable HDD bootable. You can use Windows' commandline tools for that. However, I used third party tools:

  • Mount the VHD in Windows (Control Panel --> Computer Management --> Disk Management --> Action --> Attach VHD)

  • Use a tool to install a BCD-Bootsector to the drive. I used NeoSmart's EasyBCD: Start the tool and choose BCD Deployment. Under "Create Bootable External Media" choose the drive name of the mounted VHD and click on "Install BCD".

  • Unmount the VHD by right-clicking on the corresponding "Disk*".

  • Add the VHD to a virtual machine in VirtualBox.

The VHD is bootable now. Depending on the operating system you're running on you might be set or run into problems. I tested this with Win8 x64. After installing the boot sector, I received a "winload.exe not found" error in VirtualBox. Here's how to fix it:

  • Mount the VHD in Windows again.

  • Download Visual BCD. Start it and choose "Store" --> "Open Store" and maneuver to the drive of the mounted VHD.

  • Select the file "BCD" in the folder "BCD" and click "open". Take note that the file has no file ending.

  • Click on the boot entry on the left side under "Loaders" and on the right you'll see its content listed.

  • Double click on "Application Device" and set "Type" and "Drive" to "BootDevice". Do the same for "OSDevice".

  • Close the store, unmount the VHD and boot it in VirtualBox. It should boot without problems now.

In case you're getting a "wrong signature" error for Windows 8 then you need to update "bootmgr" in the root directory of the boot drive by copying this file from the Windows 8 installation disc. It's also in the root directory there.

I had no problems using the same VHD in VirtualBox and boot to it directly so far. Despite what the criticism here for this technique it is relatively hassle free if you keep some things in mind:

  • Use a copy of the original VHD if you just need to do a job in the other operating system without the need to keep the changes.

  • In case you need the changes, create a restore point in case the VirtualBox drivers screw up your system, unlikely as it is...

  • The VHD has its own BCD store that doesn't interfere with that of your actual computer. So modifying its boot sector for VirtualBox won't have any effect for booting it directly. In the unlikely event of an error you can always re-install the BCD-store and boot sector anyway.

Zerobinary99
  • 1,801
  • 3
  • 14
  • 18
4

I strongly suggest you use separate Windows images for VB and real booting. Yeah, buy another license if you must. VirtualBox does not fake your real hardware, and at the very least you may end up having to reactivate Windows too many times and lose your license because MS thinks you're a pirate.

CarlF
  • 8,872
2

I think it is like booting 2 different computers from one external Hard Disk.

Every time windows boots up, it will find different hardware so it will tell you some hardware was removed and some was added (and add drivers for it). So if the emulated hardware is similar enough to the real hardware, it might be ok. But the chances of getting everything jammed are a bit higher than normal, I think.

0

Yes, Virtual box does support VHD files.

Wiki: Software using VHD

Wiki: Virtual box feature set

RJFalconer
  • 10,369