spacesurfer

Boot Windows 7 from VHD - an amazing concept

120 posts in this topic

Does anyone know if it is possible to boot the VHD, which comes along with the XP-Mode??? Would be a nice feature to boot XP this way without installing it from CD! I'm not able to test this right now...

Edited by Schiiwa
0

Share this post


Link to post
Share on other sites

Does anyone know if it is possible to boot the VHD, which comes along with the XP-Mode???

No, that's not possible.

The operating system needs a special disk driver which redirects the access from the virtual disk to the real disk. XP (and Vista) doesn't have this driver.

0

Share this post


Link to post
Share on other sites

How to transfer control from Win7 Host Bootmgr to Bootmgr inside a Win7 VHD instead of booting the VHD from the host? How the VHD BCD Store settings should be modified to do that?

Edited by zamarac
0

Share this post


Link to post
Share on other sites

this is afaik not possible. The loader must be outside the VHD. If you have an empty HDD, try this to boot from the VHD:

http://reboot.pro/15815/

1

Share this post


Link to post
Share on other sites

The reason I asked, Win7 Bootmgr allows to transfer control to ntldr and boot WinXP, also to boot WinPE from VHD. So it might be possible to transfer control from host Bootmgr to VHD Bootmgr too, if knowing the right BCD settings.

Edited by zamarac
0

Share this post


Link to post
Share on other sites

It's not that difficult to do...

Scenario-1: you have a single partition on the host with a bcd store and bootmgr (host-store), and a VHD file also has a bcdstore and bootmgr (vhd-store), and you want to boot your system as follows:

1. PC boot from host-store

2. transfers control to vhd (i.e. transfers control to the bootmgr inside vhd)

3. vhd-store takes over and executes

Important point is the host-store; you need to lok at the windows boot loader section, and make the following changes:

Windows Boot Loader

------------------------------

identifier {default}

device vhd=[locate]\sample.vhd

path \bootmgr

osdevice vhd=[locate]\sample.vhd

systemroot \windows

where, sample.vhd is the vhd file that you want to boot from. Make sure when editing the host-store with bcdedit, you use the "-enum all" option so that you have a detailed listing of the host-store. If need be, you can also delete the BCD file (and the log files) on the host, and start from scratch.

As long as your guest-store (bcd store inside samplevhd) is correctly working (which you can test by using virtual PC and booting sample.vhd by attaching as the boot hd to see if it is booting correctly), then you shouldn't experience any problems.

Scenario-2: you have a single partition on the host with a bcd store and bootmgr (host-store), and a VHD file also has a bcdstore and bootmgr (vhd-store), and you want to boot your system as follows:

1. PC boot from host-store

2. boots from vhd

This is usualy the standard method explained in the MS technet web-site for native booting. Important points are:

1. check guest-store (bcdedit -store <mount point of vhd file>\boot\bcd -enum all) in detail and note the Windows Boot Loader settings, especially the device, osdevice, pth, and systemroot settings. Hal detect, winpe, ems settings as well as hypervisor and device Options.... Copare them to your host-store.

2. On the host-store, in the Windows Boot Loader section, the device and osdevice should point to the VHD file (VHD=[locate]\sample.vhd). Path should be the same as guest-store Windows Boot loader path statement! Same for the systemroot on host-store and the guest-store.

After the host-store is configured as explained in 1 and 2, you can remove the bcd store and bootmgr from sample vhd. You can even set sample.vhd as a NON-Active HD.

Playing with VHDs, and physical Disk partitions, I had successfulyl tested the following:

1. Physcial disk partitioned into 2 primary partitions and 1 logical partition; C (1st pri, ACT, 500 MB), D (2nd pri, 10 GB), E (3rd, logical in extended partition, 20 gb)

2. boot_wim.VHD (5gb, fixed VHD file, single partition VHD disk, pri) containing extracted contents of boot.wim file (win7), and is placed in D-drive. (Note: Initially, boot_wim.VHD is attached via disk manager, so that Boot.wim is extracted into boot_wim.VHD using "ImageX \apply".)

3. install_wim VHD (15gb, fixed VHD file, single partition VHD disk, pri) containing extracted contents of install.wim (win7), and is placed in E-drive. (Note: Initially, install_wim.VHD is attached via disk manager, so that Install.wim is extracted into install_wim.VHD using "ImageX \apply".)

4. C-drive contains only grub4dos and a menu.lst file. grub4dos boot record is installed on the MBR, and grldr is at the root of C-drive. Menu.lst file contains 2 entries:

#boot Boot.wim vhd

title 1) boot into w7 boot_wim VHD on D-drive

root (hd1,1)

chainloader /bootmgr

#boot Boot.wim vhd

title 2) boot into w7 install_wim VHD on E-drive

root (hd1,4) **** NOTE: HD1,4 is the correct entry for the first logical drive (in our example, this is the E-drive) on an extended partition for grub4dos!!!

chainloader /bootmgr

5. On both D and E drive I have setup separate bcd stores. Each bcdstore is simple and only points to the VHD file located on their respective partition

When the bcd stores are correctly configured (device, osdevice, path, systemroot entries), then the following happens when you boot the test pc:

- pc boot, grubloader displays the menu.

- if "boot into boot wim VHD" option is selected, then the control goes to the bootmgr (and boot-store) on the D-drive, and then boots the boot_wim.VHD (either using the scenario-1 or scenario-2 type of bcd store configuration explained at the beginning of this post). Therefore, your PC ends up booting into WINPE environment!

- if "boot into Install wim VHD" option is selected, then control goes to the bootmgr (and boot-store) on the E-drive, and then boots the install_wim.VHD (either using the scenario-1 or scenario-2 type of bcd store configuration explained at the beginning of this post). Therefore, your PC ends up booting into windows installer, and starts installing windows 7.

Note that if you perform windows 7 installation, it will be installed in the VHD file. You may have to reconfigure your bcd store (either in the install_wim.vhd or the host bcd store on E-drive) to be able to boot your PC into normal Windows 7 and work with your PC!

It is interesting to note that, under normal circumstances, you cannot boot windows 7 (or 2008 server) from an extended partition (logical drive), and even need your partition or disk to be set as ACTIVE! Those requirements are bypassed when you start using native VHD boot methods.

Another great advantage of going for Native VHD boot, is that you can have several VHD files pre-prepared as follows:

1. A single vhd file containing extracted contents of various Driver packs (from driverpacks.net web-site), perhaps divided into separate x86 an x64 VHD files. With the help of DPInst or other driver install utility, the drivers will be at your back and call as soon as you attach the driver VHD file. Even at the initial winpe boot phase, you can use the Shift-F10 option, and in the command prompt go for diskpart and select and attach the driver.vhd file. Especially if you had taken the time to modify your boot.wim and install.wim files and injected them with at least the chipset and mass-storage drivers, before extracting the contents of the wim files to their respective VHD files (imagex \apply)... Also the drivers.VHD files will be easy to keep up to date and modify. No more need to prepare a new USB, or burn a new CD/DVD... Mount the VHD, edit the contents to replace old files with new ones (remove unneeded drivers, etc...)

2. Another vhd file, where you have the portable applications platform and portable applications installed. At any time within a custom Win7PESE or LastOS or similar winpe environment, you can attach the VHD file, and access ready, installed portable apps, without having to modify, uninstall, re-install or even delet old and install new portabl apps within your custom winpe or even normal Windows environment! Talk about modularity!!! :-) And the only upates you have to perform are within the PPApps.VHD file itself, by mounting it and modifying its contents. Helps with organizing and keeping things up-to-date and keeping your OS VHD clutter free!

As long as you are able to get into some kind of win 7 flavor (either a winpe, or win 7 light or a normal win 7 via bootmgr and booting into vhd), then there's a lot of flexibility in how to work with stuff.

I used to do similar with grub4dos, but it's no flexible enough. For example to be able to boot iso file, they need to be small and contiguous on the disk (defragged). To big image file or partition is fragmented with iso file segments here and there, you have to do a lot of preparation work to get an iso mage to boot and continue work. Same with HD image files in grub4dos.

Now, I like the ability to use the grub4dos to pass control to selective (and separate) bootmgr and bcd stores located on various partitions, and let bootmgr manage my vhd files!

Another disadvantage I have come across is that when doing testing with VMs under hyper-V, the VM freezes when VHD is booted using grub4dos, so I had to rely on bootmgr and bcd store to be able to boot VMs under hyper-V. I also tested nested VHDs (VHD within a apartition of a VHD) under hyper-V with careful design of BCD stores on both the container VHD and the "containED" VHD!!! :-)

0

Share this post


Link to post
Share on other sites

Playing with VHDs, and physical Disk partitions, I had successfulyl tested the following:

1. Physcial disk partitioned into 2 primary partitions and 1 logical partition; C (1st pri, ACT, 500 MB), D (2nd pri, 10 GB), E (3rd, logical in extended partition, 20 gb)

2. boot_wim.VHD (5gb, fixed VHD file, single partition VHD disk, pri) containing extracted contents of boot.wim file (win7), and is placed in D-drive. (Note: Initially, boot_wim.VHD is attached via disk manager, so that Boot.wim is extracted into boot_wim.VHD using "ImageX \apply".)

3. install_wim VHD (15gb, fixed VHD file, single partition VHD disk, pri) containing extracted contents of install.wim (win7), and is placed in E-drive. (Note: Initially, install_wim.VHD is attached via disk manager, so that Install.wim is extracted into install_wim.VHD using "ImageX \apply".)

4. C-drive contains only grub4dos and a menu.lst file. grub4dos boot record is installed on the MBR, and grldr is at the root of C-drive. Menu.lst file contains 2 entries:

................

5. On both D and E drive I have setup separate bcd stores. Each bcdstore is simple and only points to the VHD file located on their respective partition

..............

ADDENDUM

I encountered a slight problem when native booting a winpe differencing VHD file (i.e. a standard or customized boot.wim file applied to a VHD file). I was trying to set up the following situation:

1. Internal HD partitioned C (Active, primary) to be used for bootmgr and bcdstore (and grub), D (logical drive on extended partition) to be used to store VHD files, E (logical drive on extended partition) to be used to store differencing VHD files.

2. bootwim.vhd (fixed vhd with 5gb cap, single partition, primary) located on D drive. Obtained by applying boot.wim file on to bootwim.vhd

3. bootwim-diff.vhd located on E drive (which is a child of the bootwim.vhd [ "parent VHD" ] that is located on D drive)

The reason I tried to use differencing disk is to keep the original bootwim.vhd file static, and get any changes written to the differencing disk, and if need be later merge the child vhd (differencing disk) with the parent vhd.

Then, I configured the bcdstore on C drive to boot from the bootwim-diff.vhd (located on E drive), and while testing this configuration, I end up with bcdstore errors. I have not been able to boot from the differencing disk (on E drive)!

However, if I set up bootwim-diff.vhd on the D drive (same drive where bootwim.vhd -the parent vhd- file is located), then I can boot from the differencing VHD.

Unfortunately, I don't have any answers to the problem yet.

0

Share this post


Link to post
Share on other sites

I stand corrected, looks like Be did this in 2000. The QnX one I knew about, but it requires DOS to load and a few drivers, so it's not self contained. Be appears to be, however, so it counts.

And my google-foo is good, it's just that all 8 people who used BeOS didn't really document anything in depth regularly, and the Be archives aren't exactly easily searchable.

Once again MS reinvented the wheel, and once again they're banging in chest that have saved us miserable users with a brand new shining technology. Talking historically *NIX solutions can do this from before `90s. Now any linux kernel do have the support to boot from image files.

Apparently, using plain VHD is complete loss of time. You can use a normal raw snapshot partition image with the same success, and with less complication. Using differential one is something else. But here comes the problem: Differential VHDs are big pain in the a**. After couple sector rewrite, the differential file is with the same size as the original VHD image... so pointless. Better create couple of image backups instead using VHD.

Does anyone know if it is possible to boot the VHD, which comes along with the XP-Mode???

No, that's not possible.

The operating system needs a special disk driver which redirects the access from the virtual disk to the real disk. XP (and Vista) doesn't have this driver.

You can only boot Windows 7 from a VHD

