使用快照重新创建虚拟机

使用快照重新创建虚拟机

我有(曾经有)一台虚拟机,我仍然有基础映像和快照,但文件.vbox似乎已损坏。

它告诉我无法访问。当我查看.vbox(显示在底部)文件时,我发现不再提及快照。它还告诉我第 9 行(共.vbox file)有错误

我原本想从磁盘映像重新创建机器。我可以使用新机器向导从基础映像中附加现有磁盘来执行此操作。但是我不知道如何附加磁盘快照。

你能告诉我如何将磁盘及其快照附加到机器吗?

当我选择一个快照(希望它知道它的父母是谁,因此将附加整个链)时,我收到错误:父快照的 uuid媒介我试图附加的文件名 在媒体注册表 /home/richard/.config/VirtualBox/VirtualBox.xml 中未找到'

<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.virtualbox.org/" version="1.15-linux">
  <Machine uuid="{5dd89e49-2e41-4f40-a034-ff8b0ca1a230}" name="win7" OSType="Windows7" snapshotFolder="Snapshots" lastStateChange="2017-06-28T21:19:49Z">
    <Description>Legacy support &#x2014; Microsoft windows</Description>
    <MediaRegistry>
      <HardDisks>
        <HardDisk uuid="{e837b0b1-5453-4dec-9662-42cdc7afbe81}" location="win7 Clone.vdi" format="VDI" type="Normal">
          <HardDisk uuid="{496d0935-0b19-4603-980b-d20f13a0a0ec}" location="Snapshots/{496d0935-0b19-4603-980b-d20f13a0a0ec}.vdi" format="VDI"/>
        </HardDisk>
      </HardDisks>
      <DVDImages>
        <Image uuid="{6352eeaa-3967-4db7-8901-60e6e44e61d8}" location="/usr/share/virtualbox/VBoxGuestAdditions.iso"/>
        <Image uuid="{888131a2-d809-4259-9d70-5af03730ff07}" location="/home/richard/Downloads/OfficeProfessionalPlus_x86_en-us.iso"/>
        <Image uuid="{d1114527-c7b4-477d-a17f-4d094b170913}" location="/home/richard/Downloads/ms/OfficeProfessionalPlus_x86_en-us.iso"/>
      </DVDImages>
    </MediaRegistry>
    <ExtraData>
      <ExtraDataItem name="GUI/InfoDlgState" value="400,450,normal"/>
      <ExtraDataItem name="GUI/InformationWindowGeometry" value="1987,457,600,450"/>
      <ExtraDataItem name="GUI/LastCloseAction" value="Shutdown"/>
      <ExtraDataItem name="GUI/LastGuestSizeHint" value="1280,699"/>
      <ExtraDataItem name="GUI/LastGuestSizeHint1" value="1920,1010"/>
      <ExtraDataItem name="GUI/LastNormalWindowPosition" value="2040,39,640,480,max"/>
      <ExtraDataItem name="GUI/LastNormalWindowPosition1" value="0,23,1920,1053"/>
      <ExtraDataItem name="GUI/LastVisibilityStatusForGuestScreen1" value="true"/>
      <ExtraDataItem name="GUI/LastWindowPostion" value="0,0,0,0,max"/>
      <ExtraDataItem name="GUI/LastWindowPostion1" value="0,0,0,0,max"/>
      <ExtraDataItem name="GUI/MiniToolBarAlignment" value="Top"/>
      <ExtraDataItem name="GUI/RestrictedRuntimeDevicesMenuActions" value="FloppyDevices,SharedClipboard,DragAndDrop"/>
      <ExtraDataItem name="GUI/RestrictedRuntimeHelpMenuActions" value="Oracle"/>
      <ExtraDataItem name="GUI/RestrictedRuntimeMachineMenuActions" value="Reset,PowerOff"/>
      <ExtraDataItem name="GUI/RestrictedRuntimeViewMenuActions" value="Scale,VRDEServer,MenuBar,StatusBar,ScaleFactor,Resize"/>
      <ExtraDataItem name="GUI/SaveMountedAtRuntime" value="yes"/>
      <ExtraDataItem name="GUI/ScaleFactor" value="1"/>
      <ExtraDataItem name="GUI/Seamless" value="true"/>
      <ExtraDataItem name="GUI/StatusBar/IndicatorOrder" value="HardDisks,OpticalDisks,FloppyDisks,Network,USB,SharedFolders,Display,VideoCapture,Features,Mouse,Keyboard"/>
      <ExtraDataItem name="GUI/VirtualScreenToHostScreen0" value="0"/>
      <ExtraDataItem name="GUI/VirtualScreenToHostScreen1" value="0"/>
      <ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="0"/>
      <ExtraDataItem name="VBoxInternal/TM/TSCTiedToExecution" value="0"/>
    </ExtraData>
    <Snapshot uuid="{87d4c17a-119a-441d-8bc8-544c6f4348f9}" name="base-system" timeStamp="2017-04-08T16:40:24Z">
      <Description>no defrag, trim
</Description>
      <Hardware>
        <CPU count="2">
          <PAE enabled="true"/>
          <HardwareVirtExLargePages enabled="true"/>
        </CPU>
        <Memory RAMSize="2048"/>
        <Paravirt provider="HyperV"/>
        <Boot>
          <Order position="1" device="HardDisk"/>
          <Order position="2" device="None"/>
          <Order position="3" device="None"/>
          <Order position="4" device="None"/>
        </Boot>
        <Display VRAMSize="69" monitorCount="2" accelerate2DVideo="true"/>
        <VideoCapture screens="18446744073709551613" rate="307" fps="15"/>
        <RemoteDisplay enabled="false" authType="External" allowMultiConnection="true">
          <VRDEProperties>
            <Property name="TCP/Ports" value="3389"/>
            <Property name="VideoChannel/Enabled" value="false"/>
            <Property name="VideoChannel/Quality" value="75"/>
          </VRDEProperties>
        </RemoteDisplay>
        <BIOS>
          <IOAPIC enabled="true"/>
        </BIOS>
        <USB>
          <Controllers>
            <Controller name="OHCI" type="OHCI"/>
          </Controllers>
          <DeviceFilters>
            <DeviceFilter name="Verbatim STORE N GO [0101]" active="false" vendorId="18a5" productId="0302" revision="0101" manufacturer="Verbatim" product="STORE N GO" serialNumber="6481519A" remote="0"/>
          </DeviceFilters>
        </USB>
        <Network>
          <Adapter slot="0" enabled="true" MACAddress="080027A6701C" cable="true" type="82540EM">
            <DisabledModes>
              <InternalNetwork name="intnet"/>
              <NATNetwork name="NatNetwork"/>
            </DisabledModes>
            <NAT/>
          </Adapter>
          <Adapter slot="1" enabled="true" MACAddress="080027F3B7E9" type="82540EM">
            <DisabledModes>
              <BridgedInterface name="wlan1"/>
              <InternalNetwork name="intnet"/>
              <HostOnlyInterface name="vboxnet0"/>
              <NATNetwork name="NatNetwork"/>
            </DisabledModes>
          </Adapter>
          <Adapter slot="2" MACAddress="080027AB42B9" cable="true" type="82540EM"/>
          <Adapter slot="3" MACAddress="0800271F7F6F" cable="true" type="82540EM"/>
          <Adapter slot="4" MACAddress="0800272A431D" cable="true" type="82540EM"/>
          <Adapter slot="5" MACAddress="080027FF958C" cable="true" type="82540EM"/>
          <Adapter slot="6" MACAddress="080027639CFE" cable="true" type="82540EM"/>
          <Adapter slot="7" MACAddress="0800276E87FC" cable="true" type="82540EM"/>
        </Network>
        <LPT>
          <Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
        </LPT>
        <AudioAdapter controller="HDA" driver="ALSA" enabled="false"/>
        <SharedFolders>
          <SharedFolder name="Downloads" hostPath="/home/richard/Downloads" writable="false" autoMount="true"/>
          <SharedFolder name="win7-readonly" hostPath="/home/richard/+Files/VM/win7-readonly" writable="false" autoMount="true"/>
          <SharedFolder name="win7-share" hostPath="/home/richard/+Files/VM/win7-share" writable="true" autoMount="true"/>
          <SharedFolder name="downloads-ms" hostPath="/home/richard/Downloads/ms" writable="true" autoMount="true"/>
        </SharedFolders>
        <Clipboard mode="Bidirectional"/>
        <DragAndDrop mode="Bidirectional"/>
        <GuestProperties>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxControl.exe" value="5.0.34r113845" timestamp="1491668377846816000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxCredProv.dll" value="-" timestamp="1491668377861259000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxDisp.dll" value="5.0.34r113845" timestamp="1491668377851968000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxGINA.dll" value="-" timestamp="1491668377861016000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxGuest.sys" value="5.0.34r113845" timestamp="1491668377863502000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxHook.dll" value="5.0.34r113845" timestamp="1491668377851023000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxMRXNP.dll" value="5.0.34r113845" timestamp="1491668377860685000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxMouse.sys" value="5.0.34r113845" timestamp="1491668377864110000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxOGL.dll" value="4.1.14r77440" timestamp="1451577933139448000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxOGLarrayspu.dll" value="4.1.14r77440" timestamp="1451577933136024000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxOGLcrutil.dll" value="4.1.14r77440" timestamp="1451577933136618000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxOGLerrorspu.dll" value="4.1.14r77440" timestamp="1451577933137228000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxOGLfeedbackspu.dll" value="4.1.14r77440" timestamp="1451577933138889000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxOGLpackspu.dll" value="4.1.14r77440" timestamp="1451577933137787000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxOGLpassthroughspu.dll" value="4.1.14r77440" timestamp="1451577933138349000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxSF.sys" value="5.0.34r113845" timestamp="1491668377864792000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxService.exe" value="5.0.34r113845" timestamp="1491668377856704000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxTray.exe" value="5.0.34r113845" timestamp="1491668377856199000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Components/VBoxVideo.sys" value="5.0.34r113845" timestamp="1491668377865206000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/HostVerLastChecked" value="5.0.36" timestamp="1491668395740306000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/InstallDir" value="C:/Program Files/Oracle/VirtualBox Guest Additions" timestamp="1491668377838099000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Revision" value="113845" timestamp="1491668377837516000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/--timesync-interval" value="10000" timestamp="1462047418972700000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/--timesync-min-adjust" value="100" timestamp="1462016524553445000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore" value="1" timestamp="1462016530985333000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/--timesync-set-start" value="1" timestamp="1462020738520954000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" value="60000" timestamp="1462047479700617000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/TimesyncInterval" value="10000" timestamp="1462015496352195000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/TimesyncMinAdjust" value="100" timestamp="1462015535544402000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/TimesyncSetOnRestore" value="1" timestamp="1462015610228046000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/TimesyncSetStart" value="1" timestamp="1462015597821119000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VBoxService/TimesyncSetThreshold" value="60000" timestamp="1462015569515855000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/Version" value="5.0.34" timestamp="1491668377836932000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestAdd/VersionExt" value="5.0.34" timestamp="1491668377837203000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestInfo/OS/Product" value="Windows 7" timestamp="1491668377834663000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestInfo/OS/Release" value="6.1.7601" timestamp="1491668377835121000" flags=""/>
          <GuestProperty name="/VirtualBox/GuestInfo/OS/ServicePack" value="1" timestamp="1491668377836508000" flags=""/>
          <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1491669445323601000" flags=""/>
        </GuestProperties>
      </Hardware>
      <StorageControllers>
        <StorageController name="IDE Controller" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
          <AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="0" device="0">
            <Image uuid="{d1114527-c7b4-477d-a17f-4d094b170913}"/>
          </AttachedDevice>
          <AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0">
            <Image uuid="{6352eeaa-3967-4db7-8901-60e6e44e61d8}"/>
          </AttachedDevice>
        </StorageController>
        <StorageController name="SATA Controller" type="AHCI" PortCount="1" useHostIOCache="true" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
          <AttachedDevice nonrotational="true" discard="true" type="HardDisk" hotpluggable="false" port="0" device="0">
            <Image uuid="{e837b0b1-5453-4dec-9662-42cdc7afbe81}"/>
          </AttachedDevice>
        </StorageController>
      </StorageControllers>
    </Snapshot>
    <Hardware>
      <CPU>
        <PAE enabled="true"/>
        <LongMode enabled="true"/>
        <HardwareVirtExLargePages enabled="false"/>
      </CPU>
      <Memory RAMSize="128"/>
      <Paravirt provider="Default"/>
      <RemoteDisplay enabled="false"/>
      <Network>
        <Adapter slot="0" type="Am79C973"/>
        <Adapter slot="1" type="Am79C973"/>
        <Adapter slot="2" type="Am79C973"/>
        <Adapter slot="3" type="Am79C973"/>
        <Adapter slot="4" type="Am79C973"/>
        <Adapter slot="5" type="Am79C973"/>
        <Adapter slot="6" type="Am79C973"/>
        <Adapter slot="7" type="Am79C973"/>
      </Network>
      <LPT>
        <Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
      </LPT>
      <AudioAdapter driver="Pulse" enabled="true"/>
    </Hardware>
  </Machine>
