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.

  • 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... Jun 13 '12 at 15:14
  • I use Active@ Boot Disk. I also use a lot CloneZilla. 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. 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). 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. 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 fully utilized Especially if its a big partition as unused space will be copied as well.

I'm using Xen on Debian, but it should be generic enough for other set-ups

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 file-system and swap on the LVMs
  • Mount the file-system
  • 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 destination, create mnt, proc, dev , swap with the proper permissions. un-mount the file-system

and you should be ready to go

  • That will work, for Linux guests. I have Windows guests too... 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.

  • VMs with snapshots on XenServer are basically "unmovable" using simple dd... XenServer doesn't use LVM snapshots for snapshotting 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. 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... 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?

  • 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. 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. 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.