From: kevin lyda (kevin at domain suberic.net)
Date: Mon 03 Sep 2001 - 04:26:26 IST
i'm finally getting around to implementing real backups at home.
copying some files to multiple hd's doesn't really count i guess.
i'm using a cdr as the backup device and i'm wondering if anyone has ever
just dumped a tar file directly to cdrecord - skipping the mkisofs step.
mkisofs is better for multisession cd's i suppose so i'll go with that
in the end i suppose, but just wondering if anyone has done it.
i've enclosed the backup script so far. i haven't implemented incremental
backups yet - well i have but they aren't tested. the idea is to get
a list of all the rpms and put them where they'll be backed up (i put
them in ~root). then get a list of all the files managed by rpm and cut
that list down to the files that haven't changed. then get a list of
the files in all the dirs i care about, remove the files manged by rpm
(that i haven't changed), and then back those files up.
for incrementals i'll compare those files to a touch file created at
the start of the last backup and only back up the ones that are newer.
anyway, someone might find it useful. the nice thing is that restoring
the system is as simple as reinstalling it, getting the list of rpms
that were there before, installing all of them, and that doing a tar
Ixpf of the tarfile.
---- snip here ----
PRUNE_LIST="/dirs/to/prune /like /dev /or /proc"
echo "Backup begins"
echo "Generating RPM list"
rpm -qa | sort > $RPM_LIST.tmp 2> /dev/null
if cmp -s $RPM_LIST $RPM_LIST.tmp; then
mv $RPM_LIST.tmp $RPM_LIST
echo "Generating list of unchanged rpm files"
rpm --noscripts --nomd5 --nodeps --verify --all | grep '^S' | \
sed 's-^[^/]*/-/-' > $RPM_VA 2> /dev/null
rpm -qal | sort -u > $RPM_QAL 2>/dev/null
sort $RPM_VA $RPM_VA $RPM_QAL | uniq -u > $RPM_VIRGIN
echo "Generating list of all files that are in interesting directories"
for d in $PRUNE_LIST; do
PRUNE="$PRUNE -path $d -prune -o"
PRUNE="$PRUNE -path /home/ftp -prune"
if [ -f $LAST_BACKUP_TOUCH ]; then
find / \( $PRUNE \) -o $NEWER -print > $FIND_PRUNE
echo "Generating list of files that will need to be backed up"
sort $RPM_VIRGIN $RPM_VIRGIN $FIND_PRUNE | uniq -u |
egrep -v "$EXCLUDE" > $FTB
echo "Generating backup image"
tar -S --no-recursion -I -c -P -p -T $FTB \
-f $BACKUP_TARBALL.`date +'%Y-%m-%d.%H:%M:%S'`.tar.bz2
echo "Cleaning up"
rm -f $RPM_VA $RPM_QAL $FIND_PRUNE $RPM_VIRGIN
mv $LAST_BACKUP_TOUCH.tmp $LAST_BACKUP_TOUCH
---- snip! ----
-- kevin at domain suberic.net simple four line sigs - fork()'ed on 37058400 bandwidth friendly; nice to do. meatspace place: home some admins clueless. http://suberic.net/~kevin --netiquette haiku 2001
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:11:56 GMT