There are several missing fields in drive metadata.
(1) mountpoint
Currently a Mounted ... line looks like this:
Mounted /dev/sdb1 at /media/pi/FREEDOS
whereas all the other metadata looks like this
device: [/dev/sdb1]
systeminternal: [0]
usage: [filesystem]
type: [vfat]
label: [FREEDOS]
ismounted: [1]
nopolicy: [0]
hasmedia: [1]
opticaldisc: []
numaudiotracks: []
blank: []
media: []
partition: [1]
And (importantly), if you start devmon when drives are already mounted, you never get the Mounted ... line in the devmon output, so you never get the mountpoint info in the drive metadata.
Presumably the mount point can be deduced by appending the label to the end of the standard mount directory (/media/pi in this case), but nobody should be guessing paths in that way. One example of how this can break is if there are two drives that have the same disk label (then .2 is appended, etc.). Currently the user has to manually look in /etc/mtab to get the current mount point info, which requires extra effort.
For consistency there should be another field:
device: [/dev/sdb1]
...
mountpoint: [/media/pi/FREEDOS]
(2) udevpath
If you unplug a drive, you get the line
removed: /org/freedesktop/UDisks/devices/sdb1
However the regular metadata does not list the UDisks device path, so you have to manually figure out which drive to update metadata for, by converting e.g. /org/freedesktop/UDisks/devices/sdb1 into /dev/sdb1 (which presumably works, but seems dicey). There should be a metadata field:
device: [/dev/sdb1]
...
udevpath: [/org/freedesktop/UDisks/devices/sdb1]
(3) usbport
USB port number is also missing. You have to make a separate call to udevadm:
$ udevadm info -q path -n /dev/sdh
/devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1.1/3-1.1.3/3-1.1.3.2/3-1.1.3.2:1.0/host7/target7:0:0/7:0:0:0/block/sdh
Explanation of this path is here:
https://unix.stackexchange.com/a/406096/340704
There needs to be a metadata field like
device: [/dev/sdb1]
...
usbport: [3-1.1.3.2]
(4) size
It would be really helpful to have the partition size and free space reported in the metadata too, saving a call to df:
device: [/dev/sdb1]
...
size: [1010235]
used: [10368]
There are several missing fields in drive metadata.
(1)
mountpointCurrently a
Mounted ...line looks like this:whereas all the other metadata looks like this
And (importantly), if you start devmon when drives are already mounted, you never get the
Mounted ...line in the devmon output, so you never get the mountpoint info in the drive metadata.Presumably the mount point can be deduced by appending the label to the end of the standard mount directory (
/media/piin this case), but nobody should be guessing paths in that way. One example of how this can break is if there are two drives that have the same disk label (then.2is appended, etc.). Currently the user has to manually look in/etc/mtabto get the current mount point info, which requires extra effort.For consistency there should be another field:
(2)
udevpathIf you unplug a drive, you get the line
However the regular metadata does not list the UDisks device path, so you have to manually figure out which drive to update metadata for, by converting e.g.
/org/freedesktop/UDisks/devices/sdb1into/dev/sdb1(which presumably works, but seems dicey). There should be a metadata field:(3)
usbportUSB port number is also missing. You have to make a separate call to udevadm:
Explanation of this path is here:
https://unix.stackexchange.com/a/406096/340704
There needs to be a metadata field like
(4)
sizeIt would be really helpful to have the partition size and free space reported in the metadata too, saving a call to
df: