BackupPC-users

Re: [BackupPC-users] save backuppc backups on a ultrium tape

2013-11-20 13:25:27
Subject: Re: [BackupPC-users] save backuppc backups on a ultrium tape
From: Holger Parplies <wbppc AT parplies DOT de>
To: "info AT newoffice DOT it" <info AT newoffice DOT it>
Date: Wed, 20 Nov 2013 19:22:00 +0100
Hi,

info AT newoffice DOT it wrote on 2013-11-18 16:04:25 +0100 [Re: 
[BackupPC-users] save backuppc backups on a ultrium tape]:
> [...]
> i've found this script

this would have been a good place to mention where you found it.

> [...]
> DATADIR=/var/lib/backuppc/pc
> BackupPCDATADIR=/dev/st0

This doesn't make sense with respect to the usage of these variables below.
DATADIR would seem to be meant to point to some temporary space available for
this script to put large amounts of data into (tars of the last backup of all
hosts).
BackupPCDATADIR would seem to be meant to be $TopDir/pc - in the case of
Debian and Ubuntu package installs /var/lib/backuppc/pc (what DATADIR is
erroneously set to).

> # Uncomment to remove old backups
> #echo "Removing old backups....."
> #find $DATADIR/ -type f | while read foo; do
> # rm -fv $foo
> #done

Err, well, yes, with the correct settings of the variables. As it is here, it
would remove all BackupPC backups - not likely something you actually want to
do.

> echo "Checking dump directories....."
> ls $BackupPCDATADIR | grep -v archive | while read foo; do
> mkdir $DATADIR/$foo 2>/dev/null
> chmod 777 $DATADIR/$foo 2>/dev/null

I read "chmod 777" as "I don't know what I'm doing, but something didn't work,
and now it apparently does for whatever reasons".

> done
> 
> ls $BackupPCDATADIR | grep -v archive | while read host; do
> echo Dumping $host `date`........

Ah, we're at eight dots now. Five seemed plenty.

> $BackupPCBIN/BackupPC_tarCreate -t -h $host -n -1 -s \* . > 
> $DATADIR/$host/$host.`date +%Y%m%W`.tar

This is the one interesting line. It would seem to be correct, though your
naming preferences may vary. In particular, %W won't be very descriptive if
you run this more than once a week ;-).

> pbzip2 -p7 $DATADIR/$host/$host.`date +%Y%m%W`.tar

pbzip2 is an interesting idea. Thank you for that. You should probably adapt
the '-p7' switch to what suits your system, though.
There may or may not be reasons for creating an intermediate copy of the tar
file instead of just piping directly into pbzip2. Again, you should see what
fits your system rather than copying what fitted someone else's.

> echo Done! `date`
> done
> exit 0

All in all, my coding style preferences differ, but it would seem to work
(correct variable settings assumed!). What it gives you is compressed tar
archives of the last backup of each host in a directory somewhere (or rather
a directory of directories). Nothing is written to tape anywhere, though you
might just need to put it somewhere your tape system is configured to pick it
up. No synchronization though (unless this is *called* by the tape system as a
pre-backup command). No logic to decide whether any backup has actually
completed since the last call (i.e. if you disable backups for a host, this
script will continue creating a tar of the same last backup of this host; if a
host wasn't reachable today, you'll just get a new copy of yesterday's
backup).

Hope that helps.

Regards,
Holger

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/