Skip to content
2009/06/01 / Oleg Soroka

Dual Booting Windows 7 VHD Only

Dual Booting Windows 7 VHD Only [Part 1]

One of the most greatest new feature of Windows 7 is a new enhanced bootloader which allows to boot supported OS (currently windows 7 only) from a VHD file.
VHD, namely Virtual Hard Disk files, were mainly used as disks for virtual machines in virtual environments, either for tests or in production for virtualized datacenter.
Since beta release, many blogs provides information about booting seven from VHD from either Windows 7 or windows vista modified bootloader.
Actually, there’s another choice. That is, to install only windows 7 bootloader on hard drive and “virtualize” hard drives for eventual VHD boot. Why booting from VHD? Well many reasons might be candidate answer but I choose OS isolation.
Right. Isolation. When OS from VHD are used to boot, files within the same partition where the VHD resides cannot be seen.
The process *should* be simple.

  1. Manually install Windows 7 Bootloader
  2. Manually create Windows 7 VHDs using Diskpart utility.
  3. Mount VHD and “slipstream” Windows 7 using imagex utility.
  4. Add Windows 7 VHD to Boot Menu.

NOTE: Booting from VHDs does NOT support hibernation, and has limited support for bitlocker.
The first thing to do is to boot from Windows 7 CD (I’m using build 6801) and enter the command prompt of windows PE. To access command prompt you just need to choose “repair your computer” from Install Windows dialog option. System recovery Options windows should come. Since the disk is empty, the “next” option will take you the recovery tool panel, where you just need to ask for command prompt.

Once the shell is open, it’s time to start creating a new NTFS Active PRIMARY partition where bo otloader will reside along with OS VHDs, using diskpart.

Use list disk to list disks and choose the one you will use to store bootloader. Mine is disk 0.

DiskpartDisk0_2DiskpartDisk0_1SELECT DISK 0
// Come on, you have boot from CD after all.
FORMAT FS=NTFS Label="whatever" QUICK

Check operations are completed successfully using list partition and list volume.

You will notice a new volume (in my case volume 1) you just created not yet assigned to any letter. Just use assign with object selected to assign it letter C. Exit diskpart.
Once you have an NTFS partition primary you can operate creating the directory “boot” where the bootloader files will reside. You should have

  • C: The partition just created with diskpart.
  • X: Ramdisk with Windows PE.
  • D: Windows 7 DVD.

The trick is to copy files from d:boot in c, delete default BCD store and create a new one.

C:> mkdir boot
C:> xcopy /h /y d:boot c:boot
C:> copy d:bootmgr c:
C:> del c:bootbcd
C:> mkdir c:windowsboot
C:> xcopy /s /h /y x:windowsboot c:windowsboot
C:> xcopy /s /h /y x:windowsbootpcat c:boot
C:> bootrec /fixboot
C:> bootrec /fixmbr
C:> bootsect /nt60 all /force
C:> bcdedit /createstore c:bcd.tmp
C:> bcdedit /store c:bcd.tmp /create {bootmgr} /d "Windows Boot Manager"
C:> bcdedit /import c:bcd.tmp
C:> bcdedit /set {bootmgr} device partition=C:
C:> bcdedit /timeout 10

Now you have a bootloader files in your primary boot partition, but sill not working.
In the next part you’ll create a new VHD and install Windows 7 inside.

“Slipstreaming” Windows

Since now, we have a “working” but useless bootloader. We need to create a new VHD and slipstream Windows 7 on it before being able to boot. Open (again) diskpart. 

VHD_1CREATE VDISK FILE="c:windowswin7_ultimate.vhd" MAXIMUM=20000
SELECT VDISK FILE="c:windowswin7_ultimate.vhd"
//I’ve been told it’s changed to MOUNT with beta1

VHD_2Now you can access your new volume mounted (which is a vhd… wow) as a normal unit (In my case, it’s E:)Ok, you have a new vhd, it’s NTFS formatted and mounted. You just need to “slipstream” windows 7 into. To accomplish this, you need imagex. You can download windows AIK from here, and copy imagex on a folder in C: for example c:imagex.

Win7_business_VHDErrorNow, by using the imagex /info d:install.wim you can read the index tag to use later to choose the version of windows to “slipstream” on your VHD. In my case 4 is for Ultimate.
Remember: vhd boot is supported (and works) only from Enterprise and Ultimate editions. Other edition will slipstream, install and configure, but will return a licensing error at your first login, as in figure.

By using

Imagex /apply d:sourcesinstall.wim 4 E:

We will tell imagex to install Windows 7 ultimate on e:, this will takes some minutes depending from your CD speed.

Adding VHD to Bootloader Menu.

This part involves playing with bcdedit to add OS to BootManager.
It’s not that tricky but tedious. Since you need at least 2 VHDs to enter in boot menu, I’ve made a secondary vhd named win7_E.vhd with a slipstreamed windows 7 enterprise edition. According to Microsoft those will be the only two versions which support vhd boot.

As I said, process adding VHDs to menu is just tedious.

bcdedit /create /d "Windows 7" /application osloader

Remember GUID returned from the first command and replace the <guid> in next commands.

bcdedit /set <guid> device vhd=[driveletter:]<directory><vhd filename>
bcdedit /set <guid> osdevice vhd=[driverletter:]<directory><vhd filename>
bcdedit /set <guid> detecthal on
bcdedit /set <guid> path windowssystem32winload.exe
bcdedit /set <guid> systemroot windows

Once it’s done for both VHDs it’s just a matter of telling Boot Manager to display them in which order and which one is default to load when timeout using:

bcdedit.exe /displayorder <guid> <guid>
bcdedit.exe /default <guid>

Done! Reboot and enjoy your new bootmanager and windows vhd boot.


Добавить комментарий

Заполните поля или щелкните по значку, чтобы оставить свой комментарий:


Для комментария используется ваша учётная запись Выход /  Изменить )

Google+ photo

Для комментария используется ваша учётная запись Google+. Выход /  Изменить )

Фотография Twitter

Для комментария используется ваша учётная запись Twitter. Выход /  Изменить )

Фотография Facebook

Для комментария используется ваша учётная запись Facebook. Выход /  Изменить )


Connecting to %s

%d такие блоггеры, как: