Tuesday, November 16, 2010

Windows 7 VHD boot


Windows 7 Boot Manager can boot VHD's.

A VHD (virtual hard disk) is a normal file stored in the file system of the computer.
The VHD file when mounted is treated as a disk by the operating system (OS).
To create and mount (attach) a VHD you can use 'Disk Management'.
If a VHD is large enough you can install 32/64-bit Windows 7 (investigate for other OS's)  on it.

A VHD is very handy if you want to experiment with 32/64-bit OS's, test software in different environments e.t.c.

A good reference about installing Windows 7 on VHD is:
How to install Windows 7 on a virtual hard disk (VHD) in 10 steps - Guides & Tutorials:


On my computer I have three OS's: XP, Windows 7 and Kubuntu plus a "Windows 7-VHD".
(Windows 7 VHD file is on XP partition.)

Here are some images from the Windows BCD (boot configuration data) store regarding the VHD.

1. Windows 7 VHD Loader

2. Windows 7 VHD Recovery Loader


3. Windows 7 VHD Resume Loader

 
4. Windows 7 VHD Ramdisk options - object


5. Windows 7 VHD Ramdisk options - elements


Some comments on the images:

- the utility used is "Visual BCD Editor" and can be downloaded here:
Visual BCD Editor - Windows 7 and Vista

- all relevant BCD objects (entries) were created by "Windows 7 install on VHD".

- the images are for reference - to know what 'good' Windows 7 VHD entries look like.

A Windows 7 install creates usually three loader entries in the BCD: an 'OS Loader', a 'Recovery Loader' and a 'Resume from Hibernation Loader'. The 'Ramdisk Options' object (entry) is needed for the 'Recovery Loader'.

image 1:
The Windows 7 VHD Loader is a normal Windows 7 Loader object with special values for the 'ApplicationDevice' and 'OSDevice' elements.

image 2, 4 and 5:
The Recovery loader entry specifies parameters for loading Windows Recovery Environment. The loaded file is WinRE.wim.  Special mention for element 'RecoveryOs'=true - this element specifies that this entry(object) is a "recovery loader" - in the rest a recovery loader is a normal OS loader.
- 'ApplicationDevice' and 'OSDevice' refer to the ramdisk options through 'AddionalOptions' - compare {GUID} in image 2(form OSDevice) and image 4. (this could be a separate topic - Windows recovery loader - seems really complex).

image 3:
Resume from hibernation - loaded application is winresume.exe --> loads hiberfil.sys. (both files on VHD)