project:rsnapshot-backup
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| project:rsnapshot-backup [2017/06/27 16:40] – 95.208.69.26 | project:rsnapshot-backup [2018/01/23 14:04] (current) – [show how much time individual parts of the backup take] 88.65.214.4 | ||
|---|---|---|---|
| Line 104: | Line 104: | ||
| as Extended Attributes. | as Extended Attributes. | ||
| - | Rsync needs '' | + | Rsync needs '' |
| These parameters have to be added per backup job. | These parameters have to be added per backup job. | ||
| The copy & paste code below adds these. It extends | The copy & paste code below adds these. It extends | ||
| - | existing lines beginning with '' | + | existing lines beginning with '' |
| containing '' | containing '' | ||
| If these comments don't exist the code throws an error leaving it to the admin to insert the line into the file. | If these comments don't exist the code throws an error leaving it to the admin to insert the line into the file. | ||
| Line 166: | Line 166: | ||
| done | done | ||
| </ | </ | ||
| + | |||
| + | ==== restore from backups created using " | ||
| + | |||
| + | The situation: | ||
| + | * '' | ||
| + | * notably **symlinks** are stored as **files** with the file content being the original link destination and additional metadata is stored inside an extended attribute e.g. '' | ||
| + | |||
| + | To restore contents from this kind of backup you again need '' | ||
| + | * use **'' | ||
| + | * use **'' | ||
| + | |||
| + | ==== special considerations using a secondary backup server ==== | ||
| + | |||
| + | If you want a secondary backup server replicating the daily.0 backups from | ||
| + | the primary backup server (which would be the one fetching the data from the | ||
| + | backup clients) there are some things to consider on the secondary (ternary, etc) system(s): | ||
| + | |||
| + | * the default option **'' | ||
| + | * the conversion of critical metadata (xattrs, etc.) should have already been done by the primary backup server. So '' | ||
| + | * the converted metadata has to be replicated which is not done per default rsync/ | ||
| + | * '' | ||
| + | * long story short: on a subsequent backup server use '' | ||
| ==== draw a plot showing disk usage of a job ==== | ==== draw a plot showing disk usage of a job ==== | ||
| Line 360: | Line 382: | ||
| </ | </ | ||
| + | ==== show all error messages from last (daily) run ==== | ||
| + | |||
| + | < | ||
| + | # extract timestamp from crontab file | ||
| + | HHMM=$( | ||
| + | awk '$1 ~ /^[0-9]+$/ && $2 ~ /^[0-9]+$/ && | ||
| + | $3 ~ / | ||
| + | $5 ~ / | ||
| + | $7 == "/ | ||
| + | $8 == " | ||
| + | $9 == " | ||
| + | ) | ||
| + | # assume the backup run started yesterday | ||
| + | CDATE=$( date -d " | ||
| + | # create a file with mtime for comparision | ||
| + | CFILE=$( mktemp / | ||
| + | touch -d " | ||
| + | FILES=$( | ||
| + | find / | ||
| + | ) | ||
| + | for f in $FILES; do | ||
| + | echo "### $f ####" | ||
| + | cat $f | ||
| + | done | less | ||
| + | # clean up | ||
| + | rm " | ||
| + | </ | ||
| + | |||
| + | ==== show how much time individual parts of the backup took ==== | ||
| + | |||
| + | **rsnapshot-backup-timings** | ||
| + | < | ||
| + | # | ||
| + | |||
| + | |||
| + | use strict; | ||
| + | use POSIX; | ||
| + | |||
| + | sub WAIT_FOR_RM | ||
| + | sub WAIT_FOR_MV0 | ||
| + | sub WAIT_FOR_MVL | ||
| + | sub WAIT_FOR_CP | ||
| + | sub WAIT_FOR_RSYNC () { 5 }; | ||
| + | sub WAIT_FOR_TOUCH () { 6 }; | ||
| + | sub WAIT_FOR_END | ||
| + | |||
| + | sub decode_date ($) { | ||
| + | my ( $d ) = @_; | ||
| + | my ( $dd, | ||
| + | my $m = {qw{Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12}}-> | ||
| + | # print "$d = ( $yyyy, | ||
| + | my $e = POSIX:: | ||
| + | # print scalar localtime $e," | ||
| + | return $e; | ||
| + | } | ||
| + | |||
| + | FILE: for my $filename ( @ARGV ) { | ||
| + | open F,$filename or do { | ||
| + | warn " | ||
| + | next FILE; | ||
| + | }; | ||
| + | |||
| + | my $state = WAIT_FOR_RM; | ||
| + | my $d_rm; | ||
| + | my $d_mv0; | ||
| + | my $d_mvl; | ||
| + | my $d_cp; | ||
| + | my $d_rsync; | ||
| + | my $d_touch; | ||
| + | |||
| + | LINE: while (my $l = <F>) { | ||
| + | $state eq WAIT_FOR_RM and do { | ||
| + | if ( $l =~ m# | ||
| + | my $d = $1; | ||
| + | $d_rm = decode_date( $d ) ; | ||
| + | $state = WAIT_FOR_MV0; | ||
| + | } | ||
| + | next LINE; | ||
| + | }; | ||
| + | $state eq WAIT_FOR_MV0 and do { | ||
| + | #dev# print "L: $l"; | ||
| + | if ( $l =~ m# | ||
| + | my $d = $1; | ||
| + | $d_mv0 = decode_date( $d ) ; | ||
| + | $state = WAIT_FOR_CP; | ||
| + | } | ||
| + | next LINE; | ||
| + | }; | ||
| + | $state eq WAIT_FOR_CP and do { | ||
| + | #dev# print "L CP: $l"; | ||
| + | if ( $l =~ m# | ||
| + | my $d = $1; | ||
| + | $d_mvl = decode_date( $d ) ; | ||
| + | $state = WAIT_FOR_CP; | ||
| + | } elsif ( $l =~ m# | ||
| + | my $d = $1; | ||
| + | $d_cp = decode_date( $d ) ; | ||
| + | $state = WAIT_FOR_RSYNC; | ||
| + | } | ||
| + | next LINE; | ||
| + | }; | ||
| + | #dev# print "L: $l"; | ||
| + | $state eq WAIT_FOR_RSYNC and do { | ||
| + | if ( $l =~ m# | ||
| + | my $d = $1; | ||
| + | $d_rsync = decode_date( $d ) ; | ||
| + | $state = WAIT_FOR_TOUCH; | ||
| + | } | ||
| + | next LINE; | ||
| + | }; | ||
| + | $state eq WAIT_FOR_TOUCH and do { | ||
| + | #dev# print "L: $l"; | ||
| + | if ( $l =~ m# | ||
| + | my $d = $1; | ||
| + | $d_touch = decode_date( $d ) ; | ||
| + | $state = WAIT_FOR_END; | ||
| + | } | ||
| + | last LINE; | ||
| + | }; | ||
| + | } # / | ||
| + | close F; | ||
| + | if ( ! defined $d_touch or ! defined $d_rsync or ! defined $d_cp or ! defined $d_mv0 or ! defined $d_rm ) { | ||
| + | warn " | ||
| + | next FILE; | ||
| + | } | ||
| + | |||
| + | #dev# print " | ||
| + | #dev# print " | ||
| + | #dev# print " | ||
| + | #dev# print "RSYNC ", | ||
| + | #dev# print "TOUCH ", | ||
| + | |||
| + | printf "%s %d T %d RM %d %0.2f MV %d %0.2f CP %d %0.2f RSYNC %d %0.2f\n", | ||
| + | $filename, | ||
| + | $d_rm, | ||
| + | $d_touch - $d_rm, | ||
| + | $d_mv0 | ||
| + | $d_cp - $d_mv0, | ||
| + | $d_rsync - $d_cp, | ||
| + | $d_touch - $d_rsync, ( $d_touch - $d_rsync ) * 100 / ( $d_touch - $d_rm ), | ||
| + | ; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Usage per backup run === | ||
| + | |||
| + | < | ||
| + | rsnapshot-backup-timings / | ||
| + | gnuplot | ||
| + | set xdata time | ||
| + | set timefmt " | ||
| + | plot " | ||
| + | plot " | ||
| + | plot " | ||
| + | # percentage: | ||
| + | plot " | ||
| + | plot " | ||
| + | plot " | ||
| + | </ | ||
| + | |||
| + | === Usage per most recent backup runs === | ||
| + | |||
| + | < | ||
| + | cd / | ||
| + | |||
| + | LATESTLOGS=$( | ||
| + | for i in $( find . -maxdepth 1 -type d -mtime -2 ) ; do | ||
| + | for j in $( find $i -maxdepth 1 -type f -mtime -1 -name " | ||
| + | echo $j | ||
| + | done | ||
| + | done | ||
| + | ) | ||
| + | / | ||
| + | gnuplot | ||
| + | set xdata time | ||
| + | set timefmt " | ||
| + | # total | ||
| + | plot " | ||
| + | # rm | ||
| + | plot " | ||
| + | # cp | ||
| + | plot " | ||
| + | # rsync | ||
| + | plot " | ||
| + | |||
| + | # rm % | ||
| + | plot " | ||
| + | # cp % | ||
| + | plot " | ||
| + | # rsync % | ||
| + | plot " | ||
| + | |||
| + | #sums: | ||
| + | # T | ||
| + | awk '{ s+= $4 ; $c++ }END{print s}' backup-times-latest | ||
| + | # rm | ||
| + | awk '{ s+= $6 ; $c++ }END{print s}' backup-times-latest | ||
| + | # cp | ||
| + | awk '{ s+= $12 ; $c++ }END{print s}' backup-times-latest | ||
| + | # rsync | ||
| + | awk '{ s+= $15 ; $c++ }END{print s}' backup-times-latest | ||
| + | </ | ||
| ===== development information ===== | ===== development information ===== | ||
| - | [:: | + | [[project:rsnapshot-backup: |
| + | |||
| + | ===== changelog ===== | ||
| + | |||
| + | [[project: | ||
project/rsnapshot-backup.1498574413.txt.gz · Last modified: 2017/06/27 16:40 by 95.208.69.26