Windows 7 : Designing a Client Hardware Platform (part 2) - Boot from VHD

3/8/2013 3:12:23 AM

The Enterprise and Ultimate editions of Windows 7, as well as all editions of Windows Server 2008 R2, can be configured to boot from a virtual hard disk file (VHD). The VHD file is stored on the hard disk as a normal file, and the deployed operating system is contained within this file. In essence, the VHD file serves as a container located on the hard disk. The benefit of deploying an operating system to a container is that the container can be moved to another platform if you need to move it. For example, to transfer a fully deployed computer from one host to another, boot using the Windows PE environment and copy the VHD file to a new location. The only step required to prepare the new location is to edit the boot configuration file to point to the operating system on the VHD. You perform the task of boot environment configuration in the practice exercise at the end of this lesson.

Another benefit of deploying to VHD rather than consuming an entire disk partition with an installation of Windows 7 is that it simplifies the process of deploying Windows 7 in a multiple operating system boot configuration. For example, you could configure two VHD files, one of which is configured and optimized to run one set of applications, and another that you have configured and optimized to run a separate set of applications.

You can create VHD files using the Diskpart.exe utility and through the Create And Attach Virtual Hard Disk dialog box available from the Disk Management Console. This dialog box is shown in Figure 1. When you create a VHD on a hard disk that you intend to use as the host for an operating system, you choose between dynamically expanding and fixed-size disk types. A dynamically expanding virtual hard disk increases size as needed until it consumes the volume that hosts it. Dynamically expanding virtual hard disks become increasingly fragmented over time. Fixed-size disks use a fixed amount of space and are less likely to become fragmented, which increases overall performance. The drawback to fixed-size disks is that you cannot expand them if the need arises. It is also possible to use Diskpart.exe to configure a boot from VHD on differencing disks. Differencing disks allow you to discard changes to the operating system at a later time.

Creating and attaching VHD

Figure 1. Creating and attaching VHD

You can deploy an operating system to an existing VHD file using the traditional installation method or by mounting the VHD file and using the ImageX.exe utility to apply an image to the VHD file. You use this second method in the practice exercise at the end of this lesson. You can also obtain a utility that converts files in Windows Imaging Format (WIM) directly to VHD files, although Microsoft does not directly support this method.

More Info


To learn more about the VIM to VHD converter, consult the following page on MSDN:

You can deploy fully prepared VHD files from Windows Deployment Services running on computers with the Windows Server 2008 R2 operating system. This allows VHD files to be deployed directly to hard disk drives through a multicast transmission.

A native VHD boot has the following limitations:

  • Can be used only for Enterprise and Ultimate editions of Windows 7 and Windows Server 2008 R2.

  • A maximum of 512 VHD files can be attached concurrently.

  • Operating system hibernation is not supported, although sleep mode is supported.

  • VHD files cannot be nested.

  • BitLocker cannot be used to encrypt the host volume used for native VHD boot. BitLocker cannot be used on volumes hosted inside a VHD.

  • The parent volume of the VHD cannot be configured as a dynamic disk.

  • The attached VHD volume cannot be configured as a dynamic disk.

More Info


To learn more about configuring Windows 7 to boot from VHD, consult the following document on TechNet:

Exam Tip

Remember which editions of Windows 7 can use the boot from VHD functionality. Remember which edition of Windows 7 includes four virtual licenses.

Practice: Preparing Boot from VHD

You can install the Windows 7 operating system so that it boots from a VHD file that is installed on physical hardware. This method has a benefit of making the operating system more portable.

EXERCISE 1 Preparing for and Installing a VHD Boot

