Re: How to find the parent folder of a sub-volume ?
From: Zygo Blaxell <hidden>
Date: 2020-05-13 12:41:49
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,