Booting Windows 8 from Existing VirtualBox VHD from existing Windows 7.
You probably already know that you can boot off VHD from Windows 7. If you don't, it's about time you learn it. It's a very neat feature.
You also probably seen blog posts on how to install and boot Windows 8 from VHD (such as this one from @hanselman).
As everyone else that doesn't actually have tons of machines lying around to try Windows 8 and does not want to lose the current OS installation, you probably been playing around with Windows 8 in a virtualized environment such as VirtualBox. And if you do,you probably know that you can have a virtual hard drive in VHD format when you create your virtual machine.
- so, Windows 7 can boot VHD...
- and VirtualBox can create VHD...
- and I already have a Windows 8 virtual machine that is stored in VHD format in VirtualBox.
Hey!! Why don't I just boot it up from THAT??!!
Well, ... of course you can!
But... what the heck for... you can just create VHD in Windows 7 using diskpart utility and mount it and burn Win8 iso to USB stick and make it bootable (if you can find a large enough one around) or a bootable DVD (who the heck does this nowadays?).
- I have VirtualBox already (I did mentioned this, right?).
- It's easy enough to create VHD and install Win8 (doesn't matter if it is developer or consumer or release preview or ...) from the ISO in VirtualBox. (I always use VHD format since it is portable between multiple VM platforms anyway.)
- It's probably the first thing that you would do anyway when wanting to try the new and shiny things in any OS (install it in a virtual platform and play around with it).
- Now that I've done all this... why not reuse the VHD? No reason not to.
But... what happen to all my device configurations? See... in VirtualBox, my network driver, my sound driver, my display driver, etc. are bound to specific virtualized drivers. If I boot from that VHD wouldn't Windows 8 be screwed up?
Well, from what I have running so far, it doesn't seem to be. The first time it booted from the VHD, it looks like Windows 8 reconfigures the devices anyway so when I am booted up, I see my real hardwares from the Device Manager. So, no worry there.
Neat... so... what do I do know if I want to do this?
You only need 3 steps.
Step 1. Detach the VHD from VirtualBox and remove it and release it from VirtualBox Virtual Media Manager.
(You might not need to do this, but this is what I did just to prevent unwanted side effects, just in case).
Remove and release... hmm.. how the heck do I that?
Sigh... Select the Windows 8 VM from inside VirtualBox Manager, bring up the Settings for it, then on Storage, select the VHD from the attached controller, and click the Remove Attachment icon at the bottom of the Storage Tree pane to remove the VHD.
To release the media from VirtualBox, open the Virtual Media Manager by going back to VirtualBox Manager, click Ctrl-D or choose File, Virtual Media Manager from the menu. From the Hard Disks tab, choose the Windows 8 VHD and click the Release icon near the top.
Step 2. Mount the VHD natively in Windows 7 using Disk Manager and mark it active.
... Don't know how to this too?... Fine...
Open up Computer Management by typing this cryptic string into your Start menu search bar: diskmgmt.msc and press Enter.
Click the Action menu, and choose Attach VHD and choose the Windows 8 VHD that you just released from step 1. DO NOT make it Read only!
(I might be wrong here, but I've read this somewhere and it worked for me. You might not need to do the following....)
After you've done this, you should see the VHD as a disk in the center lower pane. I think Windows will also assign specific drive letter to it. You might have 2 partitions off the same virtual disk... now, this is the tricky part... you need to mark the one w/ the new Windows 8 OS active. You can do this by judging the size of the partition or a safer way is to browse your new drives and see which one it is. It should have a Windows folder from the root drive when you open it in Explorer. Say... you have 2 more new drives after you mount the VHD, say drive D and drive E. Browse those drives and see which one has Windows directory. That's the one you want to make active.
To mark the partition as active, just right click on it from the Disk Management lower center pane and choose Mark partition as Active.
But... but... I want to see nice pretty pictures of what I should click...
Bah... no pretty picture for you... I am too lazy to do screen capture this early in the morning, hahaha. Figure it out. Frankly, if you don't know how to do this, you shouldn't be doing this anyway. You might screw up your machine and cry like a baby aferward.
Bah... I am l33t enough, I want to do this using diskpart!!
You silly, silly person... why choose command line when there is a simple GUI for it... sigh. Do what you wish. There should be enough blog posts out there to explain this. @hanselman post above is a good starting point.
Step 3. Add boot entry to the boot loader using bcdboot.
OK... remember what drive you seen the Windows installation before in step 2? You need to add that to the boot loader.
Getting too lazy to explain, hehehe. Uhm... just follow the section called Add a Mapped VHD to Your Boot Menu in this blog post.
There... done. Now you can reboot your machine, the new graphical boot loader should comes up and will let you boot Windows 8 from the attached VHD. It will take a while the first time you boot into Windows 8 since it will try to reconfigure all the new found hardwares.
Enjoy your new shiny, fast and fluid thing.
Speaking about fast... People in the podcasts I listen to keep saying WOW, look how fast Win8 boot up... uhm... how come I don't see that. Maybe they are too freaking rich and have SSD for their boot drive... or is it the VHD thing that's making it slow... shrug. Still take a bit of time for me to boot up Win8 from my spinning metal of death 500 gig laptop hard drive. Frankly my Win7 installation boot faster but... whatever. LOL.