0

What are the steps of converting a live server as a XEN guest?

Here's my understanding of the process, please comment if you see any flaws with such thinking.

  • Install a xen guest kernel that would run on my target dom0.

Question: does XEN differentiate kernels by dom0/domU?

  • Backup partitions using dd tool to a safe place.

Here's my current server layout:

/dev/sda1              64G   49G   12G  81% /
tmpfs                 3,9G     0  3,9G   0% /lib/init/rw
udev                   10M   64K   10M   1% /dev
tmpfs                 3,9G     0  3,9G   0% /dev/shm

Question: I only need to dd /dev/sda1 out, right? How can I copy it in a consistent state without turning the machine off, without mounting it as readonly (I assume I'd lose network connectivity by doing so?), without physically being in the data centre to do so.

  • Prepare dom0 with LVM.
  • Create 2 LVs, one for /dev/sda1, one for swap.
  • dd the data in from earlier backups.
  • Boot?

I'm sure I've missed alot.

2
  • Is your live server very busy? Are there times that it is virtually idle, like at night? That would make migration a lot easier.
    – wzzrd
    Jun 15, 2009 at 14:13
  • Very very busy. The reason for this virtualization is a need to implement DRDB/Linux-HA for improved availability. Downtime is potentialy job ending :)
    – Karolis T.
    Jun 15, 2009 at 14:17

2 Answers 2

3

There's a couple of potential pitfalls here. First of all, you mention dd for backups. While dd can be a wonderful tool, it's not an ideal backup tool, and if you're referring to using it to backup a live machine, it's a very poor choice. You're going to have some really badly inconsistent data and may not end up with a working image file.

Also, one note for the future. . . always setup your disk layout with LVM (and leave a few GB unallocated in the Volume Group), as it makes these kinds of situations about a hundred times easier to deal with. If the partitions were logical volumes under LVM, you could snapshot them, and then make use of the snapshot to give you a fairly consistent image.

Now, how critical is it that this box stay up? If you can take it down for a few minutes, there are P2V (Physical to Virtual) converters that you can use to make this transition a lot easier.

What kind of hardware configuration are you dealing with? If you have mirrored disks (RAID1) you might be able to break the mirror, pull a disk, and bring up the yanked disk in a second box. You could then clone that non-production copy.

Another important thing to consider, is what are you using for Xen? Is it RHEL and the Xen that's included? Or is it Citrix XenServer (now free)? This makes a difference as they both expect (by default) a slightly different disk format. Manually building an image for XenServer is a bit more complicated than building one for stock Xen.

It may sound a little unorthodox, but I've actually had better success in this type of situation by doing a simple base Linux install on a separate box, then running rsync from the production box to the new box, and then converting the non-production rsync'ed clone into the Xen domU (I've even had some luck just rsynch'ing from the production box to a Xen domU). Just run rsync (I recommend the options -HavSux) the old box to the new one while it's running, and once the rsync has completed, run rsync again. The first one will take a while to run, and will leave you with a lot of inconsistencies. The second one will run faster and because it only has to pull the changed stuff this time, put things in a more consistent state.

Whether that will be "good enough" for you, with regards to consistency, will depend on your requirements and what applications you're running. For example, if you've got an active database server on the production box, you'd definitely not want to leave rsync'ed file backups as "good enough". Instead, after the second rsync you'd take a database backup using the database tools, and import that on the clone. Or you'd wait to do that final synchronization until you have your xen domU up and running.

Good luck, and plan on a couple of dry runs and a couple more practice runs to get things working smoothly before you go for real.

2
  • Thanks for your detailed answer. I've inherited the server as it is, LVM isn't there for the moment. The machine is Debian Etch, it currently has Xen kernel (previous admin used it to enable support for 8gigs of RAM), so that might be my savior when implementing Xen. I want to build xen dom0, use my ideal-as-possible copy of the live server to create xen domU. I need it to implement replication/HA config, running virtual enables such transitions easier in the future. I like your idea about removing active disk, it has RAID1 with two disks. That's out of the box thinking as they call it.
    – Karolis T.
    Jun 15, 2009 at 15:25
  • Ah, the "joy" of inherited machines. They make our lives so interesting. Jun 15, 2009 at 15:48
1

I recently installed Citrix XenServer 5.0 (free). During the wizard-based setup it asked me if I want to convert the server which i booted with into a DomU. I didn't want to, since the server was empty. But I suggest you give it a shot. XenServer also gives you a nice GUI (windoze) to manage your VMs.

Citrix XenServer 5

1
  • Thanks for your suggestion, though I'm very very cautious about installing anything on that server. Availability and no downtime is a must.
    – Karolis T.
    Jun 15, 2009 at 14:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .