Network Simulation & IT Training | Boson Blog

MS Windows 7 Tips and Tricks | 2.5.3 Native boot

Written by Kelson Lawrence | Dec 6, 2012 10:22:00 PM
2.5.3 Native boot

By Val Bakh

Windows 7 and Windows Server 2008 R2 support a feature called native boot. Native boot refers to a situation where a physical computer boots from a physical disk into an operating system that is installed on a virtual hard disk (VHD). Let’s take a look at how a blank, or bare-metal, computer can be configured for a native boot.

Insert a Windows 7 installation DVD, and boot into WinPE. Open a Command Prompt window, and use the Diskpart command-line tool to partition and format the computer’s physical hard disk, which in a native-boot scenario can be referred to as the host disk. Although a single partition is sufficient, it’s better if you create a separate system volume and one or more additional volumes. Next, create and attach a VHD by running Diskpart subcommands similar to the following:

create vdisk file=VHDFilePath.vhd maximum=MaxSize type=expandable
select vdisk file=VHDFilePath.vhd
attach vdisk

The type=expandable option is not really necessary; it is included in the command here only as an example. Your goal is to deploy a Windows 7 image to the VHD. When you have done that and the computer boots into the operating system on the VHD for the first time, the VHD will be automatically expanded to its specified maximum size and, henceforth, will actually become a fixed VHD. So you can simply omit this parameter, and it will automatically default to the fixed type. Make sure you have plenty of free space remaining on the host disk. Although the operating system will be installed inside the VHD, the paging file will be kept outside, on the host disk, for performance reasons.

Once the VHD has been attached, the system treats it as if it were a real, physical hard disk. Generally, you could partition and format it and assign it a drive letter. However, doing so is necessary only if you want to apply a custom image to the VHD by using ImageX. If you want to simply perform a clean installation of Windows 7, all you need to do is exit Diskpart, close the Command Prompt window, and click Install now in the initial Install Windows screen. When prompted, specify that Windows 7 is to be installed on the disk that is represented by the VHD. You might receive a message saying that the selected disk is not suitable for the installation, but it is usually safe to ignore the message. Just click Next, and let Windows Setup do the rest: it will create and format a boot volume on the VHD, install Windows 7, and configure the system volume on the host disk to boot the computer into the newly installed instance of Windows 7.

Let’s try another approach now. Suppose sometime earlier you had created a custom Windows 7 image and captured it into a Windows Imaging Format (WIM) file. Now you want to use it in a native-boot scenario on a new computer. Boot into WinPE, create a VHD, and attach it as you did before. Because the attached VHD appears in Diskpart as just another disk, you can create a volume on the VHD, format it, and assign it a drive letter just as you would with any other “normal” disk. Then apply the custom WIM image to the VHD by using ImageX. Finally, you need to configure the system volume on the host disk so that the computer can boot into the new image on the VHD. If you are familiar with our previous blog postings, you already know that the Bcdboot tool can copy the boot code to the system volume and that you can use the Bcdedit tool to make any adjustments to Boot Configuration Data (BCD) if necessary. You can find all the necessary details in Microsoft TechNet Library at the following Web site: Virtual Hard Disks in Windows 7 and Windows Server 2008 R2.

Once you have installed Windows 7, you can customize it by configuring whatever settings you need and by installing additional applications. Depending on your further goals, you can either generalize the installation by using the Sysprep tool or keep the custom installation the way it is. Before continuing, you should copy the resulting VHD, for any future use, to a safe location, such as an external USB hard disk or a network share on a remote file server. Next, you can boot into WinPE and—again, by using Diskpart— create a differencing VHD with the original VHD as its parent. You can then adjust BCD—by using Bcdedit—to point to the new VHD. After you restart the computer, all the changes that occur to the system will now be stored in the differencing VHD, while the original VHD will remain intact. If at any point you need to revert to the original installation, all you need to do is replace the differencing VHD with a new one with the same name. This approach is very similar to the virtual lab scenario that we discussed in our previous blog postings, except that it occurs on a physical computer rather than on a VM. However cool VMs might be, they have certain limitations. For example, VMs on a Hyper-V server include only very limited support for USB and other devices that are external to the VMs. Consequently, if your work involves testing new hardware or device drivers, you need a physical computer. Running it off a VHD allows you to easily revert to the original environment as well as to easily switch the same computer to the environment associated with any one of the differencing VHDs.

 

 

Interested in Microsoft Certification?