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,
NicholasAttachment:
signature.asc
Description: PGP signature
