Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: list all subvolumes below given path?
Date: Tue, 14 May 2024 11:33:43 +0200	[thread overview]
Message-ID: <20240514093343.GB110925@tik.uni-stuttgart.de> (raw)
In-Reply-To: <CAA91j0XJcCw3+p_owtwA8FWj3A=e5jWHyoLbF1s_ZC1-xKW=Bw@mail.gmail.com>

On Tue 2024-05-14 (11:11), Andrei Borzenkov wrote:

> > I need to know all subvolumes below a given path.
> 
> That is rather vague.
> 
> Any number of different btrfs filesystems can be mounted below any
> given path. You conflate "mount point" with "btrfs path". Can you
> describe more precisely what you mean?

Sorry to be unprecise.
I mean all subvolumes of the given btrfs filsystem, but excluding other
filsystems (mount points).

In my example: I want to list all subvolmes of the /local filesystem below
$PWD:

root@fex:/local/test# mount | grep /local
/dev/sde1 on /local type btrfs (rw,relatime,space_cache,user_subvol_rm_allowed,subvolid=5,subvol=/)

find does not help me, because it also lists subvolumes of other file
systems which may be mounted below (not there in my example) and option
-xdev excludes subvolumes:

root@fex:/local/test# find . -inum 256 
.
./sv1
./sv1/sv1_1
./sv1/sv1_1/ss
./sv1/sv1_2
./sv2

root@fex:/local/test# find . -xdev -inum 256
.
./sv1
./sv2



> You parse the current mount table to find out what subvolume contains
> $PWD. But again - you may have arbitrary subvolumes from the same and
> different filesystems mounted anywhere below $PWD and you only can
> find it out by parsing the current mount table.

This was my apprehension :-}


-- 
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:<CAA91j0XJcCw3+p_owtwA8FWj3A=e5jWHyoLbF1s_ZC1-xKW=Bw@mail.gmail.com>

      reply	other threads:[~2024-05-14  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14  7:22 list all subvolumes below given path? Ulli Horlacher
2024-05-14  8:11 ` Andrei Borzenkov
2024-05-14  9:33   ` 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=20240514093343.GB110925@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