MSFN Forum: Boot Windows 7 from VHD - an amazing concept - MSFN Forum

Jump to content


Windows 7 forum rules

If you have questions about customizing Windows 7 that are vLite-specific, please post them in the vLite forum, not here. If you have questions regarding the unattended installation of Windows 7, please post them in the Unattended Windows 7/Server 2008 R2 section.
  • 5 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Boot Windows 7 from VHD - an amazing concept Here's how to do it

#1 User is offline   spacesurfer 

  • Pharmassist
  • Group: Patrons
  • Posts: 1,668
  • Joined: 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 03 February 2009 - 03:11 PM

1. Install Windows 7 to VHD from DVD
-----------------------------------------------------

With Windows 7, you now have the option to boot the OS from a VHD, a virtual disk file, instead of a partition. This way, you don't have to reconfigure your hard drive partitions.

Limitations: Hibernate is not supported.

Here are the simplified instructions:
1) Start Windows 7 installation from DVD.
2) Press Shift+F10 to start the command prompt.
3) Start diskpart.
4) Use the "create vdisk file=D:\Win7.vhd maximum=xxxxx" to create a virtual hard disk. Choose your drive and filename accordingly. xxxxx is in MB.
5) Type "select vdisk file=D:\Win7.vhd".
6) Type "attach vdisk". You will get a confirmation that it was attached.
7) Type "exit" to exit diskpart. And then close the command prompt.
8) Click on "Install Now" and install as you would normally by clicking on "Custom Install". Choose your attached vdisk as the location.

The installation takes care of adding the boot option to bcd. You don't have to do anything.

See Virtual Hard Disk Booting on a tutorial for VHD booting.

also check this out: Install Windows 7 to a VHD and add boot option to Vista's menu.

Basically, instead of installing windows 7 to your physical HDD by getting rid of Vista or even dual booting off another partition, you can install to a virtual HDD (in VHD format), and boot off the VHD so you actually get the hardware functionality to play with!!

Build 7068 does not allow calculation of the WEI score.

2. Install Existing VHD to Boot Menu of Windows 7
-------------------------------------------------------------------

If you already have a VHD that you want to boot from, you can simply add it to the boot menu rather than going through the above steps. If you have a Virtual PC image, for example, you can syprep it, then add it to Windows 7 menu. Vista's boot manager will not work - you have to update it to Windows 7 boot manager if you want this to work.
First, here how to add the vhd to the boot menu:

Open elevated command prompt, then type the following commands in sequence:

C:\>bcdedit /copy {current} /d "My New VHD Description"
C:\>bcdedit /set <guid> device vhd=[driveletter:]\<directory>\<vhd filename>
C:\>bcdedit /set <guid> osdevice vhd=[driverletter:]\<directory>\<vhd filename>
C:\>bcdedit /set <guid> detecthal on

Note: The first command will Return the GUID of the Loader Object that you will use to replace <guid> below
Note: vhd=[driveletter:]\<directory>\<vhd filename> is the new syntax supported for BCDEdit.exe to locate VHD File and Bootmgr will locate the partition containing the VHD File to boot from.

Type bcdedit /v to check the bcd store.

3. How to Boot VHD without Windows 7 Installed
-----------------------------------------------------------------

If you have Vista and want to boot a Window 7 VHD, then you need to copy the boot manager of Windows 7 to Vista's partition. You need to copy C:\bootmgr and C:\windows\system32\bcdedit.exe to an external source from Windows 7. You could extract these files from the Windows 7 VHD using WinImage or another program.

Then, open an elevated command prompt in Vista and unhide bootmgr (attrib -h -r -s bootmgr) and replace it with Windows 7's. Do same for bcdedit. You might consider making backup copies of these files before replacing them.

Then, add the VHD item to the boot menu using #2 above.

4. How to Remove
-------------------------
To remove, run the following command in a elevated command prompt:
bcdedit /delete {guid} /cleanup

Delete the vhd file.

This post has been edited by spacesurfer: 03 April 2009 - 04:49 PM



#2 User is offline   McoreD 

  • Member
  • PipPip
  • Group: Members
  • Posts: 156
  • Joined: 03-September 04

Posted 04 February 2009 - 08:45 AM

spacesurfer, That's great! I am going to try this as well. Do you find it significantly slower or do you experience normal speeds when using Windows 7 this way? Is it good enough to watch movies etc?

#3 User is offline   spacesurfer 

  • Pharmassist
  • Group: Patrons
  • Posts: 1,668
  • Joined: 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 04 February 2009 - 08:57 AM

I haven't tried it yet. I'm going to do that today. I had two similar questions:

1) Does booting and running from VHD take a performance hit?
2) Do you have all your other partitions and HDD's available for read-write operation?

I'll find out today! Installing right now as I speak.

This post has been edited by spacesurfer: 04 February 2009 - 09:14 AM


#4 User is offline   suryad 

  • MSFN Expert
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,216
  • Joined: 17-February 05

Posted 04 February 2009 - 10:23 AM

So for the uninitiated, this is something like using a VM...like Virtualbox and running the OS in it except you dont need to use a VM like Virtualbox?

#5 User is offline   spacesurfer 

  • Pharmassist
  • Group: Patrons
  • Posts: 1,668
  • Joined: 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 04 February 2009 - 12:05 PM

View Postsuryad, on Feb 4 2009, 11:23 AM, said:

So for the uninitiated, this is something like using a VM...like Virtualbox and running the OS in it except you dont need to use a VM like Virtualbox?

YES! Exactly.

So, I'm using Windows 7 beta build 7000 right now and typing this from it currently. I followed the instructions exactly.

Prior to install, my setup was C: = Vista SP1 on 12 GB partition and D: = Storage 25 GB partition.

During install, I created a VHD on D: 6.66 GB. I used a vLited Windows 7 ultimate. The installation process is automatic. It automatically creates a boot entry to boot from VHD.

After install, I HAD ACCESS TO MY STORAGE PARTITION (D:) - GREAT!!! My Vista partition is not assigned a drive letter but I can see it in Drive Management. I don't particularly need it though.

Performance-wise - I see no performance hit as yet. I'm using firefox 3.0.6 to type this and I'm installing Comodo Firewall right now.

#6 User is offline   gamehead200 

  • SEARCH!!! SEARCH!!!
  • Group: Super Moderator
  • Posts: 7,035
  • Joined: 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 04 February 2009 - 10:33 PM

Hmmm... Interesting and a great way of installing Windows 7.

[ Pinned. ] :)

#7 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 05 February 2009 - 04:10 AM

VERY GOOD find! :)

It's what I have (failing miserably ;)) attempted to ask help with since a couple of years:
http://www.boot-land...topic=1507&st=1
(for "normal" 2K/XP/2003)

Maybe this can be somehow "retro-fitted".....:unsure:

:thumbup

jaclaz

#8 User is offline   eyeball 

  • Have you tried turning it off and on again?
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,150
  • Joined: 28-October 05

Posted 05 February 2009 - 06:58 AM

Yes i would imagine a performance hit is to be expected with this as it works by using a driver that understands the NTFS filesystem and VHD format, it will locate the VHD file on the physical NTFS volume then open that up, and boot windows reading its the NTFS structure from the VHD file.

#9 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 05 February 2009 - 08:22 AM

Related video from MS, link originally posted by allanf on boot-land:
http://www.boot-land.net/forums/index.php?...c=6982&st=2

http://download.microsoft.com/download/D/9...A8FA31/dism.wmv

jaclaz

#10 User is offline   amigafan 

  • Junior
  • Pip
  • Group: Members
  • Posts: 52
  • Joined: 24-April 04

Posted 05 February 2009 - 08:59 AM

I'd hardly call this an amazing concept, since Linux, BeOS and QNX were doing this a decade ago.

#11 User is offline   cluberti 

  • Gustatus similis pullus
  • Group: Supervisor
  • Posts: 11,208
  • Joined: 09-September 01
  • OS:Windows RT
  • Country: Country Flag

Posted 05 February 2009 - 09:33 AM

View Postamigafan, on Feb 5 2009, 09:59 AM, said:

I'd hardly call this an amazing concept, since Linux, BeOS and QNX were doing this a decade ago.

Don't be crazy, they were not. QNX is the only OS to have something similar, and it's not the same. We're not talking about a kernel image, or running a kernel image off of a non-native filesystem - this is an entire "volume" inside a VHD, that is bootable from another OS natively without a Virtual machine. It's not quite the same - and also, we're talking about Windows here, not a fringe OS - this brings virtual disk booting to the masses (well, once Win7 releases).

#12 User is offline   spacesurfer 

  • Pharmassist
  • Group: Patrons
  • Posts: 1,668
  • Joined: 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 05 February 2009 - 09:44 AM

View Posteyeball, on Feb 5 2009, 07:58 AM, said:

Yes i would imagine a performance hit is to be expected with this as it works by using a driver that understands the NTFS filesystem and VHD format, it will locate the VHD file on the physical NTFS volume then open that up, and boot windows reading its the NTFS structure from the VHD file.

No performance hit noted by me yet.

So far, certain things are faster than Vista SP1, such as opening Network and Sharing Center. Boot time is faster or same as Vista.

Only issues are the bugs that are typical of a beta. Otherwise, I can live off of Windows 7!

#13 User is offline   amigafan 

  • Junior
  • Pip
  • Group: Members
  • Posts: 52
  • Joined: 24-April 04

Posted 05 February 2009 - 10:19 AM

View Postcluberti, on Feb 5 2009, 09:33 AM, said:

Don't be crazy, they were not. QNX is the only OS to have something similar, and it's not the same. We're not talking about a kernel image, or running a kernel image off of a non-native filesystem - this is an entire "volume" inside a VHD, that is bootable from another OS natively without a Virtual machine. It's not quite the same - and also, we're talking about Windows here, not a fringe OS - this brings virtual disk booting to the masses (well, once Win7 releases).


QNX, Mandrake Linux and BeOS all had an ""entire "volume" inside a VHD, that is bootable from another OS natively without a Virtual machine". I know what I'm talking about.

#14 User is offline   cluberti 

  • Gustatus similis pullus
  • Group: Supervisor
  • Posts: 11,208
  • Joined: 09-September 01
  • OS:Windows RT
  • Country: Country Flag

Posted 05 February 2009 - 11:52 AM

I'm not talking about a Live CD here, or firing up Qemu for a VM to run Linux from inside Windows (VHD boot is *not* a virtual machine) - what are you speaking of, and where's the documentation? I cannot find any, nor do I remember ever finding this in BeOS, specifically, either. I'd like to see some documentation if I'm wrong.

#15 User is offline   Noise 

  • Windows Guru
  • PipPipPip
  • Group: Members
  • Posts: 425
  • Joined: 27-February 04

Posted 05 February 2009 - 02:31 PM

Spacesurfer, this is awesome.

Are the vdisk files dynamic in size, or can you set them to be one huge size initially to avoid fragmentation?

#16 User is offline   Nihility 

  • Newbie
  • Group: Members
  • Posts: 48
  • Joined: 31-January 09

Posted 05 February 2009 - 03:52 PM

Can you run the virtual disks from within virtual PC or is the only purpose of this to not require a new separate partition for win7?

#17 User is offline   spacesurfer 

  • Pharmassist
  • Group: Patrons
  • Posts: 1,668
  • Joined: 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 05 February 2009 - 04:04 PM

View PostNois3, on Feb 5 2009, 03:31 PM, said:

Spacesurfer, this is awesome.Are the vdisk files dynamic in size, or can you set them to be one huge size initially to avoid fragmentation?
I haven't explored the options when creating the vdisk using diskpart. I set mine to 6.8 gb and it turned out to be a fixed disk. I do believe it creates a fixed disk. If fragmentation occurs, I imagine you can boot to Vista and use Wincontig to make it contiguous.

View PostNihility, on Feb 5 2009, 04:52 PM, said:

Can you run the virtual disks from within virtual PC or is the only purpose of this to not require a new separate partition for win7?
You can run it from Virtual PC but you'll have a problem with the HAL. Remember that this is not a virtual install. It's a real physical install, where the installation is contained within a virtual HDD. And yes, the advantage is that you don't have to repartition your HDD to install Win 7. Therein lies the greatest advantage.

If you want to get rid of it, just edit bcd and remove the entry for Windows 7 and delete the vhd. That's it as far as I know.

#18 User is offline   Nihility 

  • Newbie
  • Group: Members
  • Posts: 48
  • Joined: 31-January 09

Posted 05 February 2009 - 04:09 PM

Any idea if the VHD can be turned into a real partition? So I could use it as a backup for my installations? Possibly with the ability to add drivers to it offline like was done in the video.

I'd love to have an offline installation that I can easily update and use to restore my system when it gets corrupted.

Also, is it possible to add programs using the offline tool or would I have to mount it?

Can you do a quick test to see if mounting the VHD using disk managment allows you to resize it?

#19 User is offline   spacesurfer 

  • Pharmassist
  • Group: Patrons
  • Posts: 1,668
  • Joined: 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag

Posted 05 February 2009 - 05:00 PM

I do believe you have to mount it (or "attach" it as MS calls it). Mounting is not supported in Vista AFAIK so I can't test it. You have to test it from Windows 7 which supports mounting VHD. Or use some other program that allows mounting VHD.

I know WinImage opens VHD's and it can also mount ISO's using filedisk utility but I'm not sure if it can mount VHD as a drive, which is what you need for offline servicing.

#20 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 06 February 2009 - 02:08 AM

View Postspacesurfer, on Feb 6 2009, 12:00 AM, said:

I do believe you have to mount it (or "attach" it as MS calls it). Mounting is not supported in Vista AFAIK so I can't test it. You have to test it from Windows 7 which supports mounting VHD. Or use some other program that allows mounting VHD.

I know WinImage opens VHD's and it can also mount ISO's using filedisk utility but I'm not sure if it can mount VHD as a drive, which is what you need for offline servicing.


VHDmount from Microsoft Virtual Server 2005 SP1 can mount VHD's
http://www.boot-land...?showtopic=2220
post #9

"static", NOT "growable" VHD's can be mounted with IMDISK (giving it the offset to the bootsector) or possibly with VDK (giving it the offset to the MBR or that of the bootsector).

I am not familiar with VHD format, searching for the byte patterns with a file/disk hex viewer/editor on an actual image usually you can find them in a matter of minutes:
http://www.boot-land.net/forums/index.php?...c=2220&st=3

jaclaz

Share this topic:


  • 5 Pages +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy