Home » Questions » Computers [ Ask a new question ]

How do I associate linux scsi device names with disk devices?

How do I associate linux scsi device names with disk devices?

I have a CentOS 4.x server running software raid. The server has two scsi disks in hot-swap trays. mdadm reports that the raid has failed, and so I would like to replace it.

Asked by: Guest | Views: 84
Total answers/comments: 1
Guest [Entry]

"You can look in /sys/block/sda/device, which will have a symlink starting with scsi_device that identifies the device:

$ ls -d /sys/block/sda/device/scsi_device*
/sys/block/sda/device/scsi_device:0:0:0:0

Or you can look in /sys/bus/scsi/devices:

$ ls /sys/bus/scsi/devices/
0:0:0:0 1:0:0:0 2:0:0:0 3:0:0:0 7:0:0:0 8:0:0:0

Each entry here represents a SCSI device. Inside each directory is a symlink starting with block: that identifies the corresponding block device:

$ ls -d /sys/bus/scsi/devices/0\:0\:0\:0/block*
/sys/bus/scsi/devices/0:0:0:0/block:sda"