All of lore.kernel.org
 help / color / mirror / Atom feed
* btrfs subvolume list for not mounted filesystem?
@ 2017-12-18 16:49 Ulli Horlacher
  2017-12-18 17:34 ` Andrei Borzenkov
  2022-08-16 11:54 ` Ulli Horlacher
  0 siblings, 2 replies; 3+ messages in thread
From: Ulli Horlacher @ 2017-12-18 16:49 UTC (permalink / raw)
  To: linux-btrfs

I want to mount an alternative subvolume of a btrfs filesystem.
I can list the subvolumes when the filesystem is mounted, but how do I
know them, when the filesystem is not mounted? Is there a query command?

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

root@xerus:~# btrfs subvolume list /test
ID 258 gen 156 top level 5 path tux/zz
ID 259 gen 156 top level 5 path tux/z1
ID 260 gen 156 top level 5 path tmp/zz
ID 261 gen 19 top level 260 path tmp/zz/z1
ID 269 gen 156 top level 5 path tux/test
ID 271 gen 129 top level 269 path tux/test/.snapshot/2017-12-02_1341.test

root@xerus:~# umount /test

root@xerus:~# btrfs subvolume list /dev/sdd4
ERROR: not a btrfs filesystem: /dev/sdd4
ERROR: can't access '/dev/sdd4'



-- 
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:    http://www.tik.uni-stuttgart.de/
REF:<20171218164941.GA22020@rus.uni-stuttgart.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: btrfs subvolume list for not mounted filesystem?
  2017-12-18 16:49 btrfs subvolume list for not mounted filesystem? Ulli Horlacher
@ 2017-12-18 17:34 ` Andrei Borzenkov
  2022-08-16 11:54 ` Ulli Horlacher
  1 sibling, 0 replies; 3+ messages in thread
From: Andrei Borzenkov @ 2017-12-18 17:34 UTC (permalink / raw)
  To: linux-btrfs

18.12.2017 19:49, Ulli Horlacher пишет:
> I want to mount an alternative subvolume of a btrfs filesystem.
> I can list the subvolumes when the filesystem is mounted, but how do I
> know them, when the filesystem is not mounted? Is there a query command?
> 
> root@xerus:~# mount | grep /test
> /dev/sdd4 on /test type btrfs (rw,relatime,space_cache,user_subvol_rm_allowed,subvolid=5,subvol=/)
> 
> root@xerus:~# btrfs subvolume list /test
> ID 258 gen 156 top level 5 path tux/zz
> ID 259 gen 156 top level 5 path tux/z1
> ID 260 gen 156 top level 5 path tmp/zz
> ID 261 gen 19 top level 260 path tmp/zz/z1
> ID 269 gen 156 top level 5 path tux/test
> ID 271 gen 129 top level 269 path tux/test/.snapshot/2017-12-02_1341.test
> 
> root@xerus:~# umount /test
> 
> root@xerus:~# btrfs subvolume list /dev/sdd4
> ERROR: not a btrfs filesystem: /dev/sdd4
> ERROR: can't access '/dev/sdd4'
> 
> 
> 

btrfs-debug-tree -r /dev/sdd4

(or in more recent btrfs-progs, "btrfs inspect-internal dump-tree") will
show subvolume IDs (as ROOT_ITEM); I'm not sure of there is simple way
to resolve subvolume path names on unmounted device.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: btrfs subvolume list for not mounted filesystem?
  2017-12-18 16:49 btrfs subvolume list for not mounted filesystem? Ulli Horlacher
  2017-12-18 17:34 ` Andrei Borzenkov
@ 2022-08-16 11:54 ` Ulli Horlacher
  1 sibling, 0 replies; 3+ messages in thread
From: Ulli Horlacher @ 2022-08-16 11:54 UTC (permalink / raw)
  To: linux-btrfs

On Mon 2017-12-18 (17:49), Ulli Horlacher wrote:
> I want to mount an alternative subvolume of a btrfs filesystem.
> I can list the subvolumes when the filesystem is mounted, but how do I
> know them, when the filesystem is not mounted? Is there a query command?
> 
> root@xerus:~# mount | grep /test
> /dev/sdd4 on /test type btrfs (rw,relatime,space_cache,user_subvol_rm_allowed,subvolid=5,subvol=/)
> 
> root@xerus:~# btrfs subvolume list /test
> ID 258 gen 156 top level 5 path tux/zz
> ID 259 gen 156 top level 5 path tux/z1
> ID 260 gen 156 top level 5 path tmp/zz
> ID 261 gen 19 top level 260 path tmp/zz/z1
> ID 269 gen 156 top level 5 path tux/test
> ID 271 gen 129 top level 269 path tux/test/.snapshot/2017-12-02_1341.test
> 
> root@xerus:~# umount /test
> 
> root@xerus:~# btrfs subvolume list /dev/sdd4
> ERROR: not a btrfs filesystem: /dev/sdd4
> ERROR: can't access '/dev/sdd4'

Meanwhile I have written "btrfs_list" :

root@fex:~# btrfs_list -h
usage: btrfs_list [-b] [-w] [SUBVOLUME...]
usage: btrfs_list [-b] [-w] [/dev/]DEVICE
options: -b  brief output
         -w  show only writable subvolumes
see also: btrfs subvolume show SUBVOLUME

root@fex:~# btrfs_list -v sde1
# mount -o ro /dev/sde1 /mnt/tmp/sde1
# btrfs subvolume list -u /mnt/tmp/sde1
ACCESS-MODE SUBVOLUME <- SNAPSHOT-PARENT
rw fex
ro fex/.snapshot/2022-08-14_0222.daily <- fex
ro fex/.snapshot/2022-08-15_0222.daily <- fex
ro fex/.snapshot/2022-08-16_0222.daily <- fex
rw sw
ro sw/.snapshot/2022-08-07_0000.weekly <- sw
ro sw/.snapshot/2022-08-13_0000.daily <- sw
ro sw/.snapshot/2022-08-14_0000.weekly <- sw
ro sw/.snapshot/2022-08-15_0000.daily <- sw
ro sw/.snapshot/2022-08-16_0000.daily <- sw
rw tmp
# umount /mnt/tmp/sde1


https://fex.rus.uni-stuttgart.de/fas/framstag@rus.uni-stuttgart.de/linuxtools/anonymous@fex.rus.uni-stuttgart.de/k5JuaCkGRqGOYeFUHuB47S35rhs3vBZo


-- 
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:    http://www.tik.uni-stuttgart.de/
REF:<20171218164941.GA22020@rus.uni-stuttgart.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-16 12:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-18 16:49 btrfs subvolume list for not mounted filesystem? Ulli Horlacher
2017-12-18 17:34 ` Andrei Borzenkov
2022-08-16 11:54 ` Ulli Horlacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.