Linux-BTRFS Archive mirror
 help / color / mirror / Atom feed
From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: snapshots of subvolumes recursivly?
Date: Sun, 12 May 2024 22:39:21 +0200	[thread overview]
Message-ID: <20240512203921.GA83909@tik.uni-stuttgart.de> (raw)


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.

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?


-- 
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:<20240512203921.GA83909@tik.uni-stuttgart.de>

             reply	other threads:[~2024-05-12 20:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-12 20:39 Ulli Horlacher [this message]
2024-05-13  4:19 ` snapshots of subvolumes recursivly? HAN Yuwei

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=20240512203921.GA83909@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 read-only IMAP folder(s) and NNTP newsgroup(s).