</VirtualBox>

答案1

我发现这是可能的,但并不容易;虚拟盒上的 GUI 不希望你这样做。

第一的备份所有内容。然后,如果你有勇气,请继续阅读。我没有包括所有细节,而且都是凭记忆写的。我大约一小时前做的,花了几个小时才完成。你需要知道如何编辑 xml,理解有向图,并了解一些 virtualbox 的知识。

我了解到您可以将快照映像附加到新的虚拟机。这可用于为您提供具有最新快照的机器。稍后将详细介绍如何恢复所有快照。

附加磁盘差异(磁盘快照)

要附加快照,需要进行一些循环跳转,因为 GUI 不希望您这样做。

首先使用文件日期来猜测是哪个快照。在做笔记时,尝试附加最新的快照。您将收到一个错误,告诉您无法附加,因为不知道另一个映像(这是父映像)。现在尝试附加它。继续这样做,直到找到基础映像,然后对任何其他快照(其他分支)重复此操作。现在,您的笔记中将有所有快照的有向图。

现在创建一个新的虚拟 VM,使用它来附加图像,从底部开始,然后向叶子方向移动。执行此操作时,您应该会在虚拟媒体管理器中看到此有向图出现。

现在创建新的虚拟机

  • 创建一个新虚拟机,将其附加到基础映像,并对其进行配置。
  • 虚拟盒将创建一个新的差异映像(磁盘快照)。
  • 重复:
    • 关闭 virtualbox 管理器,并破解文件中的 xml .vbox,使其指向正确的快照(而不是新的快照)。
    • 重启vbox管理器,并创建快照
  • 整理:通过删除此过程所产生的快照。

相关内容