Installing Windows 7 to a virtual hard disk...

Discussion in 'Windows 7' started by Domozilla, May 27, 2009.

  1. Domozilla

    Domozilla MDL Novice

    May 8, 2009
    This is probably my favourite feature of Windows 7 (and Server 2008 R2)... being able to test out installation without using the sometimes very slow Virtual PC (my older T2400 Intel Core lappy doesn't quite cut it) and can test out x64 version (if your CPU is x64 :p).

    Here's how you do it. Boot your PC into Windows Setup and the press SHIFT+F10. This will bring up cmd.exe. First up is to create an empty directory where you want to store your VHD. If you have a Windows 7 install already, the main OS drive is usually assigned D: (C: would be the tiny SYSTEM RESERVED one... don't use that!), so you can do a mkdir D:\VHD. Now issue a diskpart. From within diskpart... issue the following:

    create vdisk file=D:\VHD\Windows7.vhd maximum=25000 type=expandable
    This creates a Windows7.vhd in D:\VHD\ with a size of 25GB and is a dynamic VHD.

    select vdisk file=D:\VHD\Windows7.vhd
    Selects the VHD

    attach vdisk
    Attaches the VHD

    list disk
    Lists the disks current seen by WinPE... look for the new =25GB with 25GB free space one and note its number

    select disk X
    Selects disk whatever-the-number-that-was-noted-previously.

    create part primary
    Creates a primary partition

    format fs=ntfs quick
    Format the VHD without taking 1 million years as NTFS

    ... now you can go back to setup and run it... installing to the VHD. Setup will complain about the device as probably being non-bootable, however just ignore that. After a few reboots with setup running, you'll be in your shiny new install of Windows 7 running off VHD! ;)