knorrie / python-btrfs

Python Btrfs module
GNU Lesser General Public License v3.0
112 stars 22 forks source link

Find non-mounted volumes #41

Closed Jonny007-MKD closed 1 year ago

Jonny007-MKD commented 1 year ago

Hi, I am very new to btrfs, so maybe I am using wrong the terminology or am thinking in the wrong direction altogether. I would like discover all block devices that are formatted with btrfs, even if the volume isn't mounted, yet, as I'd like to get a list of all devices of type btrfs and the information to which volume they belong.

The command line tool allows me to do this:

$ btrfs filesystem show
Label: none  uuid: 4f4bb4b2-69e2-4395-ac4e-08fefa6715ff
    Total devices 1 FS bytes used 128.00KiB
    devid    1 size 512.00MiB used 20.00MiB path /dev/loop0

For this it is using internally the btrfs_scan_devices() function. Am I correct that python-btrfs is not implementing access to this functionality?

knorrie commented 1 year ago

Hi Jonny, yes that is correct.

This library only deals with filesystems that are already 'online' / mounted. It does not try to directly look around inside block devices attached to the system.

It would be fun to also create a library that makes it possible to quickly script things while working directly with offline or broken filesystems, but that would be a completely other one than this one, from the ground up. :-)

Hans