Boot Windows 7 from VHD - an amazing concept Here's how to do it
#81
Posted 26 February 2012 - 09:15 PM
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!!! :-)
#82
Posted 11 March 2012 - 09:27 PM
daremo, on 26 February 2012 - 09:15 PM, said:
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.
#83
Posted 06 June 2012 - 03:39 PM
cluberti, on 02 March 2009 - 09:26 AM, said:
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.
unawave, on 06 December 2011 - 03:16 AM, said:
Schiiwa, on 05 December 2011 - 07:04 PM, said:
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.
MagicAndre1981, on 21 March 2010 - 06:11 AM, said:
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.co.../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)
#84
Posted 07 June 2012 - 02:57 AM
DreamworlD, on 06 June 2012 - 03:39 PM, said:
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"
(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
#85
Posted 07 June 2012 - 04:51 AM
jaclaz, on 07 June 2012 - 02:57 AM, said:
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.
#86
Posted 31 March 2013 - 04:07 AM
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.
#87
Posted 31 March 2013 - 12:54 PM
http://reboot.pro/to...x-installation/
http://reboot.pro/to...ation/?p=160588
This:
http://reboot.pro/to...182-uefi-multi/
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
#88
Posted 01 April 2013 - 02:21 PM
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?
#89
Posted 01 April 2013 - 03:07 PM
MagicAndre1981, on 31 March 2013 - 04:07 AM, said:
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.micro...d799299(v=WS.10).aspx
Quote
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.microsof...a365449(v=vs.85).aspx
#90
Posted 01 April 2013 - 09:58 PM
#91
Posted 02 April 2013 - 04:28 AM
Here are the two cdob posted in a clickable format (it is needed to post them using the little icon looking like a chain):
http://technet.micro...9(v=WS.10).aspx
http://msdn.microsof...9(v=vs.85).aspx
A set of refereces should be also:
http://technet.micro...y/hh825689.aspx
http://technet.micro...y/hh825691.aspx
http://technet.micro...y/hh825709.aspx
http://technet.micro...y/hh825691.aspx
This is the refeference to set id:
http://technet.micro...0(v=ws.10).aspx
... but if you are not an OEM, additionally experienced with GPT disk, you cannot use it
Quote
jaclaz
This post has been edited by jaclaz: 02 April 2013 - 04:40 AM
#92
Posted 02 April 2013 - 08:36 AM
MagicAndre1981, on 01 April 2013 - 09:58 PM, said:
Internal "create partition primary" default is sufficient.
Compare: diskpart: detail partition
Quote
There is another difference.
Be aware: UEFI VHD boot it's not supported by windows 2008 R2 setup.exe GUI.
http://en.community....oot-to-vhd.aspx
Local hardware dosn't support secure boot.
Do you use secure boot? As there is windows 8 UEFI boot environment active, secure boot should work still.
Try both: with and without secure boot.
Can you clarify:
How do you create the VHD file?
Do you create a VHDX file?
Which tools do you use at which running OS?
Do you use a fixed size VHD?
Do you use a dynamically expanding VHD? Do you set VirtualDiskExpandOnMount?
http://technet.micro...v=ws.10%29.aspx
#93
Posted 02 April 2013 - 11:06 AM
http://gallery.techn...ageps1-0fe23a8f
With this way I got a MBR VHD which I can't even boot.
Next I used diskpart to create the VHD (I tried fixed and dynamic), converted it to GPT, created a primary partition and applied the WIM with DISM and used bcdboot to add thee VHD to the boot menu. So I did the same you posted.
I can select Win7, it boots but after the boot logo it freezes. I waited an hour but nothing happens.
#94
Posted 02 April 2013 - 12:51 PM
Windows 7 DVD booted at BIOS mode.
The letter C: refers to internal UEFI Windows 8 installation.
Shift F10, diskpart
create vdisk file=c:\win7e.vhd type=expandable maximum=12345 select vdisk file=c:\win7e.vhd attach vdisk convert GPT create partition primary format quick fs=ntfs label=VHD_7e assign letter=V
imagex.exe /apply install.wim 4 v:\
select disk 0 select par 2 detail par assign letter=S
Windows 7 bcdboot:
cd /d v:\windows\system32 bcdboot v:\windows /s s:This created a BIOS boot environment at given environment.
Windows 8 bcdboot:
cd /d c:\windows\system32
bcdboot v:\windows /s s: /f uefi
bcdedit /store s:\efi\microsoft\boot\bcd
bcdedit /store s:\efi\microsoft\boot\bcd /set {default} description "[C:]\win7e.vhd"
Reboot to internal hard disk and "[C:]\win7e.vhd" selected:
windows 7 installation does start and finish. There is a C: with label VHD_7e and size 12gb.
#95
Posted 02 April 2013 - 09:54 PM
What do you mean with Windows 7/8 bcdboot?
This post has been edited by MagicAndre1981: 02 April 2013 - 09:55 PM
#96
Posted 03 April 2013 - 11:14 AM
MagicAndre1981, on 02 April 2013 - 09:54 PM, said:
The Windows 7 bcdboot.exe dosn't create a UEFI VHD entry, booted at BIOS mode.
A Windows 8 bcdboot.exe does create a UEFI VHD entry.
Or set a UEFI VHD entry with Windows 7 or 8 bcdedit.exe:
@ECHO OFF
Rem Set BCD (boot configuration data) for VHD UEFI boot
path %~dp0..;%path%
set BCD_store=/store S:\efi\microsoft\boot\bcd
call :add_VHD \win7e.vhd "Windows 7 VHD boot \win7e.vhd"
goto :eof
:add_VHD
for /f "tokens=1-3" %%a in ('BCDedit.exe %BCD_store% /create /application OSLOADER') do set guid=%%c
BCDedit.exe %BCD_store% /set %guid% description "%~2"
BCDedit.exe %BCD_store% /set %guid% device vhd=[locate]%1
BCDedit.exe %BCD_store% /set %guid% osdevice vhd=[locate]%1
BCDedit.exe %BCD_store% /set %guid% inherit {bootloadersettings}
BCDedit.exe %BCD_store% /set %guid% systemroot \windows
BCDedit.exe %BCD_store% /set %guid% path \Windows\system32\winload.efi
BCDedit.exe %BCD_store% /set %guid% detecthal Yes
BCDedit.exe %BCD_store% /set %guid% nx OptIn
BCDedit.exe %BCD_store% /displayorder %guid% /addlast
goto :eof
#97
Posted 06 April 2013 - 04:35 AM
Here is someone with the same issue:
Quote
http://superuser.com...ron-15r-turbo-s
The strange thing is, that the 15R SE was sold with Win7 last year.
#98
Posted 14 April 2013 - 04:59 AM
Now I need to figure out if the Intel HD4000 and Radeon HD 7700 support GOP with Windows 7.
#99
Posted 15 April 2013 - 01:16 PM
I need to set the option "Load Legacy Option ROM" to true. Now I still use UEFI but with the old VGA Video BIOS. The disadvantage is a bit slower boot/Resume from hibneration and the loss of the Dell Logo during boot, but I can boot both Windows versions.



Help
Back to top











