Skip to Content

How to Find disk SCSI ID WWIDS In Linux

On Linux disk SCSI ID uniquely identifies each SCSI device on the SCSI bus. A unique SCSI ID is generated when a scsi disk is added to Linux system.

SCSI ID can be used for representing a disk in the configuration file because the disk name like sda sdb sdc may change after a server reboot. The scsi id will be not changed and reboot persistent.

What is WWIDS?

A World Wide Identifier (WWID), also called a World Wide Name (WWN), is a unique identifier defined by the Institute of Electrical and Electronics Engineers (IEEE) standards body. This hexadecimal identifier is unique for each device, and it is hard-coded into a device by its manufacturer. The WWID contains a unique code to identify the manufacturing company as well.

Linux uses the WWID for identifying certain drives, such as iSCSI drives. It creates a symbolic link between the WWID and its associated drive. On an iSCSI target system, type ls -l /dev/disk/by-id at the command line to see any attached iSCSI disks along with their WWID. This works equally well for locally attached SCSI drives.

The advantage of using a WWID to identify particular SCSI drives is that if you add additional drives to a system, their device names may change, whereas their WWIDs will never change. Thus, instead of using a SCSI drive’s /dev/device in the /etc/fstab, you can use its WWID instead.

Get disk scsi id on Linux

we can use two methods to get the disk scsi id.

# lsscsi –scsi_id

[0:0:0:0] disk DGC RAID 10 0430 /dev/sda 360060160c0002900d6a0d8cd4a14eb11
[0:0:0:1] disk DGC RAID 5 0430 /dev/sdb 360060160c000290046fe939f4a14eb11
[0:0:0:2] disk DGC RAID 5 0430 /dev/sdd 360060160c0002900b24cf4b64a14eb11
[0:0:0:3] disk DGC RAID 10 0430 /dev/sdp 360060160c0002900b272c3a9a229eb11
[0:0:1:0] disk DGC RAID 10 0430 /dev/sdf 360060160c0002900d6a0d8cd4a14eb11

# /usr/lib/udev/scsi_id -g -u -d /dev/sda

360060160c0002900d6a0d8cd4a14eb11

Understanding Disk SCSI ID on Linux

A disk usually has more than one name in a multipath environment. For the example below, this disk has four names sdd,sdj,sdg,sdl because of four paths. The scsi id is same for four disks.

# lsscsi –scsi_id|grep 360060160c0002900b24cf4b64a14eb11

[0:0:0:2] disk DGC RAID 5 0430 /dev/sdd 360060160c0002900b24cf4b64a14eb11
[0:0:1:2] disk DGC RAID 5 0430 /dev/sdj 360060160c0002900b24cf4b64a14eb11
[5:0:0:2] disk DGC RAID 5 0430 /dev/sdg 360060160c0002900b24cf4b64a14eb11
[5:0:1:2] disk DGC RAID 5 0430 /dev/sdl 360060160c0002900b24cf4b64a14eb11

Related Post:

15 Linux multipath examples for Linux Beginners first part