如何备份和移动VirtualBox计算机

Need to move a virtual machine, only to find that copying and pasting doesn’t work?  Perhaps you just want to know what to backup?  Take a look at this quick guide on the process to get a better understanding of VirtualBox

是否需要移动虚拟机,只是发现复制和粘贴无效? 也许您只是想知道要备份什么? 查看此过程快速指南,以更好地了解VirtualBox

First things first: be sure that your virtual machine is shut down and powered off.  Next, make sure you get rid of any snapshots you have.  There isn’t a fool-proof and safe way to do this without getting rid of them, unfortunately.  Select your virtual machine and click on the “Snapshots” tab.

首先,要确保虚拟机已关闭并关闭电源。 接下来,确保摆脱所有快照。 不幸的是,没有一种万无一失的安全方法可以做到这一点。 选择您的虚拟机,然后单击“快照”选项卡。

delete snapshots

Select your snapshot and click the delete button.  Be prepared to wait a while as VirtualBox merges differences with your machine’s current state.  The machine’s state won’t actually change, though, so don’t worry.  Now that the prep stuff is out of the way, we can start the moving process.

选择快照,然后单击删除按钮。 准备等待一段时间,因为VirtualBox会将差异与计算机的当前状态合并。 机器的状态实际上不会改变,所以不用担心。 现在准备工作已经完成,我们可以开始移动过程了。

Once that’s done, go to File > Virtual Media Manager.  You’ll see a list of media that you’ve used or have attached to your machines.

完成后,转到“文件”>“虚拟媒体管理器”。 您将看到已使用或已连接到计算机的介质列表。

release media

Select which virtual machine you want to move, then click on the “Release” icon above.  In my case, I’ll be moving W7.vdi from my home directory to another hard drive.

选择要移动的虚拟机,然后单击上方的“发布”图标。 就我而言,我将W7.vdi从主目录移动到另一个硬盘驱动器。

Once you have it released, close VirtualBox go to its default settings directory, /home/user/.VirtualBox/

释放它后,关闭VirtualBox进入其默认设置目录/home/user/.VirtualBox/

virtualbox_dir

You can copy your .vdi file from inside the HardDisks directory if you want to just back it up, or you can move it.  Be patient, as this can take a while depending on your configuration.

如果要备份,可以从HardDisks目录中复制.vdi文件,也可以移动它。 请耐心等待,因为这可能需要一段时间,具体取决于您的配置。

Meanwhile, let’s edit the VirtualBox.xml file to our liking.  This is the step most people don’t really know much about, but it’s pretty vital in making sure things work smoothly.  Open it up in gedit.

同时,让我们根据喜好编辑VirtualBox.xml文件。 这是大多数人并不真正了解的步骤,但是对于确保事情顺利进行至关重要。 在gedit中将其打开。

gedit xml

Scroll down a bit and you’ll get to the parts we need to edit.

向下滚动一点,您将进入需要编辑的部分。

If you’re changing the location of your virtual machines, find the xml tags for “MachineEntry” and change the source path.  If you’re changing the location of your virtual disk images, find the xml tags for “HardDisk” and change the location there.  As you can see, each machine is tied to a disk image by its UUID, which should not be changed.  If you’re moving virtual machines to a new computer, be sure to copy these this file over and replace the previous configuration file.

如果要更改虚拟机的位置,请找到“ MachineEntry”的xml标记并更改源路径。 如果要更改虚拟磁盘映像的位置,请找到“ HardDisk”的xml标记,然后在此处更改位置。 如您所见,每台计算机都通过其UUID绑定到磁盘映像,该磁盘映像不应更改。 如果要将虚拟机移至新计算机,请确保将这些文件复制过来并替换以前的配置文件。

In my particular case, I just wanted to move the disk image to a more spacious drive, so I left the other things intact.

在我的特定情况下,我只想将磁盘映像移到一个更大的驱动器上,所以其他东西保持不变。

gedit vbox version

If you’re changing hosts between Windows and Linux, be sure to change the version declaration at the top of the file to say “windows” instead of “linux” as well.

如果要在Windows和Linux之间更改主机,请确保将文件顶部的版本声明更改为“ windows”而不是“ linux”。

Once you’ve moved the .vdi file, fire up VirtualBox and go to File > Virtual Media Manager.

移动.vdi文件后,启动VirtualBox并转到“文件”>“虚拟媒体管理器”。

vbox Media Manager

Click on the old .vdi file and click remove.  Now, click “Add,” navigate to its new location, and click “Open.”  Click “OK.”

单击旧的.vdi文件,然后单击“删除”。 现在,单击“添加”,导航到其新位置,然后单击“打开”。 点击“确定”。

Now that the new .vdi is added to VirtualBox’s list, we have to attach it to your virtual machine.  At the main screen select it, go to “Settings,” and click on the “Storage” panel.

现在,新的.vdi已添加到VirtualBox的列表中,我们必须将其附加到您的虚拟机。 在主屏幕上将其选中,转到“设置”,然后单击“存储”面板。

add hd

Under the appropriate IDE controller, click the “Add Attachment” button.  You’ll see a hard disk get added automatically, but it probably won’t be the correct one.

在适当的IDE控制器下,单击“添加附件”按钮。 您会看到自动添加了硬盘,但是它可能不是正确的硬盘。

Click it and on right side, under “Hard Disk,” choose the correct .vdi file.  Click “OK.”

单击它,然后在右侧“硬盘”下选择正确的.vdi文件。 点击“确定”。

change vdi

If you followed all the steps and you edited the VirtualBox.xml correctly you should be able to start up the machine without any problems!  There are a few hairy areas, so if things aren’t working, be sure you’re using the correct paths and you’ve edited only the relevant areas of VirtualBox.xml.

如果按照所有步骤操作,并且正确编辑了VirtualBox.xml,则应该可以启动计算机,而不会出现任何问题! 有一些毛茸茸的区域,因此,如果一切都不正常,请确保使用正确的路径,并且仅编辑了VirtualBox.xml的相关区域。

The overall process is a bit more intricate than just copying and pasting, but it’s still relatively quick and painless.  Share your backup stories about VirtualBox in the comments!

整个过程比仅仅是复制和粘贴要复杂得多,但是仍然相对快速,轻松。 在评论中分享有关VirtualBox的备份故事!

翻译自: https://www.howtogeek.com/howto/36870/how-to-backup-and-move-virtualbox-machines/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值