Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


spacesurfer

Boot Windows 7 from VHD - an amazing concept

120 posts in this topic

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.

Edited by spacesurfer
0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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.

Edited by spacesurfer
0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites
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.

0

Share this post


Link to post
Share on other sites

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

[ Pinned. ] :)

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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

0

Share this post


Link to post
Share on other sites
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).

0

Share this post


Link to post
Share on other sites
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!

0

Share this post


Link to post
Share on other sites
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.

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites
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.
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.

0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites
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.net/forums/index.php?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

0

Share this post


Link to post
Share on other sites

I like to give it a go to see when you get it install make a backup copy of the VHD file.

then I lke to make my system die then put the backup VHd in place of the old one that was dead and see if the system will boot up and work like before it die.

cause if that work then that be a great one to do a backup of my system.

only thing I don't now what would happen if the MBR die I guest that it still would kill the hole system.

what you thin? worth a try out?

0

Share this post


Link to post
Share on other sites
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.

I wasn't talking about LiveCDs or VMs either. Back in 1999 my PC had one FAT32 partition (Win95), onto which I installed QNX, BeOS and Mandrake. These 3 operating systems each created a file of around 500MB, which was a HD image. The bootloader/kernel and/or some other essential parts were launched from inside Win95, which was then shut down and the alternative OS booted.

Your Google skills must be poor, I found this info about BeOS on the second page of results.

For details about QNX, the first page of results throws up the necessary info.

Well, that's proved me right, I won't bother finding something that proves Mandrake used the same technology.

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.

0

Share this post


Link to post
Share on other sites

The instructions have been updated to include

Adding an existing VHD to boot menu,

Enabling Vista to be able to boot VHD, and

Removing VHD boot entries

0

Share this post


Link to post
Share on other sites

Two quick questions

  1. Can I install a Win7 x64 VHD into a Vista x86 OS root.
  2. Can I install it into C:\VHDs
    e.g. C:\VHDs\Windows7.vhd (if so can/does that directory have system/hidden attributes?)

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.