Page 2 of 2

Re: How to move a VBox VM to another PC?

Posted: 24. Jul 2009, 18:54
by mmorris
The process is even simpler...

On the existing host machine:
1) Close the Virtual Box session that you want to clone/export/copy
2) Use the Sun Virtual Box interface select File --> Export Appliance ...

On the new host machine:
1) Use the Sun Virtual Box interface select File --> Import Appliance ...

Mike

Re: How to move a VBox VM to another PC?

Posted: 31. Jul 2009, 19:03
by DavoMartinez
I started using VBox last week.

I made the mistake of changing the drive letter of where my VMs were on my computer and I had to redo my system and snapshots. It was not a big deal since I had only spent about 2 hours installing the VM OS and creating snapshots.

Re: How to move a VBox VM to another PC?

Posted: 2. Aug 2009, 06:42
by g0nad
I had a VM with a snapshot but the (windows) host died. I didn't want to reinstall windows so thought I'd be able to run up the VM on my Linux workstation. Getting the VM going was not a problem however I'm stumped about being able to pull in the snapshots. I won't be using snapshots in future, I'll just take copies of the vdi "harddisks" from time to time instead.

Re: How to move a VBox VM to another PC?

Posted: 2. Aug 2009, 10:19
by SecretCode
DavoMartinez wrote:I started using VBox last week.

I made the mistake of changing the drive letter of where my VMs were on my computer and I had to redo my system and snapshots. It was not a big deal since I had only spent about 2 hours installing the VM OS and creating snapshots.
I successfully recovered from situation like this (but I was not using snapshots) just by editing the main vbox xml - on a Windows host, C:\Documents and Settings\user\.VirtualBox\VirtualBox.xml - and fixing the paths in the <MachineRegistry> and the <MediaRegistry> sections.

This may be unsupported and is probably risky - take backups of that file before editing.

Re: How to move a VBox VM to another PC?

Posted: 1. Sep 2009, 01:59
by jacksenechal
I have managed to move my virtual machines from my laptop hard drive to an external, to free up space. Here's how I did it:

1) Create VirtualBox directory on external
2) Move ~/.VirtualBox/HardDisks/ and ~/.VirtualBox/Machines to the external
3) Edit ~/.VirtualBox/VirtualBox.xml, and:
4) Replace all absolute path references with the path to the external directory (eg. replace /home/jack/.VirtualBox/ with /media/disk/VirtualBox)
5) Convert all relative paths to absolute paths, pointing to the external (eg. under <MachineRegistry>, "Machines/Windows/Windows.xml" becomes "/media/disk/VirtualBox/Machines/Windows/Windows.xml", etc)

Success! And all of my snapshots, etc are still intact.

Re: How to move a VBox VM to another PC?

Posted: 6. Sep 2009, 02:09
by ColOfNature
Is it possible to migrate a VM to another host while it is running? i.e. I need to shut down my host while I'm compiling on the guest, can I move the guest temporarily to my laptop without stopping the running process?

Re: How to move a VBox VM to another PC?

Posted: 6. Sep 2009, 10:24
by mpack
ColOfNature wrote:i.e. I need to shut down my host while I'm compiling on the guest, can I move the guest temporarily to my laptop without stopping the running process?
No. Your virtual disks are actual opened host files. AFAIK, no host OS allows you to move opened files.

You could try saving the machine state, but that makes the move more complicated.

Re: How to move a VBox VM to another PC?

