> How do I find the root filesystem of a subvolume? > Example: > root@fex:~# df -T > Filesystem Type 1K-blocks Used Available Use% Mounted on > - - 1073740800 104244552 967773976 10% /local/.backup/home [ ... ] > I know, the root filesystem is /local,
That question is somewhat misunderstood and uses the wrong concepts and terms. In UNIX filesystems a filesystem "root" is a directory inode with a number that is local to itself, and can be "mounted" anywhere, or left unmounted, and that is a property of the running system, not of the filesystem "root". Usually UNIX filesystems have a single "root" directory inode. In the case of Btrfs the main volume and its subvolumes all have filesystem "root" directory inodes, which may or may not be "mounted", anywhere the administrators of the running system pleases, as a property of the running system. There is no fixed relationship between the root directory inode of a subvolume and the root directory inode of any other subvolume or the main volume. Note: in Btrfs terminology "volume" seems to mean both the main volume and the collection of devices where it and subvolumes are hosted. > but who can I show it by command? The system does not keep an explicit record of which Btrfs "root" directory inode is related to which other Btrfs "root" directory inode in the same volume, whether mounted or unmounted. That relationship has to be discovered by using volume UUIDs, which are the same for the main subvolume and the other subvolumes, whether mounted or not, so one has to do: * For the indicated mounted subvolume "root" read its UUID. * For every mounted filesystem "root", check whether its type is 'btrfs' and if it is obtain its UUID. * If the UUID is the same, and the subvolume id is '5', that's the main subvolume, and terminate. * For every block device which is not mounted, check whether it has a Btrfs superblock. * If the type is 'btrfs' and the volume UUIS is the same as that of the subvolume, list the block device. In the latter case since the main volume is not mounted the only way to identify it is to list the block devices that host it. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html