Followers

Guide to Installing and Booting Windows 8 Developer Preview off a VHD (Virtual Hard Disk)

I've posted before about my intense love for Booting off a VHD (Virtual Hard Disk). It's lovely. Of course, once Hyper-V on the client happens, it will matter less, but for now, here I am, a guy with a perfectly good, working Windows 7 machine who wants to also run the Windows 8 Developer Preview.
New Windows 8 Boot Manager?























I could do a few things to play with Windows 8. I could:
  • Try a virtualization solution, but it might not work, I may not have the drivers I need and it won't be as shiny as running "on the metal."
  • Sacrifice a machine I have lying around. I'll probably do that at some point, but I'd like to try it out on my actual hardware that I use all day long.
  • Swap out my C: drive and use my main machine. I don't have a tool-less case, and I'm also very lazy, so, um, ya.
  • Dual boot. Dual booting may feel ninja but it ALWAYS ends on tears. And sometimes blood.
  • Boot on real hardware from a Virtual Hard Disk.
Booting off a VHD is my current preferred solution for trying crazy stuff because the only speed hit I'll take is on the virtualized hard drive. Everything else is real hardware. I do this all the time with presentation VHDs and one-off daily builds of stuff.

Warranty

Of course, this is just some dude's blog. I puzzled this out and while booting to VHD is supported, messing with your boot manager - especially with Preview (that means, NOT RELEASE QUALITY) Software is a recipe for losing your job and a messy divorce. There's no warranty, express or implied. If you quake in fear from the following instructions, you need to STOP. It may be the case that you are actually a Non-Technical Friend and you don't realize it. Well, someone just told you. Please don't destroy your hard drive. I don't know you and I don't how how you got here. Stop calling. Jimmy no live here, you no call back!

Booting a Windows 8 VHD off a Windows 7 Primary System

Whew, now that's out of the way, let's void a few warranties, shall we?
Please note that there are a half dozen ways to do this. You can do it all from the command line using tools like ImageX, DISM, etc, or you can do a lot of it graphically with tools like BellaVista. This is just the way I did it. It's not gospel. I'm sure the folks in the comments will have much nicer ways. Take them all with a nice grain of sea salt. You can also SYSPREP the VHD directly from the ISO's WIM with IMAGEX if you know what that stuff means. It's a little subtle and requires you go get some tools. While my process  is a little baroque, it just needs the one ISO->USB tool.

Step 0 - Have a lot of Disk Space

I like to have a roomy VHD. You can make one that expands or you can make a fixed size. 40 gigs is usually enough, but I like 60 gigs as a nice round number, plus this is the Windows 8 Developer Preview with Developer Tools. If you don't have enough space when an expandable disk "bloats" itself to the fixed size on boot, it'll blue screen, so expandable or not, have the slack space.

Step 1 - Make a USB stick or DVD from the ISO

Go get the Windows 7 USB/DVD download tool and get yourself a USB stick that will hold at LEAST 10 gigs. I used a 16 gig one. Go through the process by pointing at the ISO you downloaded and then preparing your USB key. You can also use the resulting USB key to boot and install Windows 8 from your sacrificial hardware if you like.
Choose ISOChoose Media TypeInsert USB deviceCreating Bootable USB device

Step 2 - Make a Virtual Hard Drive

You can do this later in the process by pressing Shift-F10 while in the Setup Tool, but I like to prep things up front. You can do it from the Disk Management GUI or from DISKPART at the Administrator command line.
Be aware that your VHD needs to be on an internal drive or SATA drive. USB won't work as the drivers are initialized too late in the boot process.
Also, if your machine is BitLockered, your VHD needs to be on a non-BitLockered partition and you need to suspend BitLocker during this process. Also, know your recovery key because I don't know it.

2a. Start up an Administrator Console and run DISKPART. Execute the lines after DISKPART> below, changing them for your own system.

C:\Users\Scott\Desktop>diskpart

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: HEXPOWER7

DISKPART> create vdisk file=d:\VMs\Win8.vhd type=expandable maximum=60000

  100 percent completed

