From: HAN Yuwei <hrx@bupt.moe>
To: linux-btrfs@vger.kernel.org
Subject: Re: snapshots of subvolumes recursivly?
Date: Mon, 13 May 2024 12:19:29 +0800 [thread overview]
Message-ID: <6B5555BE532EFFBF+03c904d1-3111-40d6-9266-8c02c35b6cd4@bupt.moe> (raw)
In-Reply-To: <20240512203921.GA83909@tik.uni-stuttgart.de>
[-- Attachment #1.1: Type: text/plain, Size: 3223 bytes --]
在 2024/5/13 4:39, Ulli Horlacher 写道:
> I have asked a similar question 2019-07-05, but maybe meanwhile there is a
> solution...
>
> I want to backup btrfs filesystems with IBM Spectrum Protect and restic,
> both are file based.
>
> Copying files which are in write-open state will lead to file corruption.
> Therefore my idea is: create a snapshot and run the backup on the snapshot.
You could use "btrfs send" to send whole snapshot instead of file.
> The problem now is: some of the btrfs filesystems have subvolumes and
> even sub-subvolumes.
>
> When I create a snapshot it does not contain subvolumes. Example:
>
> root@fex:/local/test# btrfs subvolume list .
> ID 350 gen 6075947 top level 5 path home
> ID 62530 gen 6075904 top level 5 path test
> ID 62531 gen 6075894 top level 62530 path sv1
> ID 62532 gen 6075895 top level 62530 path sv2
> ID 62533 gen 6075894 top level 62531 path sv1/sv1_1
> ID 62534 gen 6075894 top level 62531 path sv1/sv1_2
>
> root@fex:/local/test# ll -R
> drwxr-xr-x root root - 2024-05-12 20:42:02 sv1
> drwxr-xr-x root root - 2024-05-12 20:42:10 sv1/sv1_1
> -rw-r--r-- root root 20 2024-05-12 20:42:10 sv1/sv1_1/zz
> drwxr-xr-x root root - 2024-05-12 20:42:17 sv1/sv1_2
> -rw-r--r-- root root 20 2024-05-12 20:42:17 sv1/sv1_2/zz
> -rw-r--r-- root root 20 2024-05-12 20:42:02 sv1/zz
> drwxr-xr-x root root - 2024-05-12 20:42:25 sv2
> -rw-r--r-- root root 20 2024-05-12 20:42:25 sv2/zz
> -rw-r--r-- root root 20 2024-05-12 20:40:58 zz
>
> root@fex:/local/test# btrfs sub snap . backup
> Create a snapshot of '.' in './backup'
>
> root@fex:/local/test# ll -R backup
> drwxr-xr-x root root - 2024-05-12 20:40:58 backup
> drwxr-xr-x root root - 2024-05-12 20:47:58 backup/sv1
> drwxr-xr-x root root - 2024-05-12 20:47:58 backup/sv2
> -rw-r--r-- root root 20 2024-05-12 20:40:58 backup/zz
>
> root@fex:/local/test# btrfs subvolume list .
> ID 350 gen 6075947 top level 5 path home
> ID 62530 gen 6075904 top level 5 path test
> ID 62531 gen 6075894 top level 62530 path sv1
> ID 62532 gen 6075895 top level 62530 path sv2
> ID 62533 gen 6075894 top level 62531 path sv1/sv1_1
> ID 62534 gen 6075894 top level 62531 path sv1/sv1_2
> ID 62535 gen 6075903 top level 62530 path backup
>
> As you see: the snapshot /local/test/backup does not contain the sv*
> subvolumes, only empty directories backup/sv1 backup/sv2
>
> I could write a script which creates snapshots of the subvolumes
> (recursivly), but maybe there is already such a program?
> Or another solution for this problem?
From what I understand, subvolume created a way to split your "snapshot
zone" for better data management(e.g. you can snapshot / without
including /home or /var). This is intented.
So if you want to backup sv1 sv2, why you created subvolume in the first
place?
HAN Yuwei
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2024-05-13 4:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-12 20:39 snapshots of subvolumes recursivly? Ulli Horlacher
2024-05-13 4:19 ` HAN Yuwei [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=6B5555BE532EFFBF+03c904d1-3111-40d6-9266-8c02c35b6cd4@bupt.moe \
--to=hrx@bupt.moe \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).