[rhel7] Different output for WWN between lsscsi and lsblk

Nicolas C. rh at nryc.fr
Tue Dec 6 16:51:54 UTC 2022


Le 06/12/2022 à 16:53, Nicolas C. a écrit :
> Hello,
> 
> On RHEL7, can anyone explain why WWN are trucated with the "lsblk" 
> command compared to "lsscsi"?
> 
> [root at xxx ~]# lsblk -o +wwn --raw | awk '$6 == "disk"'
> sda 8:0 0 512M 0 disk  0x6000c295b23ff650
> sdb 8:16 0 10G 0 disk  0x6000c292620bb0eb
> sdc 8:32 0 16G 0 disk  0x6000c295aa065200
> sdd 8:48 0 70G 0 disk  0x6000c29d06fccc82
> sde 8:64 0 500G 0 disk  0x6000c2909730c5c3
> sdf 8:80 0 200G 0 disk  0x6000c29e116828d4
> sdg 8:96 0 5G 0 disk  0x6000c297ebf0717d
> 
> [root at xxx ~]# lsscsi --wwn
> [0:0:0:0]    disk    0x6000c295b23ff650e8af9c9cc76a46b7  /dev/sda
> [0:0:1:0]    disk    0x6000c292620bb0ebcb0d2431e1e686cd  /dev/sdb
> [0:0:2:0]    disk    0x6000c295aa065200042bf6a4438a9576  /dev/sdc
> [0:0:3:0]    disk    0x6000c29d06fccc829484bc6f56767a0f  /dev/sdd
> [0:0:4:0]    disk    0x6000c2909730c5c39d05ff6afd552c22  /dev/sde
> [0:0:5:0]    disk    0x6000c29e116828d445fd2b8f8c5d67b9  /dev/sdf
> [0:0:6:0]    disk    0x6000c297ebf0717d746a5faecf03ce65  /dev/sdg
> [2:0:0:0]    cd/dvd                                  /dev/sr0

Reply to myself: using "serial" instead of "wwn" in lsblk does the 
trick. I'm still unable to display a serial/wwn with a compiled lsblk 
but in the worst case I can use jc:

lsblk -o +serial | jc --lsblk | jq .

> Also, if I try to compile a newer version of lsblk to have the --json 
> option, the wwn is blank :
> 
> [root at xxx ~]# /opt/util-linux-2.38.1/bin/lsblk --json -o +wwn
> {
>     "blockdevices": [
>        {
>           "name": "sda",
>           "maj:min": "8:0",
>           "rm": false,
>           "size": "512M",
>           "ro": false,
>           "type": "disk",
>           "mountpoints": [
>               null
>           ],
>           "wwn": null,





More information about the redhat-list mailing list