DiskPart successfully created the virtual disk file.

DISKPART> select vdisk file=d:\VMs\Win8.vhd

DiskPart successfully selected the virtual disk file.

DISKPART> attach vdisk

  100 percent completed

DiskPart successfully attached the virtual disk file.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.
2b. OR do it from the Disk Management GUI:
Create and Attach Virtual Hard Disk
At this point, you've got a VHD that's empty, but ready to have Windows installed to it. The VHD and your system are NOT ready to be booted from. That will come in a minute.

Step 3 - Boot off the Windows 8 USB Key

Now, restart your computer with your new USB key plugged in and startup your BOOT MENU. The hotkey is usually F12 to bring it up. You want to boot off the Windows 8 USB key.
Side Note: Folks with Gigabyte Motherboards. These motherboards are notoriously hard to figure out a USB boot. You need to make sure that you USB key is only plugged into the board directly in the back. Then, don't use the Boot Menu, it never works. Instead, enter the BIOS with the DEL key and manually put your USB Key (it'll be detected by brand, so be prepared to recognize the string) at the top of the Hard Drive boot order.
Boot of your USB key

Step 4 - Attach the VHD while still inside SETUP

Pay attention here. Actually, hell, pay attention to the whole thing, it's subtle.
Start the SETUP process, click Install Not but DO NOT PICK A HARD DRIVE. As shown in this screenshot, instead hit SHIFT-F10 to get to a console. We want to attach our VHD and install to THAT instead.
Shift-F10 from within Windows 8 Setup
In the screenshot above I haven't touched anything, yet.
Below, I've run DISKPART and selected and attached the VHD with these now familiar commands:
DISKPART> select vdisk file=d:\VMs\Win8.vhd
DISKPART> attach vdisk
That will look like this screenshot.
DISKPART commands have been issued, but the drives aren't refreshed yet
Next, ALT-TAB back over to the list of disks and hit REFRESH. You'll see your VHD show up. Mine is the 60 gig one. That's the blank we are going to install to.
Now the 60 gig VHD is visible
Note that installation will warn you that this VHD can't be booted to. Yet. That's cool, go ahead and install to that empty VHD.
photo 4
At some point it'll ask you to restart the computer. The setup process isn't done yet, but go ahead and reboot and remove the USB key.
Your system should reboot and setup will continue, this time off the VHD.
NOTE: I had expected at this point to go and manually create a BCD entry using BCDEDIT.EXE from an Administrator command line as I did in my first post on booting to VHD but it seems that is all done for us now!

The Windows 8 Developer Preview build automatically noticed that I was trying to boot off a VHD and added a Windows Bootloader option and put the description in as "Windows Developer Preview," saving me a half dozen tedious steps. I was very pleasantly surprised! I'd like to hear if you had the same experiences, Dear Reader.

I could tell it was working because my C: drive is a totally silent SSD and my D: drive is spinning rust. When the setup continued I could totally hear the hard drive that holds the VHD spinning. The installation completed happily at this point with me having to manually create an entry with BCDEDIT.

I confirmed it with bcdedit.exe /v while running Windows 8 Developer Preview.
Setup completed, and I rebooted again to make sure I could get back into Windows 7.
In fact, I was shocked to find a completely new bootloader had come into play. I was literally open-mouthed staring at it. It's not text, it's graphical and friendly! It actually and literally "did the right thing." Awesome.
This seems to be the Windows 8 boot manager that you'll see if Windows 8 Developer Preview is the default. Otherwise you'll see the Windows 7 text-mode one first. Very cool. I hope it stays past the Developer Preview.
New Windows 8 Boot Manager?
Here's what you get if you click Other Options.
New Windows 8 Boot Manager?
That's it. To recap:
  1. Make an empty VHD
  2. Attach to the VHD just before installing Windows 8 Developer Preview
  3. Install to the VHD
  4. Rejoice
Hope this works for you, Dear Reader. I'm happily booting Windows 8 Developer Preview to VHD today.

Published By
S.G.Godwin Dinesh.MCA
Sr.System Administrator

No comments:

Post a Comment