Creating a VHD for multi-boot in Windows 7
Been doing this so much lately with all of the flavors of Windows 8, I figured I’d write this down for my own benefit, but also for anyone who’s interested in doing the same.
- Create a new VHD
- Go to Start, right-click on Computer and choose Manage
- Under Storage in the left pane, single-click Disk Management
- In the Actions pane on the right, click More Actions, then choose Create VHD
- Specify the location you want to store your VHD file (ex: c:VHDsvhdname.vhd). Select the virtual hard disk size (I typically do 20GB and Fixed, but it’s up to you) and click Ok.
- The VHD will be created, this can take anywhere from 5-20 minutes.
- Once finished, you need to initialize the disk. Right-click on the newly created Disk in the pane below the volumes list (click the left side of the disk, not the white area on the right) and choose Initialize Disk.
- Make sure MBR is selected and click OK.
- You should now have a VHD, ready for installation of your favorite OS.
- Prepare your bootable OS
- Download and install the Windows 7 USB DVD Download Tool. This is a free tool courtesy of Microsoft, and is very handy (IMHO) for creating bootable flash drives for OS installation.
- Once installed, run the tool. In step 1, browse to the location of the ISO file for your OS you want to install on the newly created VHD.
- Choose the media type you want the bootable drive created on. For me, this is a blank flash drive, minimum 8GB. At this point, the drive should be connected.
- Make sure your drive is selected in the drop down list. If you forgot to connect it, connect it now and click Refresh. Click Begin Copying.
- In step 4, the drive will be formatted, the OS will be installed on the drive, and it will be configured to be bootable.
- You should now have a bootable media with your desired OS on it.
- Install your OS on your VHD
- Plug in your flash drive and restart your machine. Make sure your machine’s BIOS is set to read flash drives on boot, and also that any VM settings are enabled.
- Follow the on-screen instructions for installation of your OS.
- When you get to the point where it wants to know which partition to install the OS on to, press SHIFT+F10 to open the command prompt.
- Type DISKPART and hit enter
- At the DISKPART> prompt, type select vdisk file=<path to vhd file> and hit enter. NOTE: drive letters may have been rearranged during this install process. You may need to do some searching around at the various drive letters to find your VHD file, to make sure you have the correct drive letter and path above.
- At the DISKPART> prompt, type attach vdisk and hit enter
- Close the command prompt window
- At the list of available partitions, click Refresh, and make sure your VHD file appears in the list. If it doesn’t, repeat steps C-F and make sure there are no errors when attaching the VHD to the install session.
- Select the VHD partition and proceed with installation. Ignore any warnings the wizard may tell you about not being able to install on this partition.
- A BCD entry will be created for you, and set to default upon completion.
- Changing boot order/default boot settings after installation
- Before making any changes to the Boot Control, back it up by typing bcdedit /export <filename> and hit enter. Don’t use spaces in the filename unless you enclose them in double-quotes.
- In your default OS (prior to installing the new OS above), open a command prompt and type bcdedit /enum and hit enter.
- To set a specific VHD or partition volume as default, locate the identifier GUID and select it by right-clicking and choose Mark, then select the entire GUID (including curly braces {}) and hit enter.
- Back at the prompt, type bcdedit /default {GUID} and hit enter, replace {GUID} with the guid you copied and pasted. To paste, right click and choose Paste.
- To change the default selection timeout, so it’s faster or slower, type bcdedit /timeout x, where x = the number of seconds before it selects the default. To make it bypass this screen, set the timeout value to 0.
- To change the description (name as it appears in the list), type bcdedit /set description <whatever you want it to say> and hit enter.
That’s it, enjoy your new VHD!