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] Best practice to backup dom0 and all domU's

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] Best practice to backup dom0 and all domU's
From: Andris <andris@xxxxxxxx>
Date: Tue, 25 Mar 2008 17:29:25 +0200
Delivery-date: Tue, 25 Mar 2008 08:29:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1206450906.21629.18.camel@xxxxxxxxxxxxxxxxxxx>
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/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <47E8F5DE.8030803@xxxxxxxxxxxx> <47E8EE19.6010602@xxxxxxxx> <1206450906.21629.18.camel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.6 (X11/20070814)
Tiago Cruz wrote:
> Hello Andris
>
> On Tue, 2008-03-25 at 14:20 +0200, Andris wrote:
>
>   
>> I have Dom0 with md (software mirror) and lvm on top.
>> Nightly I make lvm snapshot for each DomU (make sure that it is large
>> enough not to overfill while doing backup).
>>     
>
> Did you get the snapshot with domU running?
>
>
>   
>> Then I export those lvm snapshots to dedicated backup DomU which boots
>> on and after backup job shuts down itself.
>> Then remove snapshots.
>>     
>
> Sounds like graceful! Can you show your script for us, please?
>
> Thanks
>   

1. Of course, thats for snapshots are supposed for.
2. It is shame for me show my scripting (hard coded paths, etc. not
useful for wide usage, but just for my own configs ), because I am bad
shell script writer, but idea is:
Config file where I put which volumes to backup and desired snapshot
prefix name for each
Then I put manually those snapshot names into backup DomU xen config
file as disk drives.
So there are 3 scripts, one for creating, one for removing lvm snapshots
and one for launching backup server (complicated bacula config then
within backup server itself). And two cron jobs for launching backup
nightly, and removing snapshots then.


This is for creating snapshots, of course it is far from perfect shell
scripting, but idea can be clear:
#################################################################
#!/bin/sh

#script dir
SDIR=/root/scripts/lvm_backup

#test if backup server is already started, backup server DomU name
should be "backup"
TESTBAK=`/usr/sbin/xm list | grep backup | cut -b 1-8`

if [ $TESTBAK ]
then

exit 0

else
        # this is status log to avoid snapshot removing from cron while
script is just started, but not finished
        echo > $SDIR/status.log 1


        VOL=VOL
        NAME=NAME

        backup=_snap

## loop for doing snapshots, for me is enough 22
        for ((  i = 10 ;  i <= 22;  i++  ))
        do

        CUR_VOL=$VOL$i
        CUR_NAME=$NAME$i

        a=`cat  $SDIR/config.volumes | grep $CUR_VOL | cut -b 7-200`
        b=`cat  $SDIR/config.volumes | grep $CUR_NAME | cut -b 8-200`

        if [ $a ]
        then
        ##here we make snapshots
        /usr/sbin/lvcreate -L2G -s -n $b$backup $a
        else
        break
        fi
        sleep 5
        echo > $SDIR/status.log 0
        done


fi
#####################################################################


As considering backup server itself, as I wrote, it is complicated
bacula setup with TLS encryption for remote clients and storage, and no
encryption for a local storage (big sata disk on the same machine(Dom0)
exported as a physical device to backup DomU). This approach allows to
use the same backup server (cloned) for all my clients backups - once
set up, and use for all xen servers.

andris

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