This is mainly a reference post for later. I’ve found myself digging through history or stale bookmarks for steps to clone a snapshot within VirtualBox. This is a pain, be much easier to just search my blog for it. You will thank me later.
The main premises, one of my VMs crapped out after receiving a MS update, unable to boot. Imagine that!? I tried rolling back to a previous snapshot with no luck. My goal is to save the work I’ve done between my last snapshot and the VM not booting. In my case, there are many snapshots, I want to clone the VHD to snapshot I know works, boot it , update it, boot again ensuring all works before trying anything drastic to recover my data on current VM.
Important to note, should be able to boot new VM, reference the old VM as a mountable drive to pull off the data.
The commands below cloned snapshots fine for me in the past. I will say, using clonehd to clone a specific snapshot of a disk is much faster than any other option listed below. However, as of VirtualBox 4.1 Cloning has been added to the GUI menu.
Using the GUI to Clone
The GUI clone does not allow you to clone a specific snapshot from a disk. Instead, clone the entire VM with all snapshots, then rollback the clone to snapshot desired
- Right click VM to clone
- Select Clone
- Set the name of the new virtual machine. Default is original vm namd Clone.
- Decide if you want to Reinitialize the MAC address of all network cards
- Click Next
- Cloning Configuration, tick
Full Clone
- Click Next
- Cloning Configuration, tick
All states
- Click Next
- Click Clone
- Open new VM and roll back to snapshot desired
- Boot the new clone
To clonehd the Current State of a disk:
- Open the Virtual Media Manager
(Menu: File>Virtual Media Manager)
. - Navigate to the hard disk you want to clone and fully expand the tree (use * key on numeric keypad).
- Find the
{hexUUID}.vdi
file that is attached to the VM you want to clone the Current State of. It will be (one of) the leaf files at the end of a branch. When you select it, the ‘Attached to:’ text at the bottom of the window will say:'Attached to: <VMName>'
, without any (snapshot name) in brackets after it. - Click the filename to the right of the
'Location:'
displayed at the bottom of the window. Ctrl+C
/ Copy to copy the text to the clipboard, which will be something like:(path){b6441469-5ccb-418c-8fdd-73c5e1a17314}.vdi
Ctrl+V
/ Paste and extract thehexUUID value
(removing the {} brackets) and run clonehd to clone it!
1
|
|
To clonehd a snapshot of a disk:
- Open the Virtual Media Manager
(Menu: File>Virtual Media Manager)
. - Navigate to the hard disk you want to clone and fully expand the tree (use * key on numeric keypad).
- Find the
{hexUUID}.vdi
file that is attached to the VM (and Snapshot) you want to clone. It will be one of the files along a branch. When you select it, the'Attached to:'
text at the bottom of the window will say:'Attached to: <VMName> (<SnapshotName>)'
, with (snaphot name) in brackets after it. - Click the filename to the right of the
'Location:'
displayed at the bottom of the window. 5.Ctrl+C
/ Copy to copy the text to the clipboard, which will be something like:(path){75bd6ab1-ce25-4b56-aa39-7826c9ebcc93}.vdi
Ctrl+V
/ Paste and extract thehexUUID value
(removing the {} brackets) and run clonehd to clone it!
1
|
|
To clonevm using a snapshot of a disk:
- Open the Virtual Media Manager
(Menu: File>Virtual Media Manager)
. - Navigate to the hard disk you want to clone and fully expand the tree (use * key on numeric keypad).
- Find the
{hexUUID}.vdi
file that is attached to the VM (and Snapshot) you want to clone. It will be one of the files along a branch. When you select it, the'Attached to:'
text at the bottom of the window will say:'Attached to: <VMName> (<SnapshotName>)'
, with (snaphot name) in brackets after it. - Click the filename to the right of the
'Location:'
displayed at the bottom of the window. Ctrl+C
/ Copy to copy the text to the clipboard, which will be something like:(path){75bd6ab1-ce25-4b56-aa39-7826c9ebcc93}.vdi
Ctrl+V
/ Paste and extract thehexUUID value
(removing the {} brackets) and run clonevm to clone it!- Set ‘uuid|name’ of the vm to clone
- Set ‘snapshot uuid’ to snapshot you want to clone
- Set
mode
to bemachineandchildren
, the snapshot provided by--snapshot
and all child snapshots are cloned - Let clonevm set the default name
"Original Name Clone"
by leading off--name
- Set the
basefolder
the new VM should be stored in - Let clonevm set a
NEW uuid
by leaving off--uuid
- Auto
register
new VM in VirtualBox installation by sending--register
1
|
|