3

The host machine is running CentOS 5.3 and using LVM to create Logical Volumes (LVs) and to allow live snapshots to be taken of those LVs. My thought was to store all of the image files for the Xen underpriviledged domains (domU) in a single LV and periodically take a snapshot of that LV and copy the disk images out of the snapshot in order to make a live backup of these systems. Is this doable? Is there a better way?

Thanks!

0

5 Answers 5

2

Real "live" backups aren't exactly doable.

In theory, the best you can get - when using LVM - is a few seconds of "pause" time, which should be fine: a domU would need to - sync it's disks, pause/suspend, backup data, and resume.

However, there are a few "gotchas" with this approach (as opposed to just shutting down the machine) that need to be addressed.

The main issue is the consistency of the domU filesystem - have a look at thoughts-xen-filesystem-configuration-regard-backups for a more complete explanation.

1
  • Thanks for the resource. Now I know what I cannot do. I just need to figure out what to do. Any resources on that? Sep 19, 2009 at 22:48
3

Probably the best way is to take a file-level backup of each domU, rather than messing with LV snapshots. Or, a file-level backup of a snapshot.

But if you'd rather have block-level backup of your domUs -- storing all domU disks as files on one LV is doable, and is also something I considered, but I decided against it and going with what your server is already configured for- one domU per LV for two reasons:

  1. Creating new domU image files take forever, unless you're using sparse files. Using LVM to create and delete LVs are instantaneous. With sparse files it is possible to run out of disk space.
  2. One snapshot for all domUs can eat up lots of snapshot space. While you're waiting for backup to finish, all the changes do your running domUs will eat up your snapshot space. What I do is just take a snapshot of a domain at a time and then perform backup.
2

I've built a script to do something different than you explained

1) "xm save domain domain.mem.backup" (with pause) 2) LVM snapshot 3) "xm restore domain domain.mem.backup" 4) "dd" of the LVM snapshot to domain.dd.backup 5) delete LVM snapshot

To restore : 1) Create a LVM LV for the domain 2) "dd" from domain.dd.backup to this LV 3) "xm restore domain domain.dd.mem"

The domain is resume with the state of the memory he had when it have been backuped. Then if there are some data not writen, it will do it just after restore... like it had never been stopped.

0

Why wouldn't you just use a separate LV for each VM, then snapshot, mount, and copy/rsync the contents of each VM as required for backup purposes?

0

It depends on the quality of the backup you want and the downtime you could bear. I would say, if you want a complety consistent backup you have to shutdown the domUs (if Win oder Linux domUs, other OSs may vary).

If you just want some data backuped, you could give the "xm pause" command a chance. Just run "xm pause domain", make your snapshot, and go on with "xm unpause domain". But you are risking a data loss, on the filesystem layer and also on the data that resists in the unflushed buffers of applications (e.g. samba).

Since there is no communication system (for FS and buffer sync) between the dom0 storage layer and the domU kernel and applications, a shutdown of the domU is the only way to achieve consistent backups.

You must log in to answer this question.

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