On Tue 2019-11-12 (19:34), Ulli Horlacher wrote:
> I need a new backup system for some servers. Destination is a RAID, not
> tapes.
>
> So far I have used a self written shell script. 25 years old, over 1000
> lines of (HORRIBLE) code, no longer maintenable :-}
Thanks for all your suggestions, but I found myself a really easy solution
just with btrfs+rsync.
On the clients I use:
root@tandem:~# grep backup /etc/fstab
mutter:/backup/rsync/tandem /backup nfs ro,tcp,soft,retrans=1 0 0
root@tandem:~# cat bin/rsync_backup
#!/bin/bash
exclude='
--exclude=.snapshot
--exclude=.del
--exclude=*.iso
--exclude=tmp/*
--exclude=backup
'
if [ ! -t 0 ]; then
exec >>/var/log/backup.log
chmod 600 /var/log/backup.log
echo
date +"%Y-%m-%d %H:%M:%S"
fi
mount /backup
mount -o remount,rw /backup || exit 1
rsync -vaxH --delete $exclude / /export /backup/
touch /backup/.ready
mount -o remount,ro /backup
On the backup server I use:
root@mutter:/backup/rsync# grep backup /etc/crontab
0 * * * * root /backup/rsync/snapshot >/dev/null
root@mutter:/backup/rsync# cat snapshot
#!/bin/bash
PATH="$PATH:/opt/btrfs-tools/bin"
for i in /backup/rsync/*/.ready; do
if [ -f "$i" ]; then
rm $i
snaprotate rsync 10 $(dirname $i)
fi
done
That's all! Works like a charm :-)
And substitutes an unmaintainable 1000+ lines shell script.
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart E-Mail: horlacher@xxxxxxxxxxxxxxxxxxxx
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
REF:<20191112183425.GA1257@xxxxxxxxxxxxxxxxxxxx>