How to move a VBox VM to another PC?

This is for discussing general topics about how to use VirtualBox.

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

Postby mmorris » 24. Jul 2009, 18:54

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
mmorris
 
Posts: 6
Joined: 16. Jan 2009, 22:49

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

Postby DavoMartinez » 31. Jul 2009, 19:03

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.
DavoMartinez
 
Posts: 1
Joined: 31. Jul 2009, 18:54
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: XP

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

Postby g0nad » 2. Aug 2009, 06:42

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.
g0nad
 
Posts: 1
Joined: 2. Aug 2009, 05:50
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: debian & XP

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

Postby SecretCode » 2. Aug 2009, 10:19

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.
SecretCode
 
Posts: 62
Joined: 17. Jul 2009, 10:20
Location: South Africa
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu, XP, other

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

Postby jacksenechal » 1. Sep 2009, 01:59

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.
jacksenechal
 
Posts: 1
Joined: 1. Sep 2009, 01:47
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Ubuntu, WinXP, Incognito Linux (at least, trying to get it to run!)

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

Postby ColOfNature » 6. Sep 2009, 02:09

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?
ColOfNature
 
Posts: 4
Joined: 6. Sep 2009, 02:06
Primary OS: MS Windows Vista
VBox Version: PUEL
Guest OSses: debian, gentoo, freebsd

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

Postby mpack » 6. Sep 2009, 10:24

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.
mpack
Site Moderator
 
Posts: 13164
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

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

Postby MrX1980 » 29. Dec 2009, 15:23

Please participate on "Add OPEN function" ( http://www.virtualbox.org/ticket/5767 )
MrX1980
 
Posts: 26
Joined: 3. Sep 2008, 20:44

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

Postby AwesomeHighFive » 1. Jun 2011, 16:47

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.
AwesomeHighFive
 
Posts: 9
Joined: 19. May 2011, 19:20
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 8.04.4 Server LTE

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

Postby jdthood » 4. Aug 2011, 09:51

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).
jdthood
 
Posts: 1
Joined: 4. Aug 2011, 09:38
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP, Debian, etc.

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

Postby Cyberian » 4. Aug 2011, 13:38

Have a look in your Virtual Media Manager.

remove the entry (without deleting the vdi) and re-add the VDI from the new location.
Cyberian
 
Posts: 49
Joined: 17. Dec 2008, 10:21
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Windows, Fedora

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

Postby ssamuel » 29. Oct 2011, 17:12

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
ssamuel
 
Posts: 1
Joined: 29. Oct 2011, 16:47
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: multiple

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

Postby mpack » 30. Oct 2011, 15:48

? 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.
mpack
Site Moderator
 
Posts: 13164
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

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

Postby noletolucas » 13. Mar 2012, 22:53

To MOVE PRESERVING SNAPSHOTS and NOT MANUALLY EDITING ANYTHING:
https://forums.virtualbox.org/viewtopic ... 58#p219275
https://forums.virtualbox.org/viewtopic ... 58#p219285

Basically you should follow this 2 replies.
noletolucas
 
Posts: 2
Joined: 29. Dec 2011, 22:59
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: winxp

Previous

Return to Using VirtualBox

Who is online

Users browsing this forum: No registered users and 20 guests