Posted: 29. Dec 2009, 15:23
by MrX1980
Please participate on "Add OPEN function" ( http://www.virtualbox.org/ticket/5767 )

Re: How to move a VBox VM to another PC?

Posted: 1. Jun 2011, 16:47
by AwesomeHighFive
If anyone is still wondering about this, if you went and deleted the old machine like I did, you have to find its UUID in its local virtualbox file (which is just xml) and copy it into the main xml file in your C:\users directory. It looks like it correctly reads all of the snapshots once the machine UUID is in place.

Re: How to move a VBox VM to another PC?

Posted: 4. Aug 2011, 09:51
by jdthood
I just moved a VirtualBox VM from an i386 machine to a x86_64 machine. I just used scp to copy the whole /home/<username>/VirtualBox\ VMs/<vmname> directory over. I started VirtualBox OSE Manager on the new host machine and was able to boot the VM without any further action. Nice.

But then I decided I wanted to move the VM's files to another location in the filesystem. I reverted to snapshot and used mv to move the directory named like the VM. In VirtualBox OSE Manager I "Remove"d and "Add"ed the VM from the new location. VirtualBox could no longer start the VM, complaining of a hard disk file not found. Interesting that the VM files can be moved brute-force from one machine to another, of another architecture, but not from one directory to another on the same machine!

I was able to move the VM directory by (1) moving it back to the original location, where it worked (again) and (2) exporting and importing it to the desired location.

Both of these techniques were mentioned earlier. Thanks to the help of other forum contributors.

This was with VirtualBox OSE 4.0.4, both machines running Ubuntu 11.04 (natty).

Re: How to move a VBox VM to another PC?

Posted: 4. Aug 2011, 13:38
by Cyberian
Have a look in your Virtual Media Manager.

remove the entry (without deleting the vdi) and re-add the VDI from the new location.

Re: How to move a VBox VM to another PC?

Posted: 29. Oct 2011, 17:12
by ssamuel
If anyone's still looking, I found an easy manual solution:

1. Exit VirtualBox. It may work while still running but I doubt it refreshes. Probably a good idea to exit first anyway, programs tend not to like their master config files changing under them while running.
2. Backup your ~/.VirtualBox/VirtualBox.xml file then edit it. It's a light edit, any text editor should work.
3. Find the [machinename].vbox XML file in the folder for the VM you're trying to add and open it.
4. At the top of the machine file is a <Machine ... > tag. Copy the whole tag, single line, just the open tag.
5. Insert this into the VirtualBox.xml file with the rest of the <MachineEntry ... > tags, change the name to match. Keep the UUID but change the source to point to the physical path of the [machinename].vbox file that you just opened. I just did some copy-paste with the line above it since I keep all my HDs in one place and follow the general pattern it defaults to. Basically, make it look like its friends but with the correct information.
6. Save, close, restart VirtualBox.

If you get an error complaining about some mounted CD image, edit the [machinename].vbox file and remove the mounted CD/DVD images. This would happen if you've re-mounted the same ISO on the new server as the first time it mounts, it seems to get a UUID that sticks with it. May happen otherwise, dunno, but it's an easy fix. You'll need to re-mount the ISO but that's easy through the UI.

I'm assuming you know XML and can manage modifying a listing while maintaining validity. If not, use an XML-aware editor on the VritualBox.xml file and it should help you. Every XML tag <something> must have a corresponding </something> at the same structural level and <something></something> is syntactically equivalent to <something/>. XML is case-sensitive, even on Windows. If you cronk your config file, you have a backup from step 1.

I did this on Ubuntu but a brief peek at a Windows VBox install seems to show the configuration being exactly the same. On Windows the VirtualBox.xml file is [userdirectory]/.VirtualBox/VirtualBox.xml. Since you copied your machine config from somewhere else, you should know where it lives.

This got me all my snapshots, exact same configuration (minus the mounted ISOs), etc. Took me all of a minute.

HTH

Re: How to move a VBox VM to another PC?

Posted: 30. Oct 2011, 15:48
by mpack
? What is the point of this cumbersome procedure? If you want to add a VM described by a .vbox file to the VirtualBox UI, you simply double-click the .vbox file, or alternatively select the Machine | Add... menu item in the UI, and then browse to the .vbox file you want. Manual xml edits can't be supported because we can't be sure you got it right - and anyway it is unnecessary in this instance.

Much of the above thread deals with VirtualBox prior to v4.x, which is when new features were added to the UI which makes this easy, rendering much of this thread obsolete - IMHO it should be locked to prevent further misinformation being posted.

Re: How to move a VBox VM to another PC?

Posted: 13. Mar 2012, 22:53
by noletolucas
To MOVE PRESERVING SNAPSHOTS and NOT MANUALLY EDITING ANYTHING:
viewtopic.php?f=1&t=48258#p219275
viewtopic.php?f=1&t=48258#p219285

Basically you should follow this 2 replies.