[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Xen backups using LVM Snapshots



Lists wrote:
> I ran a very quick test... here is my result
>
> DomU # while [ 1 -ne 2 ]; do echo `date` >> /root/test; done &
>
> Dom0 # lvcreate -L +1G -s -n s_web.test.com-disk /dev/vm/web.test.com-disk
>
> DomU - stopped script and shutdown system.
>
> Dom0 - Edit cfg file
>   replace
> disk        = [
>                   'phy:/dev/vm/web.test.com-swap,sda1,w',
>                   'phy:/dev/vm/web.test.com-disk,sda2,w',
>               ]
>
>   with
> disk        = [
>                   'phy:/dev/vm/web.test.com-swap,sda1,w',
>                   'phy:/dev/vm/s_web.test.com-disk,sda2,w',
>               ]
>
> DomU - Boot
> [...]
> Begin: Running /scripts/local-premount ...
> Done.
> EXT3-fs: INFO: recovery required on readonly filesystem.
> EXT3-fs: write access will be enabled during recovery.
> kjournald starting.  Commit interval 5 seconds
> EXT3-fs: recovery complete.
> EXT3-fs: mounted filesystem with ordered data mode.
> [...]
>
> Javier is right!
>
> --
> eco
>   
I think we are talking about two similar but slightly different
procedures. On my script, I do not stop and start the DomU at all. The
DomU is running the whole time with the LVM volume that it was
originally assigned. Here is what I run completely inside the Dom0 and I
don't get FS errors (names edited to generic stuff and very verbose):

#!/bin/sh
echo "creating lvm snapshot and mounting..."
lvcreate -L50G -s -n DomU-snapshot /dev/VG0/DomU
mount /dev/VG0/DomU-snapshot /mnt
echo "taring filesystem...."
cd /mnt
pwd
tar jcvf /data/DomU-backup-`date +%Y-%m-%d`.tar.bz2 *
echo "unmounting and removing snapshot..."
cd /root
umount /mnt
lvremove -f /dev/VG0/DomU-snapshot
echo "all done!!!"

My guest is using ext3 and the mount completed without giving an error
on the terminal. But checking dmesg did show some errors. And, I am able
to read the data off of the disk. So I think I see what you guys are
saying about snapshotting making a snapshot of the still-mounted volume.
Backups made using this method could not guarantee a good backup for
files that were open at the time the snapshot was made. Doing a backup
this way though would be equivalent to doing a backup right after a
machine crashes. (I guess some data is better than no data).

One way around this that results in minimal downtime for the guest is to
do something like

- Shutdown the guest VM
- create an LVM snapshot
- start the guest VM still using the original LVM volume
- make a backup using the snapshot volume
- remove the LVM snapshot

The guest would only see a down time about equal to just a standard
reboot. You guys were right on the filesystem issues. But I still think
LVM snapshots can be a valid way of doing a backup if precautions are
taken. So there are my thoughts on it.

Mike

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.