如何在VirtualBox中使用分支快照

tech2023-12-22  70

VirtualBox has supported virtual machine (VM) snapshots for a while. However, until version 3.1, it was only possible to revert back to a previous state which destroyed snapshots lower in the hierarchy.

VirtualBox支持虚拟机(VM)快照已有一段时间。 但是,直到3.1版之前,只能恢复到先前的状态,该状态破坏了层次结构中较低级别的快照。

VirtualBox 3.1 introduces a great new feature that could help web developers manage multiple virtual machines (VMs). Branched snapshots allow you to create any number of VMs from a single root image. For example, you could install a clean copy of Windows XP SP3 and, from that single image, create snapshots with multiple browser configurations.

VirtualBox 3.1引入了一项很棒的新功能,可以帮助Web开发人员管理多个虚拟机(VM)。 分支快照允许您从单个根映像创建任意数量的VM。 例如,您可以安装Windows XP SP3的完整副本,然后从该单个映像创建具有多个浏览器配置的快照。

There are a number of ways to create snapshots, but it’s easiest from the main Snapshots tab. In the following example, we’ll create three snapshots for the root, IE6 and IE7.

创建快照有多种方法,但是从“ 快照 ”主选项卡中最简单的方法。 在下面的示例中,我们将为根IE6和IE7创建三个快照。

1.创建您的VM和第一个快照 (1. Create your VM and first snapshot)

First, you’ll need to create a new VM, install an OS and all the latest patches. If you’re installing XP, I’d recommend creating a minimal installation using nLite. Once complete, shut down the VM, return to the main VirtualBox window, and click the Snapshots tab:

首先,您需要创建一个新的VM,安装一个OS和所有最新的补丁程序。 如果您要安装XP,建议您使用nLite创建一个最小安装。 完成后,关闭虚拟机,返回到VirtualBox主窗口,然后单击“ 快照”选项卡:

Highlight the Current State, then click the Take Snapshot icon (circled in red) and give it a name and description, e.g. “XP SP3”.

突出显示“当前状态”,然后单击“ 拍摄快照”图标(红色圆圈)并为其提供名称和说明,例如“ XP SP3”。

2.创建一个IE6快照 (2. Create an IE6 snapshot)

The current state should already have IE6 installed, but it’s a good idea to take another snapshot since updates will be applied over time. With the Current State highlighted, click the Take Snapshot icon and give it a name and description, e.g. “XP IE6”.

当前状态应该已经安装了IE6,但是最好再拍一张快照,因为更新会随着时间的推移而应用。 在“当前状态”突出显示的情况下,单击“ 拍摄快照”图标并为其提供名称和说明,例如“ XP IE6”。

3.恢复到根快照 (3. Revert to the root snapshot)

Here’s the clever bit. Highlight the root “XP SP3” VM and click the Restore Snapshot icon (circled in red). You’ll be warned that you’ll lose the current machine state, but click Restore anyway — you won’t lose the IE6 snapshot.

这是聪明的地方。 突出显示根“ XP SP3” VM,然后单击“ 还原快照”图标(红色圆圈)。 将会警告您,您将丢失当前的计算机状态,但是无论如何,请单击“还原” -您将不会丢失IE6快照。

4.安装IE7 (4. Install IE7)

Now boot the VM in it’s current state, then install IE7 and any other software you need. Once complete, shut down the VM.

现在以当前状态启动VM,然后安装IE7和您需要的任何其他软件。 完成后,关闭虚拟机。

5.创建一个IE7快照 (5. Create an IE7 snapshot)

From the Snapshot tab, highlight the Current State, click the Take Snapshot icon and give it a name and description, e.g. “XP IE7”.

在“快照”选项卡中,突出显示“当前状态”,单击“ 拍摄快照”图标并为其提供名称和描述,例如“ XP IE7”。

That’s all there is to it. You can create as many snapshots as you need from the root VM and the disk image will only expand as differences are made. To revert to a different state, highlight the snapshot and click the “Restore Snapshot” icon before booting.

这里的所有都是它的。 您可以从根VM创建所需数量的快照,并且磁盘映像仅在进行差异时才会扩展。 要恢复为其他状态,请突出显示快照,然后在启动前单击“还原快照”图标。

The main disadvantage with branched snapshots is they are not clones — you can only have one running at a time. It’s not possible to boot both the IE6 and IE7 image. But it’s still a great addition to VirtualBox and will help you test browsers and other software.

分支快照的主要缺点是它们不是克隆-一次只能运行一个。 无法同时启动IE6和IE7映像。 但这仍然是VirtualBox的重要补充,它将帮助您测试浏览器和其他软件。

翻译自: https://www.sitepoint.com/virtualbox-branched-snapshots-tutorial/

最新回复(0)