Differenze tra le versioni 2 e 3
Dimensione: 2311
Commento:
|
← Versione 3 del 2009-03-17 00:52:24 ⇥
Dimensione: 1429
Commento:
|
Le cancellazioni sono segnalate in questo modo. | Le aggiunte sono segnalate in questo modo. |
Linea 4: | Linea 4: |
Appunti: | |
Linea 8: | Linea 7: |
lvcreate -L20G -s -n test2 /dev/jenna/briana mount /dev/jenna/test2 /mnt/test2 #tar -jcpvf /sip_tar/sip_snapshot`date +%Y%m%d`.tar.bz2 /sip_backup #umount /sip_backup/ #lvremove /dev/secondo/sip_snapshot |
|
Linea 14: | Linea 8: |
svnadmin -q dump /var/svn/ninuxdeveloping | bzip2 -c > ninuxdeveloping`date -I`.dump.bz2 mysqldump -pmysqlpassword --all-databases | bzip2 -c > AMD64-norimberga`date -I`.sql.bz2 cd /var tar -jcf /root/backup/www`date -I`.tar.bz2 www cd /var/lib/ tar -jcf /root/backup/trac`date -I`.tar.bz2 trac ssh saverio@backup.server.it "mv /home/saverio/norimbergabackup/*.bz2 /home/saverio/norimbergabackup/temp/" scp /root/backup/* saverio@backup.server.it:/home/saverio/norimbergabackup/ ssh saverio@backup.netgroup.uniroma2.it "rm /home/saverio/norimbergabackup/temp/*" echo Backup Norimberga `date -I` tutto OK }}} Bozza script da far girare sulla dom0.<<BR>> Requisiti: rsync su dom0 e su macchian di backup {{{ #!/bin/bash LVNAME= #logica volume name VGNAME= #virtual group name HOST= #name of the host machine to backup BACKUP_HOST= #name of the machine where we want to upload the backup BACKUP_USER= BACKUP_DIR = #backup dir where we put tar.gz files DOM0_HOST= #hostname/IP of DOM0 (THIS machine) DIRS= #dirs to backup # --------------- # |
LVNAME=ale #logica volume name VGNAME=birra #virtual group name HOST=www.myhost-I-want-to-backup.org #name of the host machine to backup BACKUP_HOST=backup.machine.it #name of the machine where we want to upload the backup BACKUP_USER=lorenzo BACKUP_DIR=/home/lorenzo/ale #backup dir where we put tar.gz files DIRS="home var" #dirs to backup MYSQLPASS=mypass #--------------------------------------------------# |
Linea 51: | Linea 19: |
# dump database in the running machine ssh root@HOST "mkdir -p /root/backup/; mysqldump -pmysqlpassword --all-databases | bzip2 -c > /root/backup/norimberga-alldb-`date -I`.sql.bz2" |
ssh root@$HOST "mkdir -p /root/backup/; mysqldump -p$MYSQLPASS --all-databases | bzip2 -c > /root/backup/norimberga-alldb-`date -I`.sql.bz2" |
Linea 58: | Linea 23: |
# we use a rsync friendly gzip # more details to http://svana.org/kleptog/rgzip.html tar c --use-compress-program c/rgzip -vf /backup/$(LVNAME)`date -I`.tar.gz2 $(DIRS) # rsync with the backup machine ssh root@BACKUP_HOST "./rsync -e ssh -b -v --stats $(DOM0_HOST):/backup/$(LVNAME)`date -I`.tar.gz2 $(BACKUP_DIR)" |
|
Linea 70: | Linea 26: |
lvcreate -L20G -s -n $(LVNAME)_snap /dev/$(VGNAME)/$(LVNAME) mkdir -p /mnt/$(VGNAME)_backup mount /dev/$(VGNAME)/$(LVNAME)_snap /mnt/$(VGNAME)_backup |
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 http://svana.org/kleptog/rgzip.html 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 |
Linea 76: | Linea 43: |
umount /mnt/$(VGNAME)_backup lvremove /dev/$(VGNAME)/$(LVNAME)_snap |
umount /mnt/$LVNAME\_backup lvremove /dev/$VGNAME/$LVNAME\_snap |
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 HOST=www.myhost-I-want-to-backup.org #name of the host machine to backup BACKUP_HOST=backup.machine.it #name of the machine where we want to upload the backup BACKUP_USER=lorenzo BACKUP_DIR=/home/lorenzo/ale #backup dir where we put tar.gz files DIRS="home var" #dirs to backup MYSQLPASS=mypass #--------------------------------------------------# 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 http://svana.org/kleptog/rgzip.html 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