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

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

How to Create a Windows 7 VHD at Boot to Start with from Boot
Published by Brink
26 Jan 2009
Published by

How to Create a Windows 7 VHD at Boot to Start with from Boot

information   Information
This will show you how to create a Windows 7 VHD file at boot on an existing installed OS's (ex: Vista or Windows 7) C: hard disk or partition to be able to natively boot from the Windows 7 VHD at startup in the Windows Boot Manager.

Note   Note
This tutorial uses an example that will create a C:\(file name).vhd file on the C: drive/partition at boot that is used to natively boot from at startup.

You will be able to create the VHD file on any partition or drive letter that you like though.

warning   Warning
All Vista, Windows 7, and Windows 8 (except Windows 8 RT) editions support booting from a VHD.

You must have either Windows 7 Ultimate, Windows 7 Enterprise, Windows 8 Pro, or Windows 8 Enterprise installed on the VHD to be able to boot from the VHD natively.


EXAMPLE: Windows Boot Manager
NOTE: You will be able to either select your currently installed OS (ex: Vista) or the VHD file (ex: Windows 7) in the Windows Boot Manager to start your computer with.
Virtual Hard Drive VHD File - Create and Start with at Boot-boot_manager.jpg
EXAMPLE: VHD file in your Current OS (ex: Vista)
NOTE: This is where the VHD file will be stored at on your currently installed OS (ex: Vista) to be used to boot from.
Virtual Hard Drive VHD File - Create and Start with at Boot-example.jpg



OPTION ONE
To Create and Add the VHD to Boot From
1. Boot from your retail copy Windows 7 Ultimate or Enterprise installation DVD/USB, and do step 2 or 3 below for what you would like to do.
NOTE: To have Windows 8 on VHD, see instead: How to Create a Windows 8 VHD at Boot to Dual Boot with Windows 7 or Vista

2. When you are at the start of the Windows 7 installation screen, press the Shift+F10 keys, and go to step 4 below. (See screenshot below)
Virtual Hard Drive VHD File - Create and Start with at Boot-setup.jpg
3. Boot into the command prompt from the Startup Recovery Options screen, and go to step 4 below. (See screenshot below)
NOTE: You will use OPTION TWO at that link.
Virtual Hard Drive VHD File - Create and Start with at Boot-step1.jpg
4. In the command prompt, type diskpart and press Enter. (See screenshot below)
Virtual Hard Drive VHD File - Create and Start with at Boot-step2.jpg
5. In the elevated command prompt, type list volume and press Enter. Make note of the drive letter for the volume that you want to create the VHD file on. (See screenshot below)
NOTE: This will allow you to see what the drive letters are for each volume. They are not always the same at boot as they are in Windows.
Name:  list-disk.jpg
Views: 11489
Size:  106.1 KB
6. Do either step 7 or 8 below for what type of VHD file you would like to create.

7. To Create a Fixed VHD File
NOTE: A fixed VHD file will allocate the entire maximum size (ex: 40GB) that you set below for the VHD file size.
A) In the command prompt, type the command below and press Enter.
NOTE: Substitute the C drive letter in the command below for what volume (step 5) you would like to create the VHD on.

Code:
create vdisk file=C:\VHD-Windows7.vhd maximum=40960
NOTE: You can substitute the VHD-Windows7 name with any name you would like for the VHD file instead. You can also substitute the maximum size of 40960 MB for the VHD to the maximum size you want instead in MB (1GB = 1024MB).
Virtual Hard Drive VHD File - Create and Start with at Boot-step3.jpg
B) Go to step 9.
8. To Create an Expandable VHD File
NOTE: An expandable VHD file will only be as large as the amount of data that is saved in the VHD file, but still can get as large as the maximium size (ex: 40GB) that you set below. For example, using this option, the VHD file showed only 7GB instead of the full 40GB. Even though the VHD file is expandable, you may need to install Windows Virtual PC to have a program associated with VHD files to actual see only the smaller size instead of the larger size for the VHD file.
A) In the command prompt, type the command below and press Enter.
NOTE: Substitute the C drive letter in the command below for what volume (step 5) you would like to create the VHD on.

Code:
create vdisk file=C:\VHD-Windows7.vhd maximum=40960 type=expandable
NOTE: You can substitute the VHD-Windows7 name with any name you would like for the VHD file instead. You can also substitute the maximum size of 40960 MB for the VHD to the maximum size you want instead in MB (1GB = 1024MB).
9. In the command prompt, type the command below and press Enter. (See screenshot below)
NOTE: If you subsituted the VHD-Windows7 name in step 7 or 8, then you will need to use it here as well. Substitute the C drive letter in the command below for what volume (step 5) you would like to create the VHD on.

Code:
select vdisk file=C:\VHD-Windows7.vhd
Virtual Hard Drive VHD File - Create and Start with at Boot-step4.jpg
9. In the command prompt, type attach vdisk and press Enter. (See screenshot below)
Virtual Hard Drive VHD File - Create and Start with at Boot-step5.jpg
10. In the command prompt, type exit and press Enter. (See screenshot below)
Virtual Hard Drive VHD File - Create and Start with at Boot-step6.jpg
11. Close the command prompt window. (See screenshot above)
A) If you used step 2 above, then click on Next, and go to step 13 below.

B) If you used step 3 above, then continue on to step 12 below.
12. Close the System Recovery Options window. (See screenshot below)
WARNING: You must close it only. Do not click on the Shut Down or Restart button.
Virtual Hard Drive VHD File - Create and Start with at Boot-step7.jpg
13. Click on the Install now button. (See screenshot below)
Virtual Hard Drive VHD File - Create and Start with at Boot-step8.jpg
14. Check the I accept the license terms box and click on Next. (See screenshot below)
Virtual Hard Drive VHD File - Create and Start with at Boot-step9.jpg
15. Click on the Custom (advanced) option. (See screenshot below)
Virtual Hard Drive VHD File - Create and Start with at Boot-step10.jpg
16. Select the available option with the unallocated space that is the same maximum VHD size (ex: 40GB = 40960MB) that you specified in step 7 or 8 above, and click on the Next button. (See screenshot below)
NOTE: If you see the Windows cannot be installed to this disk warning, then you can ignore it. Windows 7 will still install on the VHD file.
Virtual Hard Drive VHD File - Create and Start with at Boot-step11.jpg
17. Finish doing a clean install of Windows 7.
NOTE: You will pick up at step 10 at that link to finish installing Windows 7 on the VHD file.

18. When you restart or start the computer, you will now have Windows 7 to select from at boot to start natively from the VHD file. (See the first example at top of the tutorial.)



OPTION TWO
To Delete the VHD and Remove from Boot List
1. To Remove OS VHD from Windows Boot Manager List
A) Delete the listed OS VHD from the Windows Boot Manager in msconfig.
2. To Delete the VHD File
A) In Windows Explorer, navigate to the VHD file that you have created in step 7 or 8 of OPTION ONE above (ex: C:\VHD-Windows7.vhd), right click on the VHD file and click on Delete.

B) Click on Yes to approve deletion.
That's it,
Shawn






26 Jan 2009   #1
garysgold

Vista Ult 64 bit Seven Ult RTM x64
 
 

Thanks Shawn. Another excellent tutorial.

Gary

My System SpecsSystem Spec
26 Jan 2009   #2
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

You're welcome Gary.
My System SpecsSystem Spec
04 Feb 2009   #3
spacesurfer

Windows Vista and Windows 7 Beta
 
 

There a mistake in step 6.

It should be "attach vdisk", not "attach disk".
My System SpecsSystem Spec
.


04 Feb 2009   #4
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Nice catch Spacesurfer.

+1 rep.

Thank you,
Shawn
My System SpecsSystem Spec
08 Mar 2009   #5
gencode

Windows Vista
 
 
Could not get to Recovery Options using vista

When I put the Windows 7 DVD in and tried to get to Recovery Options Windows 7 said the OS was not the same and would not go forward.

Reading
This will show you how to create a Windows 7 VHD file at boot on an existing installed OS's (ex: Vista)


I was hoping I could make a Windows 7 VHD with my main OS being Vista
My System SpecsSystem Spec
08 Mar 2009   #6
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Hello Gencode, and welcome to Seven Forums.

Did you boot from the Windows 7 DVD to try and enter the System Recovery Options screen?
My System SpecsSystem Spec
11 Mar 2009   #7
gencode

Windows Vista
 
 
I figured it out

Yeah, I booted from Windows 7, I did exactly as shown.

The problem is my Vista was 64 bit and the Windows 7 was 32bit. I dloaded the Windows 7 64 bit beta and all worked as shown. Thanks!

Ed,
My System SpecsSystem Spec
11 Mar 2009   #8
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 

Ed, I'm happy to hear that you got it sorted. Thank you for sharing your results.

Shawn
My System SpecsSystem Spec
13 Mar 2009   #9
nasxsx

Windows 7 x64
 
 

Hi,

Is it possible to install system other than Windows 7 (Vista or XP) on VHD and boot it?
My System SpecsSystem Spec
Comment

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




Tutorial Tools



Similar help and support threads for2: Virtual Hard Drive VHD File - Create and Start with at Boot
Windows 7 Tutorial Category
Can i boot from a VHD (Virtual Hard Drive) Virtualization
A Virtual Hard Drive? Two separate hard drives now run Win 7 x64 Backup and Restore
WEI fails (cannot write file to hard drive) Boot drive set to B:\ Performance & Maintenance
virtual hard drive Hardware & Devices
Virtual Hard Disk - Create and Attach VHD Tutorials
Is it necessary to defrag a virtual hard drive? Virtualization
Can't start up hard disk image in Virtual PC RC Virtualization

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 06:36 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33