This is not true at all. You can boot whatever you like from VHD image file using Grub4DOS or even Grub (yes, my friends, open community once again will save the day). However if you like to load OS from a differential VHD, which is something much more interesting you may use this tool from VMLite (http://www.vmlite.com/index.php/products/vboot), which is based once again on Grub. In this case VMLite do have a driver for WinXP7Vista2k. If you need the first option, using without differential VHD, once again you may use an Open Source driver for WinXP7Vista2k (look&search for WinVBlock). Linux distros doesn't even need such drivers. They're implemented as a planned support since Kernel version 2 (Long, long time ago)

0

Share this post


Link to post
Share on other sites

This is not true at all. You can boot whatever you like from VHD image file using Grub4DOS or even Grub (yes, my friends, open community once again will save the day).

To be more specific, the grub4dos (and Firadisk and Winvblock) capabilities, are a "side effect".

A "static" .vhd is nothing but a plain "dd-like" disk image with a 512 byte footer added.

These tool DO NOT "support" specifically .vhd's, they are intended for and do support "dd-like" images.

By pure chance (MS would call this "by design" ;)) a static .vhd - in the "eyes" of the mentioned tools - is the same thing (only it has one "unused" sector at the end).

(and yes the format is actually the old Connectix one)

Also, to put things in their historical perspective, in february/march 2009 neither of Firadisk or Winvblock were available (let alone vmlite).

Some list/history:

http://reboot.pro/1507/

Winvblock:

http://reboot.pro/8168/

Firadisk:

http://reboot.pro/8804/

jaclaz

0

Share this post


Link to post
Share on other sites

Also, to put things in their historical perspective, in february/march 2009 neither of Firadisk or Winvblock were available (let alone vmlite).

Some list/history:

http://reboot.pro/1507/

Winvblock:

http://reboot.pro/8168/

Firadisk:

http://reboot.pro/8804/

jaclaz

Ou.. thanks about those..

Didn't know about.

Personally I am using WinVblock since this year, so didn't know that it is so recent.

0

Share this post


Link to post
Share on other sites

I have a question. Does this native Boot works with UEFI?

I want to boot a Win7 Ultimate on a Win8 Laptop which uses UEFI (secure boot off). I converted the Win7 WIM with the Convert-WindowsImage.ps1 script, added it to the bootmenu but when I select the Win7 VHD, nothing happens and wIn7 doesn't boot.

:blink:

0

Share this post


Link to post
Share on other sites

See if anything here is of use/help/etc.:

?p=160588

This:

should work alright (but is about Windows 8 on USB hard disk, so you will need to experiment, reportedly it is possible to use a Windows 7 VHD with this, though cannot say if in the "native" mode).

jaclaz

0

Share this post


Link to post
Share on other sites

ok, I found the cause. The generated VHD from the Powershell script is MBR style, but you need GPT.

So I created a VHD, converted it to GPT and used DISM to apply the WIM into the VHD. Now I can select the VHD, I can see the text "Starting Windows" but it freezes here. What's this? What do I miss now?

0

Share this post


Link to post
Share on other sites
Does this native Boot works with UEFI?

Yes, read: Add a Native-Boot Virtual Hard Disk to the Boot Menu

To update a UEFI-based computer to include a Windows 7 boot menu

http://technet.microsoft.com/en-us/library/dd799299(v=WS.10).aspx

I want to boot a Win7 Ultimate on a Win8 Laptop which uses UEFI (secure boot off).

Do you like to add Win7 VHD to the same hard disk?

Boot Windows 8 and run diskpart

create vdisk file=c:\win7.vhd type=fixed maximum=16789
select vdisk file=c:\win7.vhd
attach vdisk
list disk
clean
convert GPT
create partition primary
format quick fs=ntfs label=VHD_System
set id="EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
assign letter=V
list vol
exit

DISM.exe /Apply-Image /ImageFile:E:\sources\install.wim /Index:4 /ApplyDir:V:\
bcdboot V:\Windows

bcdedit

powercfg /h off

Lettter E: refers to a mounted Windows 7 x64 ISO image.

Adjust the example.

PartitionType: A GUID that identifies the partition type.

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365449(v=vs.85).aspx

0

Share this post


Link to post
Share on other sites

I missed this set id. Is this important? The rest is the same as I did. I'll try it again this evening.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.