Jump to content

Boot Windows 7 from VHD - an amazing concept


spacesurfer

Recommended Posts

Due to the stupid board software all links that contains brackets are parsed incorrectly.

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.microsoft.com/en-us/library/dd799299(v=WS.10).aspx

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

A set of refereces should be also:

http://technet.microsoft.com/en-us/library/hh825689.aspx

http://technet.microsoft.com/en-us/library/hh825691.aspx

http://technet.microsoft.com/en-us/library/hh825709.aspx

http://technet.microsoft.com/en-us/library/hh825691.aspx

This is the refeference to set id:

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

... but if you are not an OEM, additionally experienced with GPT disk, you cannot use it ;):

This command is intended for use by original equipment manufacturers (OEMs) only. Changing partition type fields with this parameter might cause your computer to fail or be unable to boot. Unless you are an OEM or experienced with GPT disks, you should not change partition type fields on GPT disks by using this parameter.

jaclaz

Edited by jaclaz
Link to comment
Share on other sites


I missed this set id. Is this important?
No, the set id command is obsolete.

Internal "create partition primary" default is sufficient.

Compare: diskpart: detail partition

The rest is the same as I did.

There is another difference.

Be aware: UEFI VHD boot it's not supported by windows 2008 R2 setup.exe GUI.

http://en.community.dell.com/techcenter/extras/w/wiki/uefi-boot-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.microsoft.com/en-gb/library/gg318055%28v=ws.10%29.aspx

Link to comment
Share on other sites

I created the VHD first with the Powershell script under Win8:

http://gallery.technet.microsoft.com/scriptcenter/Convert-WindowsImageps1-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.

Link to comment
Share on other sites

As for testing:

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.

Link to comment
Share on other sites

What do you mean with Windows 7/8 bcdboot?

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

Link to comment
Share on other sites

this Dell Laptop doesn't seem to be Win7 compatible. I created an USB thumbdrive with Rufus, I booted from it and it also freezes at the bootlogo (Starting Windows) :crazy: So I'm not able to start the setup or create a VHD.

Here is someone with the same issue:

Though it boots from the DVD & shows the first (all black & grey screen) which says Windows loading files; the installation freezes at the second screen that says 'Starting Windows'.

http://superuser.com/questions/541472/how-to-clean-install-windows-7-professional-64bit-on-dell-inspiron-15r-turbo-s

The strange thing is, that the 15R SE was sold with Win7 last year.

Link to comment
Share on other sites

  • 2 weeks later...

ok, I found the cause.

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.

Link to comment
Share on other sites

  • 6 months later...

Question is at the end. I've done this (booting from VHD) using the "Sysprepped" Win VHD" created by this application. This is booting a Win7 VHD from from a Win7 machine. It worked fine. Now I'm trying the next step with the linked updated application that creates a similar (sysprepped) Win8.1 VHD. I tried to boot it the same way but about a minute after loading, it says that it "can't repair that version of Windows". I don't know if the message comes from the booted VHD or from my actual Win7 machine.

I see this guy saying he boots a Win8 VHD in Win7 "without messing up with the Win7'... so I thought why does mine not work ? Am I right thinking he did, by installing Win8 to a VHD on the machine, change the bootloader from Win7 to Win8, and this is not undone later at the end of his article? But my "ready made" Win8 VHD will not boot because Win7 doesn't boot Win8 (like in classic dual boot, the later OS has to be installed on top of the earlieer one). That was the question. Am I right in my diagnostic ?

Side note; there is no way I've made an error in the BCD as I just switched the names of the files, (((I think it's a pretty cool trick, I have a 0kb file with the actual file name of the OS/vhd that I swap name with "the VHD" that's declared in the BCD, then I do the same with the next vhd file))).

Link to comment
Share on other sites

Thanks. An other remark; I left that Win7 VHD running for too long, it got bored and began to defrag my system partition!... So it's not as "interference free" as 1st thought.

Well, that is your fault. :w00t:

Windows 7 booted from a VHD is in no way different from a Windows 7 booted from a "real" partition.

It will attempt to take possession of your PC (all your base are belong to us ;)), it is your duty - and you should know that by know - to keep it busy/entertained in such a way that it doesn't get bored and starts doing random maintenance tasks. :ph34r:

:lol:

jaclaz

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Thanks. An other remark; I left that Win7 VHD running for too long, it got bored and began to defrag my system partition!... So it's not as "interference free" as 1st thought.

More seriously, this caused one badly needed program in the resident Win7 to stop working at the time (this was a painfull monday morning at work, back from a week off :unsure: ). I then rolled back some video driver updates that I thought were the cause of my problem. I got a BSOD! Then an other, then popup messages about Explorer crashing. I ended up disabling the device in Bios (switchable video cards)...OK ! I later spent a few hours reinstalling it with lots of trials and lots of errors. I think the first cause was the Win7 performance toolkit being nuked by the external defrag. So kids, ... disable Defrag in your VHD ! B)

Link to comment
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.
×
×
  • Create New...