Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Boot Windows 7 from VHD - an amazing concept


  • Please log in to reply
119 replies to this topic

#1
spacesurfer

spacesurfer

    Pharmassist

  • Patrons
  • 1,668 posts
  • Joined 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag
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, 03 April 2009 - 04:49 PM.

_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit


How to remove advertisement from MSFN

#2
McoreD

McoreD

    Member

  • Member
  • PipPip
  • 156 posts
  • Joined 03-September 04
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
spacesurfer

spacesurfer

    Pharmassist

  • Patrons
  • 1,668 posts
  • Joined 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag
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, 04 February 2009 - 09:14 AM.

_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit

#4
suryad

suryad

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,216 posts
  • Joined 17-February 05
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
spacesurfer

spacesurfer

    Pharmassist

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

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.
_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit

#6
gamehead200

gamehead200

    SEARCH!!! SEARCH!!!

  • Super Moderator
  • 7,039 posts
  • Joined 02-September 02
  • OS:Windows 7 x64
  • Country: Country Flag
Hmmm... Interesting and a great way of installing Windows 7.

[ Pinned. ] :)

#7
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,393 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
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
eyeball

eyeball

    Have you tried turning it off and on again?

  • Member
  • PipPipPipPipPipPip
  • 1,150 posts
  • Joined 28-October 05
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
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,393 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag
Related video from MS, link originally posted by allanf on boot-land:
http://www.boot-land...?...c=6982&st=2

http://download.micr...A8FA31/dism.wmv

jaclaz

#10
amigafan

amigafan

    Junior

  • Member
  • Pip
  • 52 posts
  • Joined 24-April 04
I'd hardly call this an amazing concept, since Linux, BeOS and QNX were doing this a decade ago.
"I may be drunk, but you are ugly, and in the morning I will be sober."

#11
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,252 posts
  • Joined 09-September 01
  • OS:Windows 8.1 x64
  • Country: Country Flag

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).
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#12
spacesurfer

spacesurfer

    Pharmassist

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

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!
_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit

#13
amigafan

amigafan

    Junior

  • Member
  • Pip
  • 52 posts
  • Joined 24-April 04

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.
"I may be drunk, but you are ugly, and in the morning I will be sober."

#14
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,252 posts
  • Joined 09-September 01
  • OS:Windows 8.1 x64
  • Country: Country Flag
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.
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#15
Noise

Noise

    Windows Guru

  • Member
  • PipPipPip
  • 425 posts
  • Joined 27-February 04
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
Nihility

Nihility

    Newbie

  • Member
  • 48 posts
  • Joined 31-January 09
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?
Waiting for a dual core netbook with a decent GPU.

#17
spacesurfer

spacesurfer

    Pharmassist

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

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.
_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit

#18
Nihility

Nihility

    Newbie

  • Member
  • 48 posts
  • Joined 31-January 09
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?
Waiting for a dual core netbook with a decent GPU.

#19
spacesurfer

spacesurfer

    Pharmassist

  • Patrons
  • 1,668 posts
  • Joined 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag
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.
_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit

#20
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,393 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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...?...c=2220&st=3

jaclaz

#21
ra_27y

ra_27y

    Newbie

  • Member
  • 12 posts
  • Joined 12-September 03
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?

#22
amigafan

amigafan

    Junior

  • Member
  • Pip
  • 52 posts
  • Joined 24-April 04

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.
"I may be drunk, but you are ugly, and in the morning I will be sober."

#23
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,252 posts
  • Joined 09-September 01
  • OS:Windows 8.1 x64
  • Country: Country Flag
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.
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#24
spacesurfer

spacesurfer

    Pharmassist

  • Patrons
  • 1,668 posts
  • Joined 31-July 04
  • OS:Windows 7 x86
  • Country: Country Flag
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
_____________________________________________________________________
[Modify Office 2007 / 2010 Ribbon UI] [Javascript Guide] [Methods of Typing in Gujarati] [My Math Pages]
[Boot Windows 7 from VHD] [Multi-boot Vista/XP and other OSes with Grub Menu] [Boot XP and Vista Independently]


Gigabyte GA-P35-DS3L, Intel Core 2 Duo E6550 2.33 GHz, ASUS Radeon EAH3450 256 MB, 6 GB Corsair RAM, Maxtor 300 GB + Seagate 400 GB HDDs, Windows 7 Ultimate 64-bit
IBM T42 Intel Pentium M 1.7 GHz, 1.5 GB RAM, Radeon Mobility 7500, 160 GB HDD, Windows 7 Ultimate 32-bit

#25
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,534 posts
  • Joined 13-October 04
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

Two quick questions…

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN