Hello, On Fri, 11 Nov 2016, Carlos E. R. wrote:
On 2016-11-11 15:15, David Haller wrote:
# /lib/udev/ata_id --export /dev/sdX # eval $(/lib/udev/ata_id --export /dev/sdX) # echo $ID_SERIAL $ID_WWN
cer@Telcontar:~> /lib/udev/ata_id --export /dev/sda bash: /lib/udev/ata_id: No such file or directory
Ah, SuSE must've moved it (probably with the systemd switch). In 12.1 and Gentoo (eudev) it's still in /lib.
cer@Telcontar:~> /usr/lib/udev/ata_id --export /dev/sdd unable to open '/dev/sdd' cer@Telcontar:~>
Ah, maybe it needs root permissions...
Nope. Just read-access to the raw device. $ strace /lib/udev/ata_id --export /dev/sdb [..] open("/dev/sdb", O_RDONLY|O_NONBLOCK) = -1 EACCES (Permission denied) $ ls -l /dev/sdb brw-rw---- 1 root disk 8, 16 Nov 11 14:56 /dev/sdb $ id -Gn | tr ' ' '\n' | grep disk $ echo $? 1 # chmod o+r /dev/sdb $ /lib/udev/ata_id --export /dev/sdb | head -3 ID_ATA=1 ID_TYPE=disk ID_BUS=ata # chmod o-r /dev/sdb
Telcontar:~ # /usr/lib/udev/ata_id --export /dev/sdd [..] ID_SERIAL=ST2000DM001-1CH164_Z340FVDC ID_WWN=0x5000c50064e4a321 [..] Ok, it works, but needs being root.
See above. You'll probably want to use something like this: for dev; do eval $( /usr/lib/udev/ata_id --export "$dev" ) printf '%s: ata-%s\n%s: wwn-%s\n' \ "$dev" "${ID_SERIAL}" "$dev" "${ID_WWN}" done HTH, -dnh -- I must admit that Micro$oft does seem to bear an awful resemblence to the Sirius Cybernetic Corporation. Considering that my attempts at using Word always resulted in something almost, but not quite, entirely unlike a document. -- Rich Kaszeta -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org