Virtualization has become one of the biggest and most useful technologies in
the tech industry today. Most big companies are investing heavily in this area
and giving newer and better features. Microsoft has a number of products in this
as well — from the consumer level Virtual PC product (with a new version for
Windows 7) to the enterprise class Hyper-V product range. Windows 7 brings in
one more very useful feature out of the box in this space.
The Boot-to-VHD feature is the ability of Windows 7 to directly boot into an
operating system that is not sitting on your hard disk — but inside a file on
your hard disk. Think of this as a dual or multi-boot scenario without requiring
you to re-partition hard disks. By simply installing the OS and apps of your
choice inside a file, you not only get the ability to boot your machine into
that OS, but also allow for extreme portability and backup. All you need to do
is copy the file over to a new machine and you're up and running with the new OS
in seconds!
This feature is built-in to all the “business” editions of Windows 7, namely
Professional, Enterprise and Ultimate. The file format is the standard virtual
hard disk format - VHD — used by Virtual PC and Hyper-V. The Windows 7 Disk
Management UI also recognizes the VHD file as a native hard disk. You can create
a new VHD or attach an existing VHD into the system. As soon as you do, the disk
is recognized as a normal volume on your system and you can use it like any
other drive.
One of the most useful features of Windows 7 is that it lets you create or mount a VHD like a regular hard disk. |
The system uses the native hardware even when virtualized, which allows for a bare-metal performance. |
But the great part comes when you can install an OS into it and boot off it
natively. For this, make sure you have enough space on the drive where you are
going to create the VH file. Remember that the VHD has to hold the complete OS +
any apps you want to install. Once you have determined the size you wish for
your VHD, open up Command Prompt as Administrator on Windows 7 and run DISKPART.
In the DiskPart prompt issue these commands:
CREATE VDISK FILE=D:\VPC\Win2008R2.vhd
MAXIMUM=25000
TYPE=EXPANDABLE
SELECT VDISK FILE= D:\VPC\Win2008R2.vhd
ATTACH VDISK
CREATE PARTITION PRIMARY
ASSIGN LETTER=V
FORMAT QUICK FS=NTFS LABEL=VHD
The Device Manager in the VHD shows the virtual disk driver, but everything else (including the video card) is run natively. . |
You can 'mount' virtual hard disks using the Attach command in Disk Management on Windows 7. |
They create a new VHD file in D:\VPC with a size of 25 GB. It also formats
the virtual drive with NTFS and attaches it to the system as drive V:. You can
now exit DiskPart and open and explore the drive as with any other drive.
Currently the operating systems that know of booting natively from VHD are
Windows 7 and Windows 2008 R2 only. But it's only a matter of time before you
should be able to boot any OS — such as Linux or Windows XP if you want to.
There are multiple ways of getting the OS onto this drive. The first is to
boot your machine with the Win7/2008R2 DVD and then supply the install option of
VHD with path during install. The easier way is to do it from within an
installed Windows 7 instance. You need to download a small PowerShell script
called Install-WindowsImage.ps1 from http:// code.msdn. microsoft.com/
InstallWindowsImage. Copy the script to the location where the VHD file is
located and mount or drop in the OS DVD. You need to first locate the install
source which is a .WIM file on the DVD. The file is usually named Install.WIM.
Run PowerShell as administrator and issue the following commands (assuming
that the DVD is in D:).
set-ExecutionPolicy RemoteSigned
.\Install-WindowsImage.ps1
-WIM D:\sources\install.wim
The second command will list all the different editions of Windows 7/2008R2 that
are available to install:
Index Image Name
<1> Windows Server 2008 R2 Standard (Full Installation)
<2> Windows Server 2008 R2 Standard (Server Core Installation)
<3> Windows Server 2008 R2 Enterprise (Full Installation)
<4> Windows Server 2008 R2 Enterprise (Server Core Installation)
<5> Windows Server 2008 R2 Datacenter (Full Installation)
<6> Windows Server 2008 R2 Datacenter (Server Core Installation)
<7> Windows Web Server 2008 R2 (Full Installation)
<8> Windows Web Server 2008 R2 (Server Core Installation)
Note the number of editions you wish to install. For instance if you wish to
install Win2008R2 Enterprise, full version, the number is “3”. Now issue the
following command in PowerShell:
.\Install-WindowsImage.ps1 -WIM D:\sources\install.wim -Apply -Index 3
-Destination V:
This will show you a message and then start the install. Expect it to take
about 15 minutes to complete. Once done, you have a VHD file with the OS
installed. But you still need to be able to configure the system to boot with
this new VHD file. To do this, open up Command Prompt as an administrator and
run the following command:
bcdedit /copy {default} /d “Windows 2008 R2 Enterprise VHD”
This command will return a GUID that you will need to use in the following
commands, wherever (GUID) is mentioned:
bcdedit /set {GUID} device vhd=
bcdedit /set {GUID} osdevice vhd=
This will create a new boot entry in boot manager that allows it to boot from
the VHD file. Reboot your machine and select the new entry. You will be taken to
the other OS and will have to finish some final setup steps before entering your
desktop. The great part about booting from a VHD is that you get the full power
of your system and only the hard disk is virtualized. You only lose 3-5% of
performance rather than the 50% or more when running it under VPC. The VHD also
allows you to install 64-bit editions — something that VPC does not allow. And
finally, all the native hardware is recognized and drivers installed for it,
which allows bare-metal performance. The VHD boot also recognizes the “real”
partitions and loads them — so that you still have access to your files in the
real machine. All these features together make the Boot-to-VHD a great addition
in the virtualization family in Windows 7.
Next -
Alchemy solutions increases efficiency by 30-40% with Win 7