Windows 7中从VHD文件启动计算机

Windows 7中从VHD文件启动计算机

Windows 7对VHD文件的内建支持,VHD文件的地位得到了提升:-) ,它可以被操作系统认为是一块物理的硬盘进行管理和读写。

  我们知道,现在启动系统的方式多种多样,可以从光盘、硬盘、软盘、U盘、网络等等不同的渠道来完成。既然VHD可以被Windows 7认为是一块独立的物理硬盘,那么我们是否可以从VHD启动操作系统呢?

  答案是肯定的。Windows 7的引导程序也同样包含了对VHD文件的读写驱动,因此在装有Windows 7引导程序(Boot Loader)的上,可以通过配置BCDEdit的方式,把VHD上的操作系统加入到启动时显示的多系统选择菜单。

  下面我们来看一下具体的步骤:

  注意,我们不能在物理计算机上通过光盘把系统安装到VHD文件。首先我们需要一个已经安装了操作系统的VHD文件,这可以通过几种方式来完成:

  1. 在Virtual PC或者Hyper-V中完成安装,并且运行sysprep,然后关机,这VHD文件可以被Windows 7的Boot Loader启动。

  2. 使用ImageX工具,把之前备份的操作系统镜像文件(ImageX格式)恢复到VHD中。

  Adding the VHD Entry in Boot Menu and then Boot from VHD

  当成功的创建VHD文件并且在VHD系统之上部署了操作系统之后,我们需要使用Windows 7的BCDEdit工具来配置系统的多启动菜单:

  C:>bcdedit /copy {current} /d "My New VHD Description"

  Note: This will Return the GUID of the Loader Object that you will use to replace below

  C:>bcdedit /set device vhd=[driveletter:]\

  C:>bcdedit /set osdevice vhd=[driverletter:]\

  Note: vhd=[driveletter:]\ is the new syntax supported for BCDEdit.exe to locate VHD File and Bootmgr will locate the partition containing the VHD File to boot from.

  C:>bcdedit /set detecthal on

  Note:

  Following is the attached screenshot of the my machine. In this case I have Windows 7 as the default OS and I have added the VHD File in the Boot Entry.

  Windows 7中从VHD文件启动计算机

Well just after that run the following command to test if your boot entry is successfully created using C:>bcdedit /v

Windows 7中从VHD文件启动计算机

Similarly, if you want to add multiple VHDs into Boot entry you can use the following lines to the command prompt

  C:>bcdedit /copy {current} /d "New VHD Description"

  C:>bcdedit /set device vhd=[driveletter:]\

  C:>bcdedit /set osdevice vhd=[driverletter:]\

  C:>bcdedit /set detecthal on

  Note: detecthal is used to force windows to auto detect the Hardware Abstraction Layer.

  If you want to delete any existing VHD entry from the Boot Menu you can always use the command C:>bcdedit /delete /cleanup This deletes the specified operating system entry from the store and removes the entry from the display order.

  Well, we are ready to Boot from VHD. Once you restart the computer you will see additional entry in Boot Menu along with the default Windows 7 or Windows Server 7 OS.

  Here is the screenshot from newly booted Windows Server 2008 R2 Beta from VHD. I have installed Desktop Experience Pack and enabled Aero Glass.

Windows 7中从VHD文件启动计算机

看到这里,大家不免有一些问题:从VHD启动之后的系统,到底是运行在虚拟机上?还是直接运行在物理硬件之上?从VHD启动,还需要哪些必备的条件?是否会有性能的损失?下面我来回答这些问题:

  1. Windows 7的引导程序和Windows 7本身都包含了对VHD文件的读写驱动程序,因此我们可以在启动计算机的时候,访问VHD并且从其上启动;我们也可以在Windows 7中直接创建、加载和卸载VHD文件。这些都是VHD读写驱动的功劳,跟Virtual PC或者Hyper-V没有直接的关系。因此Windows 7不需要安装任何虚拟化软件。

  2. 从VHD启动之后,计算机的操作系统直接访问硬件,不是以虚拟化的方式运行。

  3. 这里面唯一的区别,就是对文件系统读写访问的时候,需要经过额外的一层VHD读写驱动的解析,这里面有一些微量的I/O性能开销,但是跟虚拟化的情况相比,性能基本上接近了真机。我查了一些测试资料,有一组直接读取硬盘和读写VHD的比较,性能差别微乎其微。如下图:  

Windows 7中从VHD文件启动计算机

4. 因为对VHD的支持仅包含在Windows 7中,因此我们不能在Windows 7中创建VHD后通过光盘给VHD安装任何操作系统。


相关VHD的文章

Windows 7支持VHD虚拟硬盘

Windows 7在虚拟磁盘(VHD)中的安装与启动

VHD(虚拟磁盘)系统在Windows 7中的加载

领略Windows7的VHD虚拟化文件


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值