Page 1 of 1

Moving VM from one host to Another

Posted: 10. Jan 2009, 15:53
by steelej
I have been using VMWare Server for quite a while (version 1) and have been able to transfer the VM from one host to another by simply copying th VM folder and being careful to answer the question to "keep" the configuration to avoid Windows activation issues on XP and Server 2003 guests. I have moved XP VMs from a laptop to a desk top and to a server 2003 host. My project team has created about 70 VM instances of Server 2003 and these regularly get moved between a number of host machines.

I have also very successfully run the VMs on an external USB drive. I have also had more than a dozen FreeBSD VMs (forming a complex WAN routed network) and been able to readily move these between the office and home environment while I developed the network over a period of several weeks.

I am now trying out VBox and am very impressed with performance. I have not however found an easy way of running the VMs in such an easy way on several host machines that was so easy on VMWare. There may be command line tools that allow me to import a machine configuration but I have not found how to do it yet.

I have successfully copied the relevant macchine folder and VDI file to the equivalent places on another another machine and then manually recreated the VBox VM on the new machine pointing to the disk drive and then manuall creating the Ethernet MAC address to avoid XP activation issues but this is a bit tedious. I hope there is a better way.

Posted: 10. Jan 2009, 17:10
by TerryE
Read up the VBoxManage commands in the User Guide, and my tutorial All about VDIs on how to clean up the image before distribution (remove crap, defrag, sDelete and compact). This will allow you to zip it for maximum compression . All you need then is batch script to run the VBox commands to unpack the VDI, do a setvdiuuid on it, register it and add then configure the VM.

As to avoiding activation issues: 70 instances = 70 licences = 70 keys need or you use an enterprise distro rather then end-user / SME one.

Posted: 10. Jan 2009, 19:27
by steelej
TerryE wrote:Read up the VBoxManage commands in the User Guide, and my tutorial All about VDIs on how to clean up the image before distribution (remove crap, defrag, sDelete and compact). This will allow you to zip it for maximum compression . All you need then is batch script to run the VBox commands to unpack the VDI, do a setvdiuuid on it, register it and add then configure the VM.

As to avoiding activation issues: 70 instances = 70 licences = 70 keys need or you use an enterprise distro rather then end-user / SME one.
I had already read the User guide before I posted. I could not find any commands that were helpful. setvdiuuid does not even appear to be in the manual distributed with the download. From your hint I have found that it seems to be part of internalcommands and I can probably work out how to do it eventually. It seems a lot of work when it was so trivial using VMWare.

I note your comment on licensing. I don't want to run multiple copies of XP. I want to be able to MOVE the virtual machine to alternative hosts. This does not break the licencing rules as far as I am aware otherwise products such as VMotion would be in serious trouble. In the case I quoted we are legally using a valid enterprise licence for the servers.

Posted: 10. Jan 2009, 20:10
by TerryE
I have the signature block "Read the Forum Posting Guide ... Google your Q site:VirtualBox.org or search for the answer before posting" for a reason and I assume that when I answer that the original poster will put 2 and 2 together. If you do google setvdiuuid site:forums.VirtualBox.org then you will find lots of examples. If you search on modifyvm move host or the like, then you will find examples where I have discussed this before.

Forgive me, but I am reluctant to repeat myself for the Nth time because someone hasn't searched for an earlier reply to the same Q.

In this case it really isn't that difficult to do. The script is maybe 10 lines long and takes minutes to write. VMware might be easier, but if you want a decent performing Windows interface then you will need to go out and buy 50 Workstation licences or 1 plus repackaging for VMware player.

However, I do agree that this process could be supported better in VBox.

Re: Moving VM from one host to Another

Posted: 13. Jan 2009, 20:15
by hjacobson
steelej wrote:.....I am now trying out VBox and am very impressed with performance. I have not however found an easy way of running the VMs in such an easy way on several host machines that was so easy on VMWare.....
Steelej,

