初探Windows 7 Beta和.VHD文件

2009/1/12 0:23:45    编辑:Windows7之家 - Mary Jane     字体:【

Win7之家www.win7china.com):初探Windows 7 Beta和.VHD文件

 不少人都还不知道Windows 7对Virtual PC,Windows Server 2008 R2和Hyper-V上使用的.VHD的支持怎么样吧?下面是一个简述。

Windows 7中,运行diskpart

现在就可以创建一个空白.VHD文件了,下面这条命令会在virtual文件夹下自动创建一个16GB大小的VHD文件(VHD文件放哪都行,但首先必须新建一个文件夹)。

create vdisk file=c:\virtual\win7.vhd type=fixed maximum=16000

系统需要几分钟来完成此操作,在我的机器上,Windows 7花费了10分钟来创建这个文件,完成后Diskpart会有提示。

现在就可以将Windows 7 Beta安装到这个VHD文件中去了。首先打开光驱,放入Windows 7 DVD光盘。重启系统,BIOS里设置为光驱启动。在Windows 7安装程序启动后选择好自己的语言,然后按下shift+F10以调出命令提示符。

首先看一下前面的盘符(我这是D),记住盘符,然后输入命令:

diskpart
select vdisk file=d:\virtual\win7.vhd
attach vdisk

关闭命令提示符并开始安装Windows 7,选择自定义安装,在分区表中可以看到一个16GB大小的未分配分区,选中并开始安装。

此时,如果系统提示无法从光驱启动,忽略并继续安装即可。

继续安装,由于是.VHD文件,系统会将其写入启动项。问题来了,此时上面进行的安装将会成为Windows 7的默认启动项,而且跟原先安装的系统名字一模一样,都是Windows 7。别担心,继续安装,这些都是可以搞定的。

好了,安装完成后,下面该是如何解决上面谈到的问题了。

*右键命令提示符-管理员身份运行
*bcdedit /v 找到.VHD的编号并复制
*输入bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} description “Windows 7 - VHD”
(其中的xxxx代指上面的.VHD编号)
*现在在启动项中你会看到Windows 7和Windows 7 - VHD2个不同的名字了
*如果想将Windows 7 - VHD放到启动项的最下面,输入:

bcdedit /displayorder {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} /addlast

PS:上述所有命令提示符中的操作都别忘了回车

附部分原文:

Some of you seem confused about how Windows 7 goes about supporting .VHD files as used by Virtual PC, Windows Server 2008 R2 and Hyper-V. Here’s a quick how-to work with .VHD files in Windows 7.

OK, let’s begin with a Windows 7 beta 1 install. Fire up a Command Prompt and type the following:

diskpart

    Note: Press ENTER after each line to execute the commands.

You’re now ready to create a blank .VHD file. The following command creates a 16GB VHD file in a folder called virtual (you can put the .VHD anywhere, but create any folder in advance):

create vdisk file=c:\virtual\win7.vhd type=fixed maximum=16000
...