I have a XenServer 5.6 Free setup with 5 VMs (Windows and Linux) using about 1.5TB of directly attached storage.

Because our virtualisation needs have grown a bit, we currently are preparing a faster XenServer 6.0 Free machine with more RAM and a more storage. Again, directly attached disks.

How can I migrate the VMs between XenServer machines?

I don't need to keep the machines up and running during migration, but using VM export and import would definitely take too long.

Would making a VM with the same configuration on new host and dd'ing the LVM volume over network be the only quick and least painful solution? Are there any "gotchas" I should look out for when doing something like this? The old machine has an AMD Phenom II, the new has Intel Xeon E5 CPUs.


I think that the fastest way to do the migration is to use a disk imaging software. In the company i work almost all the machines are hosted in XEN and VMWARE servers. We are facing this situation very often. We use Active@ Boot Disk that is very fast and reliable. At first boot with the cd in the server you want to transfer and backup to a network folder your server image. Then at the new XEN server, boot and restore that image to the new server. I hope this help.

| improve this answer | |
  • If there's a vanilla VM (no snapshots) then dd in XenServer Dom0 works, but it stops working as soon as the VM has any kind of snapshots. Looks like booting some kind of LiveCD in the VM and imaging from there is best idea. Now I just need to find LiveCD that will work without problems in XenServer VMs prepared for Windows... – Hubert Kario Jun 13 '12 at 15:14
  • I use Active@ Boot Disk. I also use a lot CloneZilla. – Kalatzis Stefanos Jun 13 '12 at 15:48
  • 1
    SystemRescueCD doesn't start, CloneZilla (1.2.12-60) doesn't like xvda block device name. Ironically, Ubuntu 12.04 worked without a problem... I'm dd-ing the disks now. – Hubert Kario Jun 18 '12 at 14:09
  • It worked with Windows 2008 R2, I just had to restart it few times for all drivers to install (and upgrade XenServer tools from 5.6 to 6.0 but that's obvious). – Hubert Kario Jun 19 '12 at 18:28
  • Yes it works also for linux and windows servers. I use this a long time. Ubuntu and dd is very nice for cloning. – Kalatzis Stefanos Jun 20 '12 at 6:32

Taking the Logical Volume and copying it to the remote host works. But it takes time. And it's a waste of time if the partition isn't full. Especially if its a big partition since unused space will be copied as well.

Im using xen on debian, but i believe it's generic enough for other setups

When I move my xen machines i do this:

  • shut down the vm
  • mount the vm localy in read only (nice to be safe)
  • create an new LVM for disk/swap on the destination machine
  • create filesystem and swap on the LVMs
  • mount the filesystem
  • copy xen config file to the new xen DomU
  • rsync -avrplEHXgo --numeric-ids --exclude=/mnt/ --exclude=/proc/ --exclude=/dev/ --exclude=/tmp/ from-source-machine to destination-machine
  • on the destination, create mnt, proc, dev , swap with the proper permissions. unmount the file system

and you should be ready to go

| improve this answer | |
  • That will work, for Linux guests. I have Windows guests too... – Hubert Kario Jun 11 '12 at 22:03

In the interest of minimizing downtime, you can create a snapshot. Then you can export it, move it and import it on the new machine.

| improve this answer | |
  • VMs with snapshots on XenServer are basically "unmovable" using simple dd... XenServer doesn't use LVM snapshots for snapshotting – Hubert Kario Jun 13 '12 at 15:11
  • I may have been misunderstood. Using XenCenter, create a snapshot of the machine. Then right-click on the snapshot, select "Export To File" and import this XVA file as a new machine on the destination host. – Jim Herrick Jun 13 '12 at 19:44
  • That's exactly what I don't want to do. Moving a 1TB VM this way will take ages. Sure, the VM will stay up, but then after starting it on new server, I'll have old state, not a good thing for a DB server... – Hubert Kario Jun 14 '12 at 13:25

It's been a while since using xen but .. what if you booted both xenservers up using a live distro e.g. parted magic

enable samba sharing and copy the virtual hard disks directly across .. stick a nice gigabit (or higher) switch in the middle and you'll be done in no time at all!

Then just import the config files from the xenserver menu?

| improve this answer | |
  • why the negative vote?!!! – Rhys Evans Jun 12 '12 at 0:07
  • 2
    I guess because there are much better solutions than samba shares. But meh, whoever downvotes without commenting is a jerk – miniBill Jun 14 '12 at 9:35
  • This will move the XenServer installation between hosts, not only the VMs. – Hubert Kario Jun 14 '12 at 13:29
  • well no.. you'd only transfer the vhd's or what ever not the entire hard disk .. wouldnt have recommended it otherwise and my answer very similar to one above ... i bet it was him .. sabotage! – Rhys Evans Jun 14 '12 at 22:58
  • Answers are sorted by score, not by the date. Saying "one above" doesn't refer to any particular post, use login or permalink. Besides, it still isn't better than dd from Dom0, and it introduces downtime for all the VMs that are not migrated at the same time. – Hubert Kario Jun 15 '12 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.