In this exercise, you prepare a computer for a VHD installation of Windows 7. Only the Enterprise and Ultimate editions of Windows 7 allow you to perform an installation to a VHD file on physical hardware. To perform this practice, ensure that your computer running Windows 7 has at least 20 GB of free hard disk space. You need to have access to ImageX.exe, which is part of the Windows AIK tools, to complete this practice.

  1. Log on to computer WKSTN1.

  2. Open an elevated command prompt and copy the file Install.wim, which is located in the sources directory of the Windows 7 installation media to the directory c:\wim-store. Also, copy the ImageX.exe utility from the Windows AIK directory to the c:\wim-store folder.

  3. Start diskpart by entering the command diskpart.

  4. At the diskpart prompt, type list disk to list the current disks on the computer.

  5. At the diskpart prompt, type create vdisk file=c:\win7vhd.vhd maximum=20000 type=fixed.

  6. At the diskpart prompt, type select vdisk file=c:\win7vhd.vhd.

  7. At the diskpart prompt, type attach vdisk, which attaches the selected disk.

  8. At the diskpart prompt, type list disk to verify that the disk has been created. On your screen, you should see something like the text shown in Figure 2.

    Verifying VHD

    Figure 2. Verifying VHD

  9. Select the disk that you created using the select disk X command where X is the identifier of the newly created virtual hard disk.

  10. Issue the create partition primary command to create a partition on the selected virtual hard disk.

  11. Issue the select partition 1 command to select the partition, and then issue the active command to mark the partition as active.

  12. Issue the command format fs=ntfs quick. When this command completes execution, issue the command assign. A pop-up window that details the drive letter assigned to the VHD file is displayed. Close this dialog box, and then in the command prompt, type exit to leave the diskpart utility.

  13. Use the command dism.exe /get-wiminfo /wimfile:c:\wim-store\install.wim to determine the index assigned to the Windows 7 Ultimate or Windows 7 Enterprise operating system file image.

  14. Use the command c:\wim-store\imagex.exe /apply c:\wim-store\install.wim /check X e:\ where e:\ is the volume address label that was assigned to the VHD file when you used diskpart in step 12, and X is the index number of the operating system you discovered in step 13, as shown in Figure 3.

    Applying the image to the VHD

    Figure 3. Applying the image to the VHD

  15. Enter the command diskpart to start the diskpart utility.

  16. Enter the command select vdisk file=c:\win7vhd.vhd, and when this command completes, enter the command detach vdisk. This detaches the virtual disk from the drive where you applied it. Type exit to leave the diskpart utility.

  17. Create a copy of the current boot loader entry by entering the command bcdedit /copy {current} /d “VHD Boot”. Make a note of the GUID that is generated, as highlighted in Figure 4. You should use the command prompt’s ability to mark and copy text to copy this to the buffer.

    GUID of the new boot entry

    Figure 4. GUID of the new boot entry

  18. Enter the command bcdedit /set {6f159079-ab06-11de-84cb-d945bc04a2b7} device vhd=[c:]\win7vhd.vhd where {6f159079-ab06-11de-84cb-d945bc04a2b7} is the unique GUID assigned on your computer.

  19. Enter the command bcdedit /set {6f159079-ab06-11de-84cb-d945bc04a2b7} osdevice vhd=[c:]\win7vhd.vhd where {6f159079-ab06-11de-84cb-d945bc04a2b7} is the unique GUID assigned on your computer. This command differs from the one in step 18 in that you use the osdevice parameter instead of the device parameter.

  20. Enter the command bcdedit /set {6f159079-ab06-11de-84cb-d945bc04a2b7} detecthal on.

  21. Type bcdedit /set {6f159079-ab06-11de-84cb-d945bc04a2b7} description “Boot from VHD”.

  22. You can now reboot into the operating system deployed to the VHD file.

  •  Windows 7 : Designing and Managing a Licensing Strategy (part 1) - Volume Licensing Activation Methods
  •  How To Transfer Data From SSD To HDD
  •  9 Interesting Apps For Windows 8
  •  Windows Server 2003 : Moving from Workgroups to Domain Environments (part 3) - Moving Operations Master Roles, Back Up AD
  •  Windows Server 2003 : Moving from Workgroups to Domain Environments (part 2) - Configuring Sites
  •  Windows Server 2003 : Moving from Workgroups to Domain Environments (part 1) - Using dcpromo, Confirming DNS Registration of DC Information
  •  Windows 7 : The Zune PC Software (part 4) - Using Zune - Working with Videos, Organizing Pictures
  •  Windows 7 : The Zune PC Software (part 3) - Using Zune - Rating Content, Working with Playlists
  •  Windows 7 : The Zune PC Software (part 2) - Using Zune - The Zune User Experience, Enjoying Music
  •  Windows 7 : The Zune PC Software (part 1) - Finding and Installing Zune, Configuring the Zune Software
    Top 10
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    The latest Audi TT : New angles for TT
    Era of million-dollar luxury cars
    Game Review : Hearthstone - Blackrock Mountain
    Game Review : Battlefield Hardline
    Google Chromecast
    Keyboards for Apple iPad Air 2 (part 3) - Logitech Ultrathin Keyboard Cover for iPad Air 2
    Keyboards for Apple iPad Air 2 (part 2) - Zagg Slim Book for iPad Air 2
    Keyboards for Apple iPad Air 2 (part 1) - Belkin Qode Ultimate Pro Keyboard Case for iPad Air 2
    Michael Kors Designs Stylish Tech Products for Women
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    Popular Tags
    Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Exchange Server Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe Photoshop CorelDRAW X5 CorelDraw 10 windows Phone 7 windows Phone 8 Iphone