Your search query "linkto:"XENBackup"" didn't return any results. Please change some terms and refer to HelpOnSearching for more information.
(!) Consider performing a full-text search with your search terms.

Clear message
Italiano English
Edit History Actions


Script per backuppare una macchina xen, comprimere le cartelle "importanti" e mandarle in rsync "furbo" su una macchina remota.

LVNAME=ale #logica volume name
VGNAME=birra #virtual group name #name of the host machine to backup #name of the machine where we want to upload the backup
BACKUP_DIR=/home/lorenzo/ale #backup dir where we put tar.gz files
DIRS="home var" #dirs to backup
mkdir -p /backup

ssh root@$HOST "mkdir -p /root/backup/; mysqldump -p$MYSQLPASS --all-databases | bzip2 -c > /root/backup/norimberga-alldb-`date -I`.sql.bz2"

# svn, hg backup here

# create a snapshot

lvcreate -L20G -s -n $LVNAME\_snap  /dev/$VGNAME/$LVNAME
mkdir -p /mnt/$LVNAME\_backup
mkdir -p /backup/$LVNAME
mount /dev/$VGNAME/$LVNAME\_snap /mnt/$LVNAME\_backup

# we use a rsync friendly gzip
# more details to
cd /mnt/$LVNAME\_backup
tar c --use-compress-program /usr/local/bin/rgzip -vf /backup/$LVNAME/$LVNAME`date -I`.tar.gz2 $DIRS

#rsync with the backup machine

rsync -avz -e ssh /backup/$LVNAME/$LVNAME`date -I`.tar.gz2 $BACKUP_USER@$BACKUP_HOST:$BACKUP_DIR

#umount and destroy snapshot

umount /mnt/$LVNAME\_backup
lvremove /dev/$VGNAME/$LVNAME\_snap