深入研究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????????????,??????????,?????!

Comments

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    直接借助VHD原生启动Windows7或者WindowsServer2008R2,相信很多朋友都试过,这个功能确实很酷! 不过传统的做法是借助VirtualPC或者其他虚机,先挂载VHD文...

  • Anonymous
    January 01, 2003
    The comment has been removed

  • Anonymous
    January 01, 2003
    不得不说微软是一个非常善于创造英文缩写的公司:-) MDT、WAIK和OPK的全称如下: MDT 是 Mindows Deployment Tookkit ,最新版本是2010版; WAIK 是 Windows

  • Anonymous
    January 01, 2003
    为什么我作WIN7自带的系统映像备份功能备份出VHD后,把这个后缀的文件单独移动到其它地方就不能利用系统修复功能恢复了呢?

  • Anonymous
    February 05, 2009
    The comment has been removed

  • Anonymous
    February 24, 2009
    The comment has been removed

  • Anonymous
    March 15, 2009
    请问可不可以在VPC灌入Win7系统的VHD文件 加载到windows的开机启动项里  如果可以  如何实现

  • Anonymous
    March 20, 2009
    The comment has been removed

  • Anonymous
    June 09, 2009
    喻老师,请问raid5下如何vhd安装server08,在diskpart里能加载raid驱动么或者之前?

  • Anonymous
    July 22, 2009
    您好,文中这条命令 cd d "c:program files<version>tools<architecture>" 中的参数“d”是不是写错了,应为“/d”。

  • Anonymous
    July 24, 2009
    如果启动VHD里的系统,假设是windows7,感染了病毒 比如,破坏文件的病毒,会引起什么后果,是否会感染VHD系统以外的文件?假设VHD系统是物理硬盘的c分区上的,d分区上的文件是否被感染破坏?

  • Anonymous
    March 13, 2010
    非常感谢,写的很清楚、专业,受益匪浅。有一点不明白:既然使用win7启动程序已经识别了VHD是一块硬盘,怎么说在VHD中不能安装WIN7以下的系统呢?如WinXP。