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.

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!

share|improve this question

5 Answers 5

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks for the resource. Now I know what I cannot do. I just need to figure out what to do. Any resources on that? –  Jonathan Hawkes Sep 19 '09 at 22:48

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.
share|improve this answer

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.

share|improve this answer

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?

share|improve this answer

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.

share|improve this answer

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.