Share via


深入研究Windows 7中的Virtual Hard Disk (VHD) 技术

???Windows 7?VHD?????????VHD?????????????,?????????????????????????????????????????????,??????????,?????????Windows 7?VHD?????

????????????????Windows 7 Build 6801?Beta 1?,???????2009?1?22??????????????????,????????????Windows 7???????????,????!??????????,??????????,?????,??!

??VHD??

?????????VHD?????,????Virtual PC??Virtual Server?,VHD???????????????????2005????VHD?????????,??????TechNet????Virtual Hard Disk Image Format Specification????????????VHD????????,???VHD??????????????????????????

????????,??????VHD?????VHD????????,????????????????,VHD??????????????VHD???????????VHD???????,????????????Cylinder?Heads?Sectors????????,????????I/O?????VHD?????,????????????,???????????????

?????????,VHD???????,??2.5??3.5??SCSI?SATA?IDE??????????,VHD???????????

Windows 7??VHD???????

??????????????,???????????????????????????????????????,????????I/O????(????),??????????????????(????)?VHD???????????,????????????????????????????????????????????????,???????????Windows??????Webcast?

????,??VHD??????????,????????????Virtual PC?Virtual Server?,?????????????VHD?????,????????VHD???????????

?Windows 7?,???VHD???????????,?????Windows 7????????????,??????Windows 7???,????VHD??????(?VHD??????????,???????),?????Windows 7?????,????VHD??????????????VHD???????,??????Windows????,???????????????,????,VHD????????????????????

image

?????VHD??

???Windows 7????VHD????,????????????????????????

??,??????????Diskpart??VHD??!(??,?????,???????????????????????????,??,???:???,??,???VHD???????… )

    1:  diskpart
    2:  create vdisk file=c:\windows7.vhd maximum=25600 type=fixed
    3:  select vdisk file=c:\windows7.vhd
    4:  attach vdisk
    5:  create partition primary
    6:  assign letter=r
    7:  format quick label=vhd
    8:  exit

??????,??????????VHD??,????????????????,?????Diskpart???????,????,???????,?????????,??Windows 7???????,?????????????????VHD?Windows 7??????????:

???:???,Foo.VHD????????????????,??????????Windows?????,????????,????????NTFS???? image
???:???,VHD????????VHD??,??VHD??????????????,?????Windows??2???VHD?(??????????????,?????????????????,????????) image
???:????????????VHD?????,????????????VHD???????????Bar.VHD???????,????C???BarParent.VHD?????????? ????????????,?????,Foo.VHD????BarParent.VHD?????,??????,?Foo.VHD?????,??????????????,????????,??????????? image
???:???,????????????VHD??,????????????,???????????,?,??????,?????????! image

????????????,??????,??VHD?????????????:

  • ?????????VHD?????512?(??????)
  • VHD??????,???Volume Snapshot
  • ???VHD??,??????????,??????VHD???RAID(???,VHD????????,?RAID???????)

?VHD?????

??????Windows 7??????VHD??????,??,????VHD???????????????

??????,?Windows 7?,???VHD???????????,?????Windows 7????????????,?????????,Windows 7????????????????VHD??,????VHD???????

??,???Windows 7??????????,????????????????????????????????????????,???????????(?????????)????????,????????????????????,?????????????????????????????????????Windows 7?,????,???Windows 7???????????????Windows 7???????VHD??,?????VHD???

????VHD?????,????????:

?????VHD???????????????,???Virtual PC??Virtual Server?????????VHD???,????Sysprep,???????,??VHD??????????Sysprep????,??VHD?????,???????????????,??????

??????????,????ImageX??,?Vista???,?????????????VHD??,????????????????Vista??????VHD,????WinPE??????????Windows 7?????,?Windows 7??????????VHD??,??:?????????Windows 7!

1. ?Diskpart??VHD????????,???????????????????,??????ImageX??????????,??VHD???WIM?????Vista?????Windows?????,???DVD??????

 cd \d "c:\program files\<version>\tools\<architecture>\"
imagex /apply <wim?????> 1 r:\

2. WIM?????VHD??,??Diskpart?VHD????????????

 diskpart
select vdisk file=c:\windows7.vhd
detach vdisk
exit

3. ???????VHD??????????????

 net use y: \\network_share\
copy c:\windows7.vhd y:\network_share\vhd\

4. ??Windows 7???WinPE???????????,??????????????????????(??,???????????????,?????????)

 diskpart
sel disk 0
clean

5. ????Diskpart??????,???200M?S?????????????C??S???????,????Windows 7????????????????????????????VHD??,???C??????

 create partition primary size=200
format quick fs=ntfs
assign letter=s
active
create partition primary
format quick fs=ntfs
assign letter=c
exit

6. ?Diskpart????VHD????WinPE???,??VHD??Windows System32??,???bcdboot????????????????bcdboot???????,?????????:Use the BCDboot tool, located in the \System32 directory of the Windows 7 VHD, to copy the boot-environment files from the\Windows directory in the VHD to the system partition. The BCDboot tool will create the BCD configuration to boot from the VHD. For more information about the BCDboot tool, see BCDboot Command-Line Options in the OEM Preinstallation Kit (OPK) User's Guide or the Windows Automated Installation Kit (Windows AIK) User's Guide.

 diskpart
select vdisk file=c:\windows7.vhd
attach vdisk
exit
cd v:\windows\system32
bcdboot v:\windows /s s:

7. ?WinPE????????,???????,???????????VHD???Windows 7!

8. ????????Windows 7??????????VHD??????,????BCDEdit???(????????)

image

????VHD???????,???VHD???????????Crashdump,?????VHD??,??????VHD??????????

?????????VHD?????????????:

1. ?VHD?????????,??(2009?1?)???????Windows Server 2008 R2?Windows 7????????,??????,?????????????,?????

2. UDFS??????????(UDFS?????????…)

3. ????VHD??,????????????NTFS????(?????????)

4. ?????????,???VHD??????,?????vhd????????????vhd??

5. ?????????RAID??,?????VHD???????????RAID?????,????peimg???????????,??yueyezhan???

??????

??????VHD????????????,VHD???I/O????????,??????Windows 7 Build 6801??,????????WinHEC?????????????,???????,VHD????????,??????????????,????????????????

image image

image image

????????VHD???:

 ????!
????win7X86,?????X64?win7,?????vhd??X64win7????
??????????
 ?????VHD?? 
??????????????C????20G?DISK2???VHD??,??.
??????????????~~
 ?????????,????????????,??????3D??,
?????????????????Win7????????,
?????????,???????vhd??,??????????,
?????????????????????Win7??????server2008R2?

???????????

????????????

???????????

?????????(??)???,?????????

 

??????,??????LiveWeiter????????????,??????????,?????!