We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ghw is currently relying on udev's population of /dev/disk/by-id/... to extract serial information (see https://github.com/jaypipes/ghw/blob/85a00ff/block_linux.go#L80-L129). This means two things:
/dev/disk/by-id/...
-
_
Udev also exposes this information in a less-ambiguous less-fragile-to-parse way under /run/udev/data/....
/run/udev/data/...
This data is indexed by major:minor device numbers, which can be found by e.g.:
$ cat /sys/class/block/sdj/dev 8:144
(or just stating the device node under /dev/...)
Then, you have convenient access to all of:
$ cat /run/udev/data/b8:144 S:disk/by-id/scsi-35000cca08062c3d4 S:disk/by-id/wwn-0x5000cca08062c3d4 S:disk/by-path/pci-0000:03:00.0-sas-0x5000cca08062c3d5-lun-0 S:disk/by-path/pci-0000:03:00.0-sas-exp0x500056b3896bccff-phy8-lun-0 W:34 I:414515 E:ID_BUS=scsi E:ID_FS_TYPE= E:ID_MODEL=HUC101812CSS200 E:ID_MODEL_ENC=HUC101812CSS200\x20 E:ID_PATH=pci-0000:03:00.0-sas-0x5000cca08062c3d5-lun-0 E:ID_PATH_TAG=pci-0000_03_00_0-sas-0x5000cca08062c3d5-lun-0 E:ID_REVISION=FU29 E:ID_SAS_PATH=pci-0000:03:00.0-sas-exp0x500056b3896bccff-phy8-lun-0 E:ID_SCSI=1 E:ID_SCSI_SERIAL=0EHS9UWF E:ID_SERIAL=35000cca08062c3d4 E:ID_SERIAL_SHORT=5000cca08062c3d4 E:ID_TYPE=disk E:ID_VENDOR=HGST E:ID_VENDOR_ENC=HGST\x20\x20\x20\x20 E:ID_WWN=0x5000cca08062c3d4 E:ID_WWN_WITH_EXTENSION=0x5000cca08062c3d4 E:MPATH_SBIN_PATH=/sbin G:systemd
Still all as non-root ;)
The text was updated successfully, but these errors were encountered:
@jpo-joyent Hi! This is awesome information! :) Wish I had known about it earlier.
I'll see what I can do about using these new filepaths for grabbing information about block devices (and other devices).
Thanks so much!
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Ghw is currently relying on udev's population of
/dev/disk/by-id/...
to extract serial information (see https://github.com/jaypipes/ghw/blob/85a00ff/block_linux.go#L80-L129). This means two things:-
or_
can lead to incorrect resultsUdev also exposes this information in a less-ambiguous less-fragile-to-parse way under
/run/udev/data/...
.This data is indexed by major:minor device numbers, which can be found by e.g.:
(or just stating the device node under /dev/...)
Then, you have convenient access to all of:
Still all as non-root ;)
The text was updated successfully, but these errors were encountered: