Creating a VHD for multi-boot in Windows 7

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.

  1. Create a new VHD
    1. Go to Start, right-click on Computer and choose Manage
    2. Under Storage in the left pane, single-click Disk Management
    3. In the Actions pane on the right, click More Actions, then choose Create VHD
    4. 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.
    5. The VHD will be created, this can take anywhere from 5-20 minutes.
    6. 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.
    7. Make sure MBR is selected and click OK.
    8. You should now have a VHD, ready for installation of your favorite OS.
  2. Prepare your bootable OS
    1. 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.
    2. 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.
    3. 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.
    4. 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.
    5. In step 4, the drive will be formatted, the OS will be installed on the drive, and it will be configured to be bootable.
    6. You should now have a bootable media with your desired OS on it.
  3. Install your OS on your VHD
    1. 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.
    2. Follow the on-screen instructions for installation of your OS.
    3. 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.
    4. Type DISKPART and hit enter
    5. 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.
    6. At the DISKPART> prompt, type attach vdisk and hit enter
    7. Close the command prompt window
    8. 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.
    9. 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.
    10. A BCD entry will be created for you, and set to default upon completion.
  4. Changing boot order/default boot settings after installation
    1. 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.
    2. In your default OS (prior to installing the new OS above), open a command prompt and type bcdedit /enum and hit enter.
    3. 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.
    4. 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.
    5. 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.
    6. 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!

Comments are closed.