Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

4 Answers 4

up vote 2 down vote accepted
+50

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.

share|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
add comment

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.

share|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
add comment

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

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

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?

share|improve this answer
    
why the negative vote?!!! –  Aceth 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! –  Aceth 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
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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