Friday, January 21, 2011

Cloning Virtual Machine from snapshot in virtualbox

Today I've faced an interesting task to make a new virtual machine from a snapshot of existing one in virtual box. After a little research, I've found nice guide how to do it:

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.
  • 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 the hexUUID value (removing the {} brackets) and run clonehd to clone it!
    C:> VBoxManage clonehd b6441469-5ccb-418c-8fdd-73c5e1a17314 CloneDisk.vdi


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.
  • 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 the hexUUID value (removing the {} brackets) and run clonehd to clone it!
    C:> VBoxManage clonehd 75bd6ab1-ce25-4b56-aa39-7826c9ebcc93 CloneDisk.vdi


There is no GUI at the moment, but it could be easily done in command line.