|Currently, Google searching for information on how to clone VirtualBox Virtual Machines or how to move a VirtualBox VM (to a new host directory, host disk, or host machine) leads to a lot of folks stuck with cloning failures, apparent dead ends, outdated information, and VirtualBox features that don't seem to work correctly. While poking around enough leads to working solutions, this blog post is a small contribution to help direct folks towards success.|
Link To This Articlehttp://goo.gl/BOiD6
Note: These steps work for me running VirtualBox 4.0.4 r70112 (and with the latest 4.0.6 r71416), on Windows 7 Home Premium x64 SR1. I am new to using VirtualBox and my experience level is yet introductory. Also, the information provided here is listed elsewhere on the internet, and is probably somewhere in the VirtualBox documentation.
Without further ado, to copy a flat (i.e., without snapshots) virtual machine, with the VM not running (i.e., stopped), follow these three steps:
- First, create a copy of the VDI file, using Windows Explorer or a simple copy command:
copy abc.vdi def.vdi
- Then, change the UUID of the new VDI file with the command
VBoxManage.exe internalcommands sethduuid def.vdi
- And finally, from within the VirtualBox Manager, create a new Virtual Machine, selecting to use the new VDI as an existing Hard Disk.
To simply move the location of an existing VDI file on the host, or to copy or move the VDI file to another host, it does work to delete the VM within the VirtualBox Manager, without actually deleting the VDI file on the host file system (obviously, deleting the VM on the current host is not necessary if moving to a new host), move the VDI file to the new location, and then create a new VM, selecting to use the moved VDI file as an existing Hard Disk.
Alternatively, to move the VDI file on the host without deleting the existing VM, close the VirtualBox Manager and shut down all VM instances. (Shutting down the VMs not associated to the move might not be necessary.) Then, edit *all* of the file paths in the .vbox file associated with the VM to be moved. By default, the .vbox file is in a subdirectory in the host user's home directory (e.g., C:\Users\User1). The .vbox file name should match the name of the VDI file, and be in a subdirectory with a name that also matches the name of the VDI file. The .vbox file is a simple text XML file, easily edited in Windows Notepad. Finally, start the VirtualBox Manager, select the newly moved VM, which should still be listed on the left side, where all of the VMs are listed, and start it.
Note that changing the UUID of the VDI file is not necessary, when simply moving it.