To Create and Add the VHD to Boot From
1. Insert your retail copy Windows 7 installation disk into the CD/DVD drive, and restart the computer.
2. When you are at the start of the Windows 7 installation screen, press the Shift+F10 keys. (See screenshot below)
OR
3. Boot into the command prompt from the Start Recovery Options screen. (See screenshot below)
NOTE: You will use OPTION TWO at that link.4. In the command prompt, type diskpart and press Enter. (See screenshot below)
5. 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.
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).
B) Go to step 7.
6. 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 maximum 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.
Code:
create vdisk file=C:\VHD-Windows7.vhd maximum=40960 type=expandableNOTE: 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).
7. In the command prompt, type the command below and press Enter. (See screenshot below)
NOTE: If you subsituted the VHD-Windows7 name in step 5 or 6, then you will need to use it here as well.Code:
select vdisk file=C:\VHD-Windows7.vhd8. In the command prompt, type attach vdisk and press Enter. (See screenshot below)
9. In the command prompt, type exit and press Enter. (See screenshot below)
10. Close the command prompt window. (See screenshot above)
11. 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.12. Click on the Install now button. (See screenshot below)
13. Check the I accept the license terms box and click on Next. (See screenshot below)
14. Click on the Custom (advanced) option. (See screenshot below)
15. Select the available option with the unallocated space that is the same maximum VHD size (ex: 40GB = 40960MB) that you specified in step 5 or 6 above, and click on the Next button. (See screenshot below)
NOTE: If you see the Windows cannot be install to this disk warning, then you can ignore it. Windows 7 will install on the VHD file.16. 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.17. 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.) or alternatively just sit back and watch the video tutorial below…
In this video we will install Windows direct to a VHD onto a bare metal system. We will need to shell out to the command prompt during the installation and use diskpart.exe to create the file-system and then the vhd on it. We may then return to the GUI installer and select the VHD as our installation target.