chiark / gitweb /
scsi_id: Export WWN and Unit Serial Number
authorDavid Zeuthen <davidz@redhat.com>
Sat, 21 Nov 2009 01:21:58 +0000 (20:21 -0500)
committerKay Sievers <kay.sievers@vrfy.org>
Mon, 23 Nov 2009 20:38:21 +0000 (21:38 +0100)
commit4e9fdfccbdd16f0cfdb5c8fa8484a8ba0f2e69d3
treea033c562826b6a90c736837b4c128eb44f87c315
parent5d490002b339f33a033fe09cef4272afb38da676
scsi_id: Export WWN and Unit Serial Number

Since the Unit Serial Number and the WWN are useful bits of
information export them as properties in the udev database. These
bits of information are often printed on the physical disk, see

http://people.freedesktop.org/~david/FUJITSU-MAY2036RC-sas-disk-picture.jpg

and displaying them separately in the UI (or in /dev/disk) might help
users identify the physical disk. This patch exports these bits of
information as ID_WWN and ID_SCSI_SERIAL.

Note that ata_id also use the ID_WWN property since commit
66094a4a7fc1d303e80785d586800eae9841502b (2009-11-04).

Also print out ID_SCSI=1 so users of the udev database knows the disk
speaks SCSI.

Here's the scsi_id output from one of my SAS disks with these changes:

 ID_SCSI=1
 ID_VENDOR=FUJITSU
 ID_VENDOR_ENC=FUJITSU\x20
 ID_MODEL=MAY2036RC
 ID_MODEL_ENC=MAY2036RC\x20\x20\x20\x20\x20\x20\x20
 ID_REVISION=0103
 ID_TYPE=disk
 ID_SERIAL=3500000e01b83f520
 ID_SERIAL_SHORT=500000e01b83f520
 ID_WWN=0x500000e01b83f520
 ID_SCSI_SERIAL=B3G1P8500RWT

Unfortunately we can't overload ID_SERIAL for two reasons

 1. ID_SERIAL (and ID_SERIAL_SHORT) exported by scsi_id isn't really
    the unit serial number (as defined by SCSI) - it is sometimes the
    WWN (since it is more unique than the Unit Serial Number) and
    complex rules (to make the serial unique) govern what value to
    use.

 2. It would break existing setups if the value of ID_SERIAL changed

Signed-off-by: David Zeuthen <davidz@redhat.com>
extras/scsi_id/scsi_id.c
extras/scsi_id/scsi_id.h
extras/scsi_id/scsi_serial.c