Page 1 of 1

Recommended method to copy a guest between hosts?

Posted: 2. Aug 2011, 18:07
by cgwaters
I have two Windows 7 PCs that are configured differently from one another (a laptop and a desktop). I'm using VirtualBox 4.1 on both PCs. I have a Windows 7 guest that I'd like to move between these two hosts. (I realize the Windows 7 guest may require re-activation periodically; I have an MSDN license and--worst case--will enter alternating product keys each time I move the guest.)

I built the guest on the laptop; it uses a .VDI file. I used File > Export Appliance on the laptop to export the guest to a .OVA file, copied the .OVA file from the laptop to the desktop, and then used File > Import Appliance on the desktop to import the .OVA file and re-create the guest there. (I'm not sure why, but the re-created guest is a .VMDK file instead of a .VDI file.)

If I want to move the guest back to the laptop, should I simply reverse the process? (i.e., Produce a new .OVA file on the desktop, (I think) delete the entire existing guest on the laptop, and then import the .OVA file to produce the guest there? (either as a .VDI or a .VMDK)

For my scenario, is this the recommended method to copy a guest between hosts?

Re: Recommended method to copy a guest between hosts?

Posted: 3. Aug 2011, 09:43
by mpack
It isn't how I'd do it.

Simplest method is to create the VM on one host - as you've already done. And assuming it's a V4 VM you should just be able to copy the VM folder to the other host and use "Machine | Add..." to add it to the GUI on that host. Once the VM exists on both hosts then in future you need only copy the VDI file between them to keep them synced - and don't use snapshots, as they'll only complicate matters.

Migrating between a desktop and a laptop usually means a change of CPU. Win7 will notice, but I don't know if that will be enough to trigger reactivation.

Re: Recommended method to copy a guest between hosts?

Posted: 3. Aug 2011, 15:46
by cgwaters
[I updated my original post to say that I used the File > Export/Import Appliance feature--not the Virtual Media Manager, as I incorrectly stated originally.]

Thanks. I considered simply copying the .VDI between the hosts until I read the following in the User Manual: "Do not simply make copies of virtual disk images. If you import such a second copy into a virtual machine, VirtualBox will complain with an error, since VirtualBox assigns a unique identifier (UUID) to each disk image to make sure it is only used once....Also, if you want to copy a virtual machine to another system, VirtualBox has an import/export facility that might be better suited for your needs..." That was enough to drive me to use the File > Export/Import Appliance feature, instead. OTOH, perhaps that warning is only applicable if I were to attempt to use the copy of the .VDI in a second VM? In your experience, copying just the .VDI between the hosts (after the guest has been set up on both hosts) works well?

FYI: Upon the initial launch of the guest on the desktop (after the guest had been copied from the laptop), Windows 7 said that it detected 'i7 hardware' and displayed a re-activation prompt. I haven't checked yet, but I figure I'll get a similar prompt (from the *absence* of the i7 hardware) when I copy the guest back to the laptop and launch it from there.

Re: Recommended method to copy a guest between hosts?

Posted: 3. Aug 2011, 16:51
by mpack
cgwaters wrote:Do not simply make copies of virtual disk images....
The manual is giving clear instructions that avoid problems, but in practice the problem only arises when you try to register multiple copies of a VDI on the same host. In any case that paragraph is quite old and rather less relevant these days.

As to copying: you first need to copy and "Machine|Add" the VM as I already described. This ensures that the VM-UUID is the same on both hosts (VM-UUID should not be confused with a disk UUID). After the VM exists with the correct UUID then you can simply copy the VDI. I do this for copying between my work and home PCs, and works well, however all my PCs are desktops with the same CPU, and my Windows guest of choice is XP, not Win7.
cgwaters wrote:FYI: Upon the initial launch of the guest on the desktop (after the guest had been copied from the laptop), Windows 7 said that it detected 'i7 hardware' and displayed a re-activation prompt. I haven't checked yet, but I figure I'll get a similar prompt (from the *absence* of the i7 hardware) when I copy the guest back to the laptop and launch it from there.
Yes, I would agree. A pity, it looks like it's going to be tricky to keep those two hosts sync'd. Could you perhaps have separate installs of Win7 on each host, and have a second virtual drive for data?

Re: Recommended method to copy a guest between hosts?

Posted: 4. Aug 2011, 16:04
by cgwaters
Thanks for the explanation. I'll try copying just the .VDI file between the hosts.

I set up a second virtual drive, for data, and just copied that between the hosts; however, some of the applications I'm running insist on writing data to the system drive instead of to the data drive (even though I configured the apps' settings properly). So that doesn't appear to be a workable option for me.

I have two monitors on my desktop; I usually run VMs on the second monitor. Will that prove to be a problem when I copy the .VDI back to the laptop? Or is that type of information retained in the .VBOX file--which will remain unique to each host?

Re: Recommended method to copy a guest between hosts?

Posted: 4. Aug 2011, 19:29
by mpack
I'm afraid I don't run with multiple monitors myself and so can't tell you much about that feature. I was under the impression however that if you drag a window onto your second monitor then that is a preference stored implicitly by your host OS (to be assigned to all instances of that Window class in future). Not a VBox issue at all, hence nothing about it to be found in e.g. the .vbox file, hence not an issue if the .vbox file is moved between hosts.

Re: Recommended method to copy a guest between hosts?

Posted: 4. Aug 2011, 21:29
by cgwaters
Thanks. I figured that the desktop location of the guest was stored in the corresponding.VBOX file...and that since I'm not planning to copy the .VBOX file when I copy the the .VDI between hosts, I wouldn't have to worry about the last (and potentially inaccessible on a PC having just one monitor) desktop location of the guest.

Re: Recommended method to copy a guest between hosts?

Posted: 5. Aug 2011, 09:13
by mpack
cgwaters wrote:Thanks. I figured that the desktop location of the guest was stored in the corresponding.VBOX file...
Ah... that is indeed true. Yes, that's probably what determines which monitor will be used. So, safest not to do that then if moving a .vbox file. Or, check the .vbox on new host before use (it's in the <ExtraData> section somewhere).