I presume your host OS's are Windows. There is a straightforward method for moving VMs between Windows hosts. I use this method to - for example - close a VM at work then pick up where I left off at home. I've used this method since VB v1.5.x days. It's been trouble-free and is now routine for me.

The key to the method is to locate the VBox files in one easily portable folder and to keep the VBox files synchronized across all hosts on which you plan to work.

I store my VirtualBox files on the DATA drive D: like so,
D:\.VirtualBox\Machines
D:\.VirtualBox\VDI

The user's VBox configuration is stored in a folder .VirtualBox in the user profile. In Vista it's the path C:\Users\<userID>\.VirtualBox.

On the host machines copy the user's VirtualBox.xml to the target folder, e.g.,
xcopy c:\users\<userID>\.VirtualBox\VirtualBox.xml D:\.VirtualBox\

Remove the user's .VirtualBox folder.

Replace the user's .VirtualBox folder with a Directory Junction:
mklink /J c:\users\<userID>\.VirtualBox D:\.VirtualBox

Do this on every host you plan to use VBox.

Now you may carry the contents of the folder D:\.VirtualBox from host to host without thinking twice.

Harry

P.S. No warranties. I've used this method up to VBox v1.6.6 between XP 32 bit and Vista 32 bit and Vista 64 bit hosts.

P.P.S. I'm preparing to upgrade VBox 1.6.6 to VBox 2.1.0

Posted: 15. Jan 2009, 21:11
by steelej
Thank you for your comments. At least you understand what I am trying to do. The previous response appeared to be for cloning a VM on the same machine, and not for moving one VM from one machine to another.

Unfortunately the command you suggest only works for Vista. I have one Vista and two XP machines.

If I have understood your suggestion it also only works if you are moving ALL your VMs from one machine to another. I have tried this and it was quite easy. I only want to move one and to leave the other (Ubuntu) machines alone.

I have succeded in copying the machone over by hand but it was a multistep process and involved deleting the drive entry in the XML file using Notepad++. Registering the VM, adding the hard drive into the repository and then attaching to the VM. I bit tortuous and potentially error prone. It could be scripted but I am not fluent with Windows scripting and it would take me some time to learn it. Once I have reinstalled Visual Studio (my laptop died) then I could write a C# program I suppose to make it easier but I would have thought that this was an essential feature of virtual machines.

Posted: 16. Jan 2009, 22:23
by hjacobson
steelej,

It works in XP, too. Only you need to use the sysinternals command junction http://technet.microsoft.com/en-us/sysi ... 96768.aspx or equivalent.

You don't need to have all the VMs on all your machines. My inventory of VMs differs from host to host, the 'bookkeeping' got complicated. Disk storage is cheap. I just leave the full compliment of VMs on all the hosts. Less complicated operationally.

I carry around a portable 1.8" 120 GB drive, not much bigger than a stack of credit cards. Much faster than large solid-state USB sticks.

All my VMs are on that drive. If all I'm working with is one particular VM, I use a file synchronizer to update just that one VM.

Anyway, for years I've used SuperFlexibleFileSynchronizer http://www.superflexible.com to do selective synchronization.

Works like a charm.

Harry

P.S. I just migrated from VB 1.6.6 to VB 2.1.0 on two of my computers. One's running Vista Ultimate x64, the other Vista Ultimate x32. No problems. I've another host running XP SP3; I just haven't gotten around to doing the upgrade however I'm confident that, as in the past, there'll be minimal problems.

Posted: 17. Jan 2009, 01:47
by steelej
Thanks once again. I had not noticed that particular sysinternals program. I will look into it when I get the time.

The file syncronisation package looks interesting. I designed a process for syncronising large files over low bandwidth about 3-4 years ago but the need went away and I did not implement it. This program looks broadly similar to the design I had in mind although I was planning on using smaller chunks of data and did not have VM images in mind at the time.