Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Nicholas D Steeves <nsteeves@gmail.com>
To: Ulli Horlacher <framstag@rus.uni-stuttgart.de>,
	linux-btrfs@vger.kernel.org
Subject: Re: How to exclude other filesystems but include subvolumes?
Date: Tue, 08 Sep 2026 13:31:52 -0400	[thread overview]
Message-ID: <87v78f6453.fsf@navis.mail-host-address-is-not-set> (raw)
In-Reply-To: <20260907103339.GA786966@tik.uni-stuttgart.de>

[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]

Hi,

Ulli Horlacher <framstag@rus.uni-stuttgart.de> writes:

> Many programs like find, tar, rsync, cp, du, etc have options to exclude
> other filesystems, eg rsync: 
>   --one-file-system, -x    don't cross filesystem boundaries
>
> But this also excludes subvolumes, which are in the same filesystem.

Yes, because subvolumes are boundaries.

> How can I address a btrfs filesystem with all subvolumes, but exclude
> other filesystems?
>
> Example: I want to copy the / filesystem (with all subvolumes), what is the
> best solution (for scripting!)?

The best solution that I've found is to 'mount -o subvolid=5
$your_root_device /somewhere' (I think /btrfs-admin or /.btrfs-admin is
logical), where only the root user and the sudo group can read the
mountpoint, and only root can write to it.  I suspect you'll agree that
it's important to include the output of 'btrfs sub list -pta
$subvolid_5_mountpoint' in that backup (for use by humans) as well in
JSON format if you want to someday automate restoration of the subvolume
structure.  Ie:

  1. Mount a top-level view.
  2. List the subvolume structure and insure it ends up in you
  replicant.
  2.5: Optionally recreate the subvolume structure at the target.
  3. Replicate everything in one shot, without '--one-file-system, -x'.

Best,
Nicholas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

      reply	other threads:[~2026-09-08 17:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 10:33 How to exclude other filesystems but include subvolumes? Ulli Horlacher
2026-09-08 17:31 ` Nicholas D Steeves [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=87v78f6453.fsf@navis.mail-host-address-is-not-set \
    --to=nsteeves@gmail.com \
    --cc=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