From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: restic backup with btrfs /
Date: Fri, 4 Jul 2025 11:39:07 +0200 [thread overview]
Message-ID: <20250704093907.GA215813@tik.uni-stuttgart.de> (raw)
In-Reply-To: <d882ddfe-b0a2-4b1f-ac28-145652ace126@render-wahnsinn.de>
On Thu 2025-07-03 (10:00), Robert Krig wrote:
> Why don't you just create a backup script, where you create a list of
> subvolumes dynamically and then back those up, rather than hardcode
> specific subvolumes?
Indeed, this is my plan :-)
I have used "harcoded subvolumes" only as a simple example to demonstrate
my idea.
> I would use btrfs tools to get a list of subvolumes and their paths,
With standard btrfs commands this is not easy, but I have already written
btrfs_list which does this job:
root@fex:~# btrfs_list /local/test
ACCESS-MODE SUBVOLUME <- SNAPSHOT-PARENT
rw /local/test
ro /local/test/.snapshot/2025-06-29_1414.test <- /local/test
ro /local/test/.snapshot/2025-06-29_1416.test <- /local/test
ro /local/test/.snapshot/2025-06-29_1418.test <- /local/test
rw /local/test/sv1
rw /local/test/sv1/sv1_1
rw /local/test/sv1/sv1_1/ss <- /local/test/sv1/sv1_1
rw /local/test/sv1/sv1_2
rw /local/test/sv2
> create snapshots and mount them in a similar directory tree and point
> restic at the snapshot and backup up from there.
In this case ".snapshot" is in the restic path, which I do not like.
Therefore I will use mount --bind ...
Meanwhile I have written btrfs_rsnapshot to create and delete snapshots of
nested subvolumes recursivly. Example:
root@fex:~# btrfs_rsnapshot /local
Create a snapshot of '/local' in '/local/.snapshot/_local'
Create a snapshot of '/local/home' in '/local/.snapshot/_local/home'
Create a snapshot of '/local/home/framstag/blubb' in '/local/.snapshot/_local/home/framstag/blubb'
Create a snapshot of '/local/home/smc/test' in '/local/.snapshot/_local/home/smc/test'
Create a snapshot of '/local/test' in '/local/.snapshot/_local/test'
Create a snapshot of '/local/test/sv1' in '/local/.snapshot/_local/test/sv1'
Create a snapshot of '/local/test/sv1/sv1_1' in '/local/.snapshot/_local/test/sv1/sv1_1'
Create a snapshot of '/local/test/sv1/sv1_1/ss' in '/local/.snapshot/_local/test/sv1/sv1_1/ss'
Create a snapshot of '/local/test/sv1/sv1_2' in '/local/.snapshot/_local/test/sv1/sv1_2'
Create a snapshot of '/local/test/sv2' in '/local/.snapshot/_local/test/sv2'
Create a snapshot of '/local/tmp/test' in '/local/.snapshot/_local/tmp/test'
root@fex:~# btrfs_rsnapshot -d /local
Delete subvolume (no-commit): '/local/.snapshot/_local/tmp/test'
Delete subvolume (no-commit): '/local/.snapshot/_local/test/sv2'
Delete subvolume (no-commit): '/local/.snapshot/_local/test/sv1/sv1_2'
Delete subvolume (no-commit): '/local/.snapshot/_local/test/sv1/sv1_1/ss'
Delete subvolume (no-commit): '/local/.snapshot/_local/test/sv1/sv1_1'
Delete subvolume (no-commit): '/local/.snapshot/_local/test/sv1'
Delete subvolume (no-commit): '/local/.snapshot/_local/test'
Delete subvolume (no-commit): '/local/.snapshot/_local/home/smc/test'
Delete subvolume (no-commit): '/local/.snapshot/_local/home/framstag/blubb'
Delete subvolume (no-commit): '/local/.snapshot/_local/home'
Delete subvolume (no-commit): '/local/.snapshot/_local'
--
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:<d882ddfe-b0a2-4b1f-ac28-145652ace126@render-wahnsinn.de>
next prev parent reply other threads:[~2025-07-04 9:39 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 [this message]
2025-07-07 13:46 ` Ulli Horlacher
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=20250704093907.GA215813@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