WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

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

To: Lists <lists@xxxxxxxxxxxxx>
Subject: Re: [Xen-users] Xen backups using LVM Snapshots
From: Mike Lovell <mike@xxxxxxxxxxxx>
Date: Fri, 17 Oct 2008 11:50:55 -0600
Cc: xen-users@xxxxxxxxxxxxxxxxxxx, Javier Guerra Giraldez <javier@xxxxxxxxxxx>
Delivery-date: Fri, 17 Oct 2008 10:53:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <15237065.721224234836337.JavaMail.root@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <15237065.721224234836337.JavaMail.root@xxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.17 (X11/20080922)
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