View Single Post
26 Jan 2009   #
Brink
Microsoft MVP

64-bit Windows 8.1 Enterprise
 
 
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

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.
-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.
-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)
-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.
-step1.jpg
4. In the command prompt, type diskpart and press Enter. (See screenshot below)
-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: 13564
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).
-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
-step4.jpg
9. In the command prompt, type attach vdisk and press Enter. (See screenshot below)
-step5.jpg
10. In the command prompt, type exit and press Enter. (See screenshot below)
-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.
-step7.jpg
13. Click on the Install now button. (See screenshot below)
-step8.jpg
14. Check the I accept the license terms box and click on Next. (See screenshot below)
-step9.jpg
15. Click on the Custom (advanced) option. (See screenshot below)
-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.
-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








My System SpecsSystem Spec