Copying virtual machine to another machine (different OS)

This is for discussing general topics about how to use VirtualBox.
Post Reply
Vinod Mohan
Posts: 3
Joined: 15. Mar 2013, 10:10

Copying virtual machine to another machine (different OS)

Post by Vinod Mohan »

I have a hardware bound program installed in a Guest machine (windows) on a Windows machine. I want to copy the virtual machine to virtual box in another Linux machine. How can I copy the virtual machine so that the hardware id do not change?

Since the target system is a different physical machine, do I need to clone?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Copying virtual machine to another machine (different OS

Post by mpack »

Just copy the VM folder and register the .vbox file using Machine|Add... on the new host . You may need to edit the .vbox file so that paths and device names match conventions on the new host. Any bridged adapters will need to be converted to NAT or bridged to a NIC that exists on the new host.

Note that if the CPU type changes between hosts then this will be visible to the guest.
lexxx
Posts: 28
Joined: 25. Oct 2011, 08:30
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly Windows 7 and 2008 R2

Re: Copying virtual machine to another machine (different OS

Post by lexxx »

Why not use vm export/import?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Copying virtual machine to another machine (different OS

Post by mpack »

It could be used, but I wouldn't, because it changes the VM in several ways. In particular I believe it would change the VM UUID, which the OP specifically asked about.
lexxx
Posts: 28
Joined: 25. Oct 2011, 08:30
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly Windows 7 and 2008 R2

Re: Copying virtual machine to another machine (different OS

Post by lexxx »

I think that vm export/import function is specially created for migrating vms to other hosts, and method you suggested is somehow less safe to fail.
Vinod Mohan
Posts: 3
Joined: 15. Mar 2013, 10:10

Re: Copying virtual machine to another machine (different OS

Post by Vinod Mohan »

Thanks mpack, lexxx.

Is import / export different from cloning? I read that cloning creates a different UUID.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Copying virtual machine to another machine (different OS

Post by Perryg »

Cloning with CloneVDI Tool gives you a choice where VBox cloning does not. The reason being that trying to use the clone on the same machine with the same UUID will not work. The best way is to copy the entire folder to the new location and use the add feature. If you simply must clone and retain the same UUID you have to use Don's tool.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Copying virtual machine to another machine (different OS

Post by mpack »

Well, using CloneVDI will allow you to preserve the hard disk UUID, but not the VM UUID. For that you have to copy the original .vbox file, or manually edit the new one before first boot.
Vinod Mohan wrote:Is import / export different from cloning? I read that cloning creates a different UUID.
Around here, "cloning" is typically understood to mean copying a VM and then modifying it such that it can run on the same host as the original VM. If you use the VirtualBox cloning feature then the copying and modification steps are automated. Note that modifications include changing all the UUIDs, otherwise it can't work on the same host.

Export/import is a legacy feature from VBox 3.x and earlier. It's like cloning, except it was intended to be portable to different hosts and even different VM platforms. Sounds great, but unfortunately it uses a VMWare standard, hence it involves extensive mods to the VM, including changing the disk type to VMDK, not preserving a bunch of other things that VMWare didn't cater for, and changing all the UUIDs. As a backup, or whenever you are concerned about not making unnecessary changes, export/import is a terrible idea.

The final and best option is simply copying the VM. Copying a VM is simply that: use the host OS to copy the VM files to another disk or folder. This is not a clone: it will not work on the same host while the original is still around. However, the copy makes an excellent backup, and IMHO it's the best way to make an identical copy of the VM on another host.

One caveat is that your question was about moving a VM between different host OS's. Frankly I think you should avoid that if you can, however IMHO copying the VM and then manually correcting the .vbox is the only way to ensure an identical (as possible) VM, e.g. with no UUID changes in either the VM or the disks.
bulletmark
Posts: 53
Joined: 16. Jun 2009, 14:48
Primary OS: Ubuntu 12.12
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,mac
Location: Brisbane Australia

Re: Copying virtual machine to another machine (different OS

Post by bulletmark »

I'd like to ask a simple question related to this post.

If I file copy a guest from one host to another (say Ubuntu to Mac OSX), with both hosts running the same version of VB, do I need to re-install the guest additions for any reason/benefit?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Copying virtual machine to another machine (different OS

Post by Perryg »

bulletmark wrote:I'd like to ask a simple question related to this post.

If I file copy a guest from one host to another (say Ubuntu to Mac OSX), with both hosts running the same version of VB, do I need to re-install the guest additions for any reason/benefit?
I can't think of a reason off hand. For the most part the GAs are built around the guest so they are unique to a particular guest system.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Copying virtual machine to another machine (different OS

Post by mpack »

bulletmark wrote:If I file copy a guest from one host to another (say Ubuntu to Mac OSX), with both hosts running the same version of VB, do I need to re-install the guest additions for any reason/benefit?
No, there's no benefit in that. The guest additions talk to VirtualBox, not to the host. VirtualBox takes care of doing whatever is needed on each host.
Vinod Mohan
Posts: 3
Joined: 15. Mar 2013, 10:10

Re: Copying virtual machine to another machine (different OS

Post by Vinod Mohan »

Thank you all for your help. I don't want to blacklist my license. If I do try migrating, I'll post the result here.
SpecializedTom
Posts: 2
Joined: 14. Sep 2014, 07:05

Re: Copying virtual machine to another machine (different OS

Post by SpecializedTom »

I have a slightly different scenario that I require an answer for.

I currently run VirtualBox 4.3.14 on a Fedora 20 64 bit host, with a Fedora 20 32 bit guest. The hdd on the guest is connected via iSCSI. My requirement is I need to copy the iSCSI hdd onto a Windows 7 host.

By logging onto the iSCSI target, converting to raw format (using dd) and converting to VDI format (using vboxmanage) :
a) does Guest Additions have to be applied to the VDI file on the Windows host?
b) do any linux device drivers (eg. ALSA) have to be sourced and recompiled on the Guest while on the Windows host?
c) is there anything else to consider when transferring VM between hosts ?

Thanks.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Copying virtual machine to another machine (different OS

Post by mpack »

What is all that "convert to raw, convert to vdi" stuff for? Why not just copy the file as it already exists?

But in answer to your question: the format of the virtual hdd file is something that the host cares about. The guest just sees the same old disk, with the same old stuff already installed on it, which will include the GAs if you already installed them.
SpecializedTom
Posts: 2
Joined: 14. Sep 2014, 07:05

Re: Copying virtual machine to another machine (different OS

Post by SpecializedTom »

Thanks for the answer.

The reason behind the "convert to raw, convert to VDI" process, is that the iSCSI target resides on a Synology NAS (not locally on the host pc). The destination host will host the VDI on its' local hard disk.
Post Reply