linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas D Steeves <nsteeves@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
Subject: Re: [RFC] a standard user-friendly way to find a snapshot in nested subvolumes [was: find subvolume directories]
Date: Mon, 15 Jul 2019 19:58:22 -0400	[thread overview]
Message-ID: <20190715235821.rh7elbip3dgzkq7y@DigitalMercury.dynalias.net> (raw)
In-Reply-To: <20190715224051.GA30754@tik.uni-stuttgart.de>

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

Hi Ulli,

On Tue, Jul 16, 2019 at 12:40:51AM +0200, Ulli Horlacher wrote:
> On Mon 2019-07-15 (15:22), Piotr Szymaniak wrote:
> 
> > > I want a list of all subvolumes directories (which I can access with UNIX
> > > tools like cd and ls or btrfs subvolume ...).
> > 
> > what about btrfs sub list [options]? (see man btrfs-subvolume)
> > 
> > You can make ie.:
> > root@ed:~# btrfs sub list -a / | head -10
> > ID 259 gen 142795 top level 5 path <FS_TREE>/@rut
> > ID 267 gen 1599 top level 259 path @rut/BUP/190417-1748_Image_SYSVOL
> 
> There is no directory "<FS_TREE>/@rut" or
> "@rut/BUP/190417-1748_Image_SYSVOL" which I cann access directly with
> standard UNIX commands.
> 
> 
> > But, I'm a bit like Andrei, and not sure what are you looking for. You
> > already asked about "mounted" and then about "list of all subvols"...
> > So you want to find mounted subvolumes or all subvolumes or all mounted
> > subvolumes or ...?
> 
> I need a list of all subvolumes DIRECTORIES, to be accessible with
> standard UNIX commands like cd and ls or btrfs subvolume show
> 

"a list of all subvolumes DIRECTORIES" doesn't make sense...  It
sounds like you want to list all available subvolumes (presumably
snapshots, given that the path has BUP in it), to find a specific one
you want, and then access an older copy of one of your files.

Something like the following method might do the trick:

First, mount /dev/sdX to /btrfs-admin without using a subvol option.
This will wonly work if you haven't changed the default subvol.

  sudo btrfs sub list -at /btrfs-admin/ | sed 's:<FS_TREE>:btrfs-admin:

It should then be obvious how to get out of @rut ;-)

If for some reason it's not obvious what to do next, here's a simple
method that should show the full path for (presumably) snapshots such as
"@rut/BUP/190417-1748_Image_SYSVOL"

  sudo btrfs sub list -a /btrfs-admin/ \
    | sed 's:<FS_TREE>:/btrfs-admin:' \
    | grep -v /btrfs-admin \
    | awk '{print "/btrfs-admin/"$9}'

If by "volume DIRECTORIES" you actually mean independent "btrfs
volumes" then this function will output a list of devices you can
mount the top-level of:

  https://github.com/kdave/btrfsmaintenance/blob/f7a8ed25805ed321a1dfc20b65cd35728c3723c4/btrfsmaintenance-functions#L11-L34

On the topic of the absence of a standard way to get a top-down
tree-like view of all subvolumes, without duplicates...it could be
nice to have /btrfs-admin or /.btrfs-admin mountpoint officially
recognised as the cross-distribution standard method.  In cases where
there are multiple volumes, this would be
/btrfs-admin/{volume-name0,volume-name1,etc}.  Then, if btrfs sub list
was run with a hypothetical "--tree" option it could provide
user-friendly output like findmnt.

Alternatively, are there any reasons why we don't have some VFS magic
providing such a view in /proc or /sys?

Whatever the implementation, I think that this class of wishlist bug
would be solved with something like "sudo btrfs fi show" with no other
arguments would output a comprehensive btrfs view of all detected
volumes.


Cheers,
Nicholas

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

  reply	other threads:[~2019-07-15 23:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 23:17 find subvolume directories Ulli Horlacher
2019-07-13  3:59 ` Andrei Borzenkov
2019-07-13  8:27   ` Ulli Horlacher
2019-07-13 11:10     ` Andrei Borzenkov
2019-07-13 11:28       ` Ulli Horlacher
2019-07-13 15:08         ` Andrei Borzenkov
2019-07-15 13:22         ` Piotr Szymaniak
2019-07-15 22:40           ` Ulli Horlacher
2019-07-15 23:58             ` Nicholas D Steeves [this message]
2019-07-16  0:41               ` [RFC] a standard user-friendly way to find a snapshot in nested subvolumes [was: find subvolume directories] Ulli Horlacher
2019-07-15 11:39       ` find subvolume directories Ulli Horlacher
2019-07-15 11:33 ` Ulli Horlacher
2019-07-16 11:04 ` Ulli Horlacher
2019-07-18 12:00 ` Axel Burri
2019-07-18 17:48   ` Andrei Borzenkov
2019-07-22 12:36     ` Axel Burri
2019-07-20  9:27   ` 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=20190715235821.rh7elbip3dgzkq7y@DigitalMercury.dynalias.net \
    --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;
as well as URLs for NNTP newsgroup(s).