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
|