All of lore.kernel.org
 help / color / mirror / Atom feed
* How to find the parent folder of a sub-volume ?
@ 2020-05-12 17:17 miguel
  2020-05-13  8:27 ` David Pottage
  2020-05-13 12:41 ` Zygo Blaxell
  0 siblings, 2 replies; 3+ messages in thread
From: miguel @ 2020-05-12 17:17 UTC (permalink / raw)
  To: linux-btrfs

Hi there !

root@fenix:/home/miguel# btrfs --version
btrfs-progs v5.2.1
root@fenix:/home/miguel# btrfs subvolume list /home/miguel/tmp/
ID 265 gen 20670 top level 5 path miguel
ID 266 gen 23573 top level 265 path miguel/Documentos
ID 267 gen 23575 top level 265 path miguel/Downloads
ID 269 gen 23537 top level 265 path miguel/Misc
ID 270 gen 23522 top level 265 path miguel/Musica
ID 271 gen 23526 top level 265 path miguel/ProgramasRFB
ID 272 gen 23574 top level 265 path miguel/tmp
ID 273 gen 23509 top level 265 path miguel/Videos
ID 274 gen 23574 top level 265 path miguel/R
ID 275 gen 23557 top level 265 path miguel/Imagens
ID 302 gen 23507 top level 265 path miguel/Tech
ID 595 gen 23517 top level 265 path miguel/src/UPSData
ID 596 gen 23510 top level 265 path miguel/bin/UPSData
root@fenix:/home/miguel#

How to find the parent folder (root tree?) of the above sub-volumes ?
On this parent folder I expect to see the above sub-folders as regular folders.

best regards,

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

* Re: How to find the parent folder of a sub-volume ?
  2020-05-12 17:17 How to find the parent folder of a sub-volume ? miguel
@ 2020-05-13  8:27 ` David Pottage
  2020-05-13 12:41 ` Zygo Blaxell
  1 sibling, 0 replies; 3+ messages in thread
From: David Pottage @ 2020-05-13  8:27 UTC (permalink / raw)
  To: miguel; +Cc: linux-btrfs

On 2020-05-12 18:17, miguel@rozsas.eng.br wrote:
> Hi there !
> 
> root@fenix:/home/miguel# btrfs --version
> btrfs-progs v5.2.1
> root@fenix:/home/miguel# btrfs subvolume list /home/miguel/tmp/
> ID 265 gen 20670 top level 5 path miguel
> ID 266 gen 23573 top level 265 path miguel/Documentos
> ID 267 gen 23575 top level 265 path miguel/Downloads
> ID 269 gen 23537 top level 265 path miguel/Misc
> ID 270 gen 23522 top level 265 path miguel/Musica
> ID 271 gen 23526 top level 265 path miguel/ProgramasRFB
> ID 272 gen 23574 top level 265 path miguel/tmp
> ID 273 gen 23509 top level 265 path miguel/Videos
> ID 274 gen 23574 top level 265 path miguel/R
> ID 275 gen 23557 top level 265 path miguel/Imagens
> ID 302 gen 23507 top level 265 path miguel/Tech
> ID 595 gen 23517 top level 265 path miguel/src/UPSData
> ID 596 gen 23510 top level 265 path miguel/bin/UPSData
> root@fenix:/home/miguel#
> 
> How to find the parent folder (root tree?) of the above sub-volumes ?
> On this parent folder I expect to see the above sub-folders as regular 
> folders.

Use: btrfs subvolume show on each subvolume in turn, and link up the 
subvolume uuids

If you can read python, I suggest you take a look at the source code of 
btrfs-clone,
as it contains code to walk the subvolume tree of a btrfs filesysysem.

https://github.com/mwilck/btrfs-clone/blob/master/btrfs-clone#L75


-- 
David Pottage

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

* Re: How to find the parent folder of a sub-volume ?
  2020-05-12 17:17 How to find the parent folder of a sub-volume ? miguel
  2020-05-13  8:27 ` David Pottage
@ 2020-05-13 12:41 ` Zygo Blaxell
  1 sibling, 0 replies; 3+ messages in thread
From: Zygo Blaxell @ 2020-05-13 12:41 UTC (permalink / raw)
  To: miguel; +Cc: linux-btrfs

On Tue, May 12, 2020 at 02:17:19PM -0300, miguel@rozsas.eng.br wrote:
> Hi there !
> 
> root@fenix:/home/miguel# btrfs --version
> btrfs-progs v5.2.1
> root@fenix:/home/miguel# btrfs subvolume list /home/miguel/tmp/
> ID 265 gen 20670 top level 5 path miguel
> ID 266 gen 23573 top level 265 path miguel/Documentos
> ID 267 gen 23575 top level 265 path miguel/Downloads
> ID 269 gen 23537 top level 265 path miguel/Misc
> ID 270 gen 23522 top level 265 path miguel/Musica
> ID 271 gen 23526 top level 265 path miguel/ProgramasRFB
> ID 272 gen 23574 top level 265 path miguel/tmp
> ID 273 gen 23509 top level 265 path miguel/Videos
> ID 274 gen 23574 top level 265 path miguel/R
> ID 275 gen 23557 top level 265 path miguel/Imagens
> ID 302 gen 23507 top level 265 path miguel/Tech
> ID 595 gen 23517 top level 265 path miguel/src/UPSData
> ID 596 gen 23510 top level 265 path miguel/bin/UPSData
> root@fenix:/home/miguel#
> 
> How to find the parent folder (root tree?) of the above sub-volumes ?
> On this parent folder I expect to see the above sub-folders as regular folders.

If you want to have access to the root subvol, the easiest way is to
just mount it:

	mkdir /mnt/root-subvol
	mount /dev/... /mnt/root-subvol -o subvol=

(note the parameter "subvol" is set to "").

A btrfs subvol can be mounted multiple times in multiple places, so each
application that requires the root subvol can simply mount its own.

There is no general solution for accessing the root subvol through
an arbitrary existing mountpoint because the root subvol might not be
accessible to a process (e.g. chroot, different namespace, etc) or might
not be mounted at all (e.g. mount -o subvol=miguel /dev/... /path/...).

> best regards,

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

end of thread, other threads:[~2020-05-13 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 17:17 How to find the parent folder of a sub-volume ? miguel
2020-05-13  8:27 ` David Pottage
2020-05-13 12:41 ` Zygo Blaxell

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.