From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: btrfs based backup?
Date: Mon, 18 Nov 2019 13:56:57 +0100 [thread overview]
Message-ID: <20191118125657.GA4166@tik.uni-stuttgart.de> (raw)
In-Reply-To: <20191112183425.GA1257@tik.uni-stuttgart.de>
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@tik.uni-stuttgart.de
Allmandring 30a Tel: ++49-711-68565868
70569 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/
REF:<20191112183425.GA1257@tik.uni-stuttgart.de>
prev parent reply other threads:[~2019-11-18 12:57 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 18:34 btrfs based backup? Ulli Horlacher
2019-11-12 18:58 ` joshua
2019-11-12 19:09 ` Oliver Freyermuth
2019-11-12 19:14 ` Remi Gauvin
2019-11-12 20:05 ` Oliver Freyermuth
2019-11-20 16:36 ` freezes during snapshot creation/deletion -- to be expected? (Was: Re: btrfs based backup?) Christian Pernegger
2019-11-20 17:59 ` Oliver Freyermuth
2019-11-20 18:32 ` Chris Murphy
2019-11-21 1:51 ` Qu Wenruo
2019-11-21 16:44 ` Christian Pernegger
2019-11-21 19:37 ` Oliver Freyermuth
2019-11-21 20:30 ` Christian Pernegger
2019-11-21 21:34 ` Christian Pernegger
2019-11-21 22:39 ` Marc Joliet
2019-11-22 1:36 ` Chris Murphy
2019-11-22 23:21 ` Marc Joliet
2020-03-08 15:11 ` Marc Joliet
2019-11-21 23:57 ` Oliver Freyermuth
2019-11-22 12:30 ` Christian Pernegger
2019-11-22 12:34 ` Qu Wenruo
2019-11-22 14:43 ` Christian Pernegger
2019-11-24 0:38 ` Qu Wenruo
2019-11-24 19:09 ` Christian Pernegger
2019-11-25 1:22 ` Qu Wenruo
2019-11-21 22:22 ` Zygo Blaxell
2019-11-22 4:59 ` Zygo Blaxell
2019-11-22 14:36 ` Christian Pernegger
2019-11-23 3:49 ` Zygo Blaxell
2019-11-12 20:48 ` btrfs based backup? Michael
2019-11-13 15:04 ` Austin S. Hemmelgarn
2019-11-18 12:56 ` Ulli Horlacher [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191118125657.GA4166@tik.uni-stuttgart.de \
--to=framstag@rus.uni-stuttgart.de \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).