Moving a VirtualBox virtual machine from one coputer to another

11 06 2011

Ok, so today I encountered a relative simple problem.. and a bit dumb also..

Virtualization is supposed to make our lives a bit easier.. and Oracle (from my point of view) has failed to do so. I got a new box at my place, so as you all may guess, i tried to move all my vm’s to my brand new shinny box. As an open source padwan, i try to mantain all my software and knowledge.. guess.. YES, open source !

That’s why i chose VirtualBox for my virtual lab.

On to the issue.. i just copied (click ‘n’ drag or $cp -r via console.. its the same result) my vm’s and all their files to an USB HDD, and then, again to the new box. BTW, both boxes are running Ubuntu (10.10 and 11.04). I had installed different versions of VirtualBox, but since im going from an “old” version to the latest version.. i thought there would be no problems at all.. you all know backwards compatibility right ?

Ok, so i fire up VBox on the new.. box :P, create a new vm, and i choose “an existing virtual disk”. And to my surprise, it returns an UUID problem. Seems that it wont be able to read the .vdi file.

Not reading/searching the error message, i thought it was just a user owning issue. So i $chmod the files.. and tried again. Same error message: ns_error_invalid_arg (0x80070057).

So a bit of searching.. it seem that i should have RTFMFA (aka read the manual). The method to copy/move/backup is using the VBoxManage framework, the complete command is like this:

$VBoxManage clonevdi /path-to-original/vm.vdi /path-to-destination/vm2.vdi

Remember to use full path to the files !

This way VBoxManage changes the UUID to the one on the box you are trying to move the vm. And problem solved !

After that just create a new virtual machine and use the “existing virtual harddisk” from where you chose to store it.