afio: inkrementelles backup möglich?
Danke euch allen für die backup tips. Afio finde ich toll- funktioniert bestens (auch restore ist getestet). Frage: kann man mit afio auch inkrementelle backups machen (ähnlich wie mit tar) indem man ein Datum angibt, ab dem die geänderten files ins archive reingenommen werden sollen? danke bestens christoph
Christoph Lehmann
Danke euch allen für die backup tips. Afio finde ich toll- funktioniert bestens (auch restore ist getestet). Frage: kann man mit afio auch inkrementelle backups machen (ähnlich wie mit tar) indem man ein Datum angibt, ab dem die geänderten files ins archive reingenommen werden sollen?
Hallo Christoph, Afio selbst hat keine Optionen für "inkrementelles Backup". Ich habe mir aber selber ein Script rund um afio geschrieben, das so aussieht: --8<---------------cut here---------------start------------->8--- #!/bin/bash #------------------------------------------------ # rkbackup - Do automated backups with cron # # Version: $Revision: 1.3 $ # Date: $Date: 2004/04/29 05:34:06 $ # Author: Rainer.Koenig@fujitsu-siemens.com # # Revision history: # ----------------- # $Log: rkbackup,v $ # Revision 1.3 2004/04/29 05:34:06 rainer # Timestamps have to be stored in /var/local/rkbackup by default # # Revision 1.2 2004/04/29 05:24:33 rainer # Added usage of /etc/rkbackup.exclude-patterns so that certain files can be # excluded from the backup (e.g. Postgres databases or Browser cache files) # function usage { echo Usage: echo rkbackup level echo echo This script does a backup like configured in /etc/rbackup.conf echo and uses a level from 0-9 for that backup. The levels are echo "according to the O\'Reilly-Book \"Unix Backup & Recovery\" and mean:" echo "0 = full backup" echo "1..9 = incremental backup of the files that have changed since" echo " last backup of the lower levels" } # check for plausibility # # Command option parsing if [ $# = 0 ]; then echo Error: You didn\'t specify a backup level! echo usage exit 1 fi if [ $# -gt 1 ]; then echo Error: You specified too much parameters echo usage exit 2 fi backuplevel=$1 if [ $backuplevel != 0 ]; then if [ $backuplevel -lt 1 ] || [ $backuplevel -gt 9 ]; then echo Error: Backuplevel not in the range [0..9] echo usage exit 3 fi fi WHATTOBACKUP="/home" WHERETOBACKUP="/tmp" TIMESTAMPS="/var/local/rkbackup" # Source the configuration file . /etc/rkbackup.conf if [ ! -d "$WHERETOBACKUP" ] || [ ! -w "$WHERETOBACKUP" ]; then echo "Error: The directory $WHERETOBACKUP for storing the" echo "backups doesn't exist or you don't have write permissions for it." exit 4 fi if [ ! -d "$TIMESTAMPS" ] || [ ! -w "$TIMESTAMPS" ]; then echo "Error: The directory $TIMESTAMPS for storing the" echo "timestamps doesn't exist or you don't have write permissions for it." exit 5 fi # If we are here at least all the parameters seem to make sense # Setting the timestamps now, that means for example: # A level 3 backup sets the timestamps of the level 4..9 to the acutal date let i=$backuplevel+1 while [ $i -lt 10 ]; do tsname=${TIMESTAMPS%/}/timestamp.level-$i touch $tsname let i=i+1 done # Now do the backup with afio, my favorite backup engine # if it is a level 1-9 backup limit the search to files modfied since # the timestamp of that level was last changed if [ $backuplevel -gt 0 ]; then timesearch="-newer ${TIMESTAMPS%/}/timestamp.level-$backuplevel" fi backupdate="`date +%Y-%m-%d-%H%M%S`" backupname=${WHERETOBACKUP%/}/backup-$backupdate-$backuplevel.afio # invoke the backup engine (afio) find $WHATTOBACKUP $timesearch | grep -v -f /etc/rkbackup.exclude-patterns | afio -o $backupname --8<---------------cut here---------------end--------------->8--- Damit kannst Du Backup-Level definieren und somit so was wie ein inkementelles Backup realisieren. Mein Konfig-File hier auf der Arbeit sieht so aus: --8<---------------cut here---------------start------------->8--- # Configuration file for rkbackup # What directories should be backuped? # Put the full path names here spearated by space WHATTOBACKUP="/home /etc /var /root /usr/local" # Where should the backup be stored? WHERETOBACKUP="/server/share" # Direcotry for the timestamps? # TIMESTAMPS="/var/local/rkbackup" --8<---------------cut here---------------end--------------->8--- D.h. ich sichere alles was in "/home /etc /var /root und /usr/local" steht. Gesichert wird auf /server/share (daheim geht das ins /tmp und die afio-Datei landet dann auf CD). In /var/local/rkbackup stehen die Timestamps anhand derer die Levels entscheiden welche Datei "neuer" ist. Und damit ich nicht solche Dinge wie Browser-Caches sichere gibt es noch exclude-patterns: --8<---------------cut here---------------start------------->8--- ^/var/lib/postgres/data \.mozilla/.*/Cache \.phoenix/.*/Cache \.galeon/.*/Cache \.firefox/.*/Cache \.netscape/cache ^/var/run ^/var/cache home/rainer/public_html/LinuxTag2004/conference-dvd --8<---------------cut here---------------end--------------->8--- D.h. keine Sicherung der offenen Postgres-Datenbank. :-) Dann keine Sicherung von Caches und /var/run was sowieso beim Reboot niedgermeuchelt wird. Und das per loop-device gemountete Image der LinuxTag-DVD sichere ich natürlich auch nicht. :-) Hier im Büro läuft alles automatisch per Datei in cron.d --8<---------------cut here---------------start------------->8--- # Scheduled backups # # m h dom mon dow user command # # Do a full backup every Friday at 22:00 0 22 * * 5 root /usr/local/bin/rkbackup 0 # Do an incremental backup every day for monday - friday at 17:30 30 17 * * 1 root /usr/local/bin/rkbackup 1 30 17 * * 2 root /usr/local/bin/rkbackup 2 30 17 * * 3 root /usr/local/bin/rkbackup 3 30 17 * * 4 root /usr/local/bin/rkbackup 4 30 17 * * 5 root /usr/local/bin/rkbackup 5 # Tidy up the backup directory on the server ever tuesday morning at 5:00 0 5 * * 2 root /usr/local/bin/rkclean # Do a dump of my databases every day at 16:00 0 16 * * * postgres /usr/bin/test -x /usr/lib/postgresql/bin/pg_dump && /usr/lib/postgresql/bin/pg_dump -Ft -b -o wiki >/var/lib/postgres/dumpall/wiki/wiki.tar--8<---------------cut here---------------end--------------->8--- rkclean ist ein Srkipt das einfach alte afio-Dateien vom Server löscht, damit dieser nicht "überläuft". Dieses automatisierte Backup hat mir hier auf der Arbeit schon oft geholfen um "versehentlich niedergestreckte Dateien" schnell wieder herzustellen. Und daheim läuft es mit fast gleichen Parametern, nur gibts da keinen Netzwerkserver, daher einmal pro Woche ein Level-0-Backup und dann ab auf eine CD mit dem afio-File. Ich könnte natürlich auch täglich dann Level 1-x fahren um alle täglichen Änderungen zu sichern. Aber daheim kann ich notfalls einen Datenverlust von einer Woche noch verkraften, hier in der Arbeit ist tägliche Sicherung für mich einfach lebensnotwendig. Und ich habe wie gesagt schon viel Arbeit gespart weil eben eine Datensicherung da ist. :-) Das Konzept der Levels ist im Buch "Unix Backup & Recovery" vom O'Reilly Verlag sehr gut beschrieben. Da findest Du auch mehr Infos zum Thema Datensicherung. HTH & schönes Wochenende Rainer -- Dipl.-Inf. (FH) Rainer Koenig Project Manager Linux Fujitsu-Siemens VP BC E SW OS Phone: +49-821-804-3321 Fax: +49-821-804-2131
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/03/2004 03:43 PM, Christoph Lehmann wrote:
Danke euch allen für die backup tips. Afio finde ich toll- funktioniert bestens (auch restore ist getestet). Frage: kann man mit afio auch inkrementelle backups machen (ähnlich wie mit tar) indem man ein Datum angibt, ab dem die geänderten files ins archive reingenommen werden sollen?
Vielleicht passt flexbackup dazu. Es dient als Frontend (aber kein GUI ;-)) für unterschiedliche Backup- und Komprimierungsprogramme. Du kannst Dich z.B. für tar+bz2 oder afio+lzo entscheiden, flexbackup verwalten dann volle, differentielle und inkrementelle Backups: http://www.flexbackup.org/
danke bestens
christoph
HTH - -- Konstantin www.konmal.de : GPG key and more SUSE RPMS Get your SUSE RPMs at links2linux.de / packman.links2linux.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBOLKboJMoTQilaMYRAihTAJ4/QDrODXdFkD2xuH8h8oKHqpXTqACfYKSp w2WpOpn2mYHoO2VKTepfv+g= =1bAO -----END PGP SIGNATURE-----
participants (3)
-
Christoph Lehmann
-
Konstantin
-
Rainer Koenig