From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: restic backup with btrfs /
Date: Mon, 7 Jul 2025 15:46:01 +0200 [thread overview]
Message-ID: <20250707134601.GA538398@tik.uni-stuttgart.de> (raw)
In-Reply-To: <20250628173308.GB847325@tik.uni-stuttgart.de>
On Sat 2025-06-28 (19:33), Ulli Horlacher wrote:
> My idea is now: I do not backup the original /, but do:
>
> mount --bind / /backup/restic
> restic backup /backup/restic
> umount /backup/restic
>
> Next evolution step:
> I could recursivly mount-bind other filesystems into /backup/restic/
> For example:
>
> mount --bind /local /backup/restic/local
> mount --bind /data /backup/restic/ldata
>
> That I would have a "all in one backup".
Meanwhile I haved implemented it and also use of (temporary) snapshots!
Instead of /backup/restic I am using /__ (just another name).
restix-backup does:
- create recursive snapshots of all rw subvolumes
- bind-mount the toplevel snapshots on /__
- run restic backup on /__
- umount everything below /__
- delete all temporary snapshots
Example (I have typed only the first line, all other lines are output):
root@fex:~# restix-backup -s //
# btrfs_rsnapshot -w /
Create a snapshot of '/' in '/.snapshot/_'
Create a snapshot of '/test' in '/.snapshot/_/test'
Create a snapshot of '/tmp' in '/.snapshot/_/tmp'
# mount --bind /.snapshot/_ /__
# btrfs_rsnapshot -w /local
Create a snapshot of '/local' in '/local/.snapshot/_'
Create a snapshot of '/local/home' in '/local/.snapshot/_/home'
Create a snapshot of '/local/home/framstag/blubb' in '/local/.snapshot/_/home/framstag/blubb'
Create a snapshot of '/local/home/smc/test' in '/local/.snapshot/_/home/smc/test'
Create a snapshot of '/local/test' in '/local/.snapshot/_/test'
Create a snapshot of '/local/test/sv1' in '/local/.snapshot/_/test/sv1'
Create a snapshot of '/local/test/sv1/sv1_1' in '/local/.snapshot/_/test/sv1/sv1_1'
Create a snapshot of '/local/test/sv1/sv1_1/ss' in '/local/.snapshot/_/test/sv1/sv1_1/ss'
Create a snapshot of '/local/test/sv1/sv1_2' in '/local/.snapshot/_/test/sv1/sv1_2'
Create a snapshot of '/local/test/sv2' in '/local/.snapshot/_/test/sv2'
Create a snapshot of '/local/tmp/test' in '/local/.snapshot/_/tmp/test'
# mount --bind /local/.snapshot/_ /__/local
# cd /
# findattr __ > __/.chattr
# restic backup -v -e /tmp -e /backup -e .cache -e .del -e tmp/\* -e \*.tmp -H fex --tag __ __
RESTIC_ENV=/root/.restic/s3tik.env
SG_TENANT=fex
RESTIC_REPOSITORY=s3:s3.tik.uni-stuttgart.de/fex.restic
# /opt/s3tik/restic backup -v -e /tmp -e /backup -e .cache -e .del -e 'tmp/*' -e '*.tmp' -H fex --tag __ __
open repository
repository 13e662d4 opened (version 2, compression level auto)
using parent snapshot 20b48e38
load index files
[0:02] 100.00% 36 / 36 index files loaded
start scan on [__]
start backup on [__]
scan finished in 4.728s: 254436 files, 46.446 GiB
Files: 1 new, 105 changed, 254330 unmodified
Dirs: 2 new, 18860 changed, 2765 unmodified
Data Blobs: 37 new
Tree Blobs: 168 new
Added to the repository: 35.310 MiB (7.926 MiB stored)
processed 254436 files, 46.446 GiB in 0:32
snapshot 1624348b saved
# restic unlock
SG_TENANT=fex
RESTIC_REPOSITORY=s3:s3.tik.uni-stuttgart.de/fex.restic
# /opt/s3tik/restic unlock
# umount /__//local
# btrfs_rsnapshot -d /local
Delete subvolume (no-commit): '/local/.snapshot/_/tmp/test'
Delete subvolume (no-commit): '/local/.snapshot/_/test/sv2'
Delete subvolume (no-commit): '/local/.snapshot/_/test/sv1/sv1_2'
Delete subvolume (no-commit): '/local/.snapshot/_/test/sv1/sv1_1/ss'
Delete subvolume (no-commit): '/local/.snapshot/_/test/sv1/sv1_1'
Delete subvolume (no-commit): '/local/.snapshot/_/test/sv1'
Delete subvolume (no-commit): '/local/.snapshot/_/test'
Delete subvolume (no-commit): '/local/.snapshot/_/home/smc/test'
Delete subvolume (no-commit): '/local/.snapshot/_/home/framstag/blubb'
Delete subvolume (no-commit): '/local/.snapshot/_/home'
Delete subvolume (no-commit): '/local/.snapshot/_'
# umount /__//
# btrfs_rsnapshot -d /
Delete subvolume (no-commit): '/.snapshot/_/tmp'
Delete subvolume (no-commit): '/.snapshot/_/test'
Delete subvolume (no-commit): '/.snapshot/_'
# restic forget --prune --tag __ --host fex --keep-daily 7 --keep-weekly 4
SG_TENANT=fex
RESTIC_REPOSITORY=s3:s3.tik.uni-stuttgart.de/fex.restic
# /opt/s3tik/restic forget --prune --tag __ --host fex --keep-daily 7 --keep-weekly 4
Applying Policy: keep 7 daily, 4 weekly snapshots
keep 2 snapshots:
ID Time Host Tags Reasons Paths Size
------------------------------------------------------------------------------------------------
20b48e38 2025-07-07 13:53:14 fex __ oldest daily snapshot /__ 46.446 GiB
oldest weekly snapshot
1624348b 2025-07-07 14:05:42 fex __ daily snapshot /__ 46.446 GiB
weekly snapshot
------------------------------------------------------------------------------------------------
2 snapshots
# restic check
SG_TENANT=fex
RESTIC_REPOSITORY=s3:s3.tik.uni-stuttgart.de/fex.restic
# /opt/s3tik/restic check
using temporary cache in /tmp/root/restic-check-cache-988330367
create exclusive lock for repository
load indexes
check all packs
check snapshots, trees and blobs
[0:12] 100.00% 35 / 35 snapshots
no errors were found
--
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: https://www.tik.uni-stuttgart.de/
REF:<20250628173308.GB847325@tik.uni-stuttgart.de>
prev parent reply other threads:[~2025-07-07 13:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-28 17:33 restic backup with btrfs / Ulli Horlacher
2025-06-30 10:07 ` Mark Harmstone
2025-06-30 13:41 ` Christoph Hellwig
2025-06-30 13:53 ` Mark Harmstone
2025-06-30 13:57 ` Christoph Hellwig
2025-06-30 17:30 ` Ulli Horlacher
2025-06-30 19:16 ` Ulli Horlacher
2025-07-03 8:00 ` Robert Krig
2025-07-04 9:39 ` Ulli Horlacher
2025-07-07 13:46 ` 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=20250707134601.GA538398@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