Cloning vs copying virtual machines in VirtualBox
VirtualBox is a great virtualization software but it is sometimes hard to do some advanced tasks in it. One of those tasks can be creating copies of virtual machines.
There’s no graphic interface for cloning virtual machines but there’s command line tool called VBoxManage which can be used:
VBoxManage clonevdi source.vdi target.vdiIt’s simple and straightforward to use but there’s one thing you have to remember: you have to be in VirtualBox directory (on Linux it’s ~/.VirtualBox/) or in directory with virtual hard disks of VirtualBox machines (~/.VirtualBox/HardDisks/). For most use cases this limitation is OK but what if you have your virtual machine in some other directory (for instance on virtual encrypted disk created by TrueCrypt or you just created subdirectories in ~/.VirtualBox/HardDisks/ to separate Linux machines from Windows machines)? Above command will not work in this case (at least not in VirtualBox 3.2.6 and below). To bypass this limitation you have to copy virtual machine:
cp ~/.VirtualBox/HardDisks/some_directory/source.vdi ~/.VirtualBox/HardDisks/some_directory/target.vdiand then generate new UUID for it:
VBoxManage internalcommands sethduuid ~/.VirtualBox/HardDisks/some_directory/target.vdiNow you can create new virtual machine in VirtualBox GUI and use target.vdi as its hard disk.
This entry was posted on 28 July 2010 at 10:56 in category Linux and tagged .