Installing Win7 or Win2008 to VHD

Boot OS DVD
Boot the OS install DVD or USB normally

Prepare VHD
At the "Install Windows" screen press Shift + F10 to open a command prompt
DISKPART.EXE

  • #Review Existing Disks and Partitions
  • list disk
    • list part 
    • select disk %1

    • #Delete Unwanted Partitions
    • select part %1
    • del part

    • #Create Partitions
    • create part primary
    • list part
    • select part %1
    • list vol
      • select volume %1
      • format fs=ntfs quick
      • assign [letter=C]

      • #Create VHD
      • create vdisk file=c:\windows.vhd [maximum=24000] [type=expandable]
      • select vdisk file=c:\windows.vhd
      • attach vdisk
      • list disk
      • select disk %1
      • create partition primary
      • list part
      • select partition %1
      • format fs=ntfs quick
      • assign letter=v:
      • exit
      OS Installation
      Continue OS installation normally, select the new .VHD for the install disk

      Notes
      Differencing Disks
      • For differencing VHDs you need to add an additional parameter
      • parent=”D:\pathtoparent.vhd”.
      • Now select the new VHD and attach it as a physical disk. 
      • select vdisk file=”D:\pathToVhd.vhd” 
      • attach vdisk 
      Adding an Existing VHD to the Boot Menu
      • bcdedit /copy {originalguid} /d "New Windows 7 Installation" 
      • bcdedit /set {newguid} device vhd=[D:]\Image.vhd 
      • bcdedit /set {newguid} osdevice vhd=[D:]\Image.vhd 
      • bcdedit /set {newguid} detecthal on  

        Disks, Partitions, and Volumes
        • #Disk = physical disk, hardware RAID set, or LUN from SAN
        • #Partition = disk partition (Lives in a Disk)
        • #Volume = logical disk (Lives in one or more Disks or Partitions)


        Source

        Comments