Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Virtual Hard Drive VHD File - Create and Start with at Boot

18 Mar 2009   #20

Windows 7

OK, I understand that. Thank you very much.
Nice place you have here :)
Quote   Quote: Originally Posted by Brink View Post
Hello Pitajax, and welcome to Seven Forums.

As Spacesurfer posted, you can place the VHD at any location. You will just need to modify the commands in the steps for that location instead. :)

My System SpecsSystem Spec
18 Mar 2009   #21

64-bit Windows 10 Pro

You're welcome Pitajax. :)
My System SpecsSystem Spec
18 Mar 2009   #22

Windows Vista and Windows 7 Beta

Some info regarding booting Windows XP from VHD.

It seems that it should be possible as XP does have the VHD drivers. When you install XP in a virtual pc and attach a second VHD drive, you can see device manager loading the drivers for virtual drives. Hence, my theory is that it should be possible to boot XP from VHD.

Based on this premise, I have tried the following ideas (and if someone wants to further test different scenarios, that would be helpful):

1) Install XP on Virtual PC VHD
2) Add VHD boot entry to menu

bcdedit /set {ntldr} device vhd=[drive]\file.vhd
bcdedit /set {ntldr} osdevice vhd=[drive]\file.vhd
bcdedit /set {ntldr} detecthal on

3) Try to boot XP and get an error stating NTLDR not found

Based on above, it seems the VHD does load but it can't find ntldr within the partition.

So, I tried the following. Instead of loading XP using ntldr, I tried loading it via bootmgr by doing the following:

1) Export bcd store from a bootable source. Import that in XP loaded in Virtual PC.
2) Copy bootmgr, bcdedit, and bootsect.exe to XP in virtual pc.
3) Change bootsec from nt52 to nt60 using the command bootsect /nt60 /f
4) Copy bootmgr to c:\
5) Add entries to boot XP
6) Restart to make sure XP boots using bootmgr instead of ntldr. It does and I have succeeded up to here.
7) In main physical OS, add entry to boot to this VHD that load XP using bootmgr instead of ntldr.

This failed for me. Instead of loading XP, I got Windows 7 recovery... and vaguely remember some error about partition not being right.

So the plan is to format the partition with Windows 7, then install XP on that and retry.

So, here's the steps if anyone wants to try.

1) Create a virtual pc vhd. Load Windows 7 iso and format the partition with windows 7. Abort win 7 install. (Or use command prompt and diskpart to format and exit).
2) Load Windows XP iso and install windows xp.
3) change boot loader to bootmgr as outlined above.
4) add boot entries to menu
5) load xp.
My System SpecsSystem Spec
10 Apr 2009   #23

win 7 rc
save a couple steps

I found that during install you can press Shift+F10 it will pop up a command prompt. So you can essentially skip the whole navigate to recover stuff and just pop into cmd and do diskpart, from diskpar screen.

I tested out a Win7 to Win7 dual-boot it is installing as i type this. I have used this to play solitar, majohng, or minesweeper while it is installing/upgrading with no issues (i even managed to get IE to work while upgrading but the upgrade took 3+ hours)

good luck.

My System SpecsSystem Spec

10 Apr 2009   #24

64-bit Windows 10 Pro

Hello Lucas, and welcome to Seven Forums.

Thank you. It has been added. :)

My System SpecsSystem Spec
12 Apr 2009   #25

Windows XP and 7

Quote   Quote: Originally Posted by gencode View Post
Id like to format my primary hd and back up my new vhd to my NAS drive, then put it back when im all done.
I know I can copy it back, but how to I attach it to the boot menu? so it can be booted after I reformat my primary drive or if I were to upgrade to a new larger drive.
You need to install the boot manager. Because you do not have any operating system on your clean hard disk you can not use "system repair".

So: Install a "dummy" operating system:
Format your hard disk with NTFS
Boot from Windows 7 DVD and install Windows 7 to VHD file. See here.

After this you have on your hard disk:
  • The VHD file
  • Boot manager as file "bootmgr"
  • Boot settings in folder c:\boot\bcd
  • A file "pagefile.sys"
Boot this "dummy" installation.

You now should see two hard disks:
  • C: = dummy VHD file
  • D: = real hard disk
Copy your backup of your VHD file from NAS drive to D:
Then use "bcdedit" to add boot menu entry of your (backup) VHD file. See here.

Boot to your (backup) VHD.
If it works all fine then you can delete boot menu entry of your "dummy" installation via "bcdedit" and also delete dummy VHD file.
My System SpecsSystem Spec
13 May 2009   #26


Thanks for this guide, it worked perfectly.
However I have had a lot of driver problems with Win7 (very old hardware) and would like to now remove it. Do I just follow the tutorial: How to Unattach and Delete a Virtual Hard Disk in Windows 7, as posted at the top this guide under related links?

Also, how does one go about changing the default boot OS? Atm its Win7 but I may want to switch it the existing OS instead of remove it.

My System SpecsSystem Spec
13 May 2009   #27

64-bit Windows 10 Pro

Hello Uder, and welcome to Seven Forums.

I have added OPTION TWO to the tutorial to help show you how to. :)

To just change the default OS to start to, this tutorial below can help show you how to.

Default Operating System - Change Default Boot OS

Hope this helps,
My System SpecsSystem Spec
30 May 2009   #28

Win7 x64 SP1, Virtual Hackintosh
Type of the VHD-File: Fixed vs. Expandable

It is an excellent documentation offered here in that forum, and I successful installed Win7 x86 RC on my Thinkpad z61p using a USB-Stick as a installation media and a VHD as installation target.

But on question / problem came up, the size of that VHD-File for a full Win7-installation and Office etc.

Diskpart offeres two types of VHD-Files, FIXED (Default) and EXPANDABLE.


In FIXED mode (as I understand) the max value will be allocation right now, the size will be 25Gig. In EXPANDABLE mode the size will be that amount of data, which is used by the installation, not more and the size at all can grow up to 25 GB (same behaviour as with Virtual PC or VMWare Workstation).

So I selected a MAXIUM of 100 GB thinking the effective size will be just around 15-20 Gig. But as I looked into the explorer, the file is 100 GB in size and the underlying Vista installation has a lack of free disk space now.

I cannot see any difference in the allocated size of my VHD, but I have created it with the TYPE=EXPANDABLE option and diskpart reports the Type as expandable - But the size is fixed to the maximum.

Does anyone here has similar experiences?
Is there a method to shrink the VHD?
What about a comparison in using a VHD vs. shrinking Vista and using a own partition for Win7?
What about Hypernation in a VHD?

Lots of questions

Greetings from Switzerland and Thanks in Advance

My System SpecsSystem Spec
31 May 2009   #29

64-bit Windows 10 Pro

Hello Oblomow,

Sorry for the late reply, but it took a bit to play with this to see what options may be available for you.

I have added a option to create either a fixed or expandable VHD file option to help give more options.

When using the type=expandable command, the VHD file will be exandable, but it will require installing Windows Virtual PC to actually see the VHD file as the smaller expandable size instead of the full fixed size. It seems that without that program installed to have associated with VHD files types, Windows 7 will still only show the maximum size instead whether it is fixed or expandable.

I find that it's usually best to backup anything on the VHD that you did not want to lose, then delete it and create a new VHD file the size that you wanted instead of trying to shrink an existing one.

Hope this helps,
My System SpecsSystem Spec

 Virtual Hard Drive VHD File - Create and Start with at Boot

Thread Tools

Similar help and support threads
Thread Forum
Fail to start up - Can't boot hard drive - Windows cannot be installed
Hi everyone, recently I bought a new laptop, MSI GP70 which came with Windows 8... I tried it for few weeks and than I decided to downgrade it to Windows 7. So, I did it, everything went well, I was using Windows 7 for couple of weeks, but now I have a problem... Last night I didn't turn it off,...
Installation & Setup
Virtual Hard Disk - Create and Attach VHD
How to Create and Attach a Virtual Hard Disk in Windows 7 A Virtual Hard Disk is a created VHD file on your hard drive that acts as a separate hard drive disk in Computer. This will show you how to create and attach (mount), or only attach (mount) an existing, a VHD in Windows 7. Special...
Can i boot from a VHD (Virtual Hard Drive)
Hi, i was wondering if it is possible to boot my computer from a vhd and add it to the boot menu. I do not want to dual boot, I am trying to use the vhd like a dual boot. I am running Windows 7 Ultimate x64. Thanks
A Virtual Hard Drive? Two separate hard drives now run Win 7 x64
While looking into another possible problem with a hard drive on my system,I began unplugging the devices (there are four of them) to isolate the problem and in doing so, I I seriously corrupted C drive, and began getting 0x7b BSOD messages. First I tried to do a System Repair with the Repair...
Backup and Restore
WEI fails (cannot write file to hard drive) Boot drive set to B:\
I had a regular install of Windows 7 on a WD 1 TB drive with the usual C:\ as the boot drive. I just got a new SSD, so I set up a parallel or dual boot of Windows 7 on the SSD which is set up as the B: drive. So when I boot into the Windows on the SSD (B:\) and run the WEI, it fails because...
Performance & Maintenance

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 07:31.
Twitter Facebook Google+