Linux SCSI commands

Where:

  • A is the host bus adapter (HBA) number
  • B is the channel id on the HBA
  • C is the SCSI ID of the new device
  • D is the LUN of the new device

List SCSI devices

cat /proc/scsi/scsi

Identify a SCSI device (in this cas /dev/sdd and replace A:B:C:D with the appropriate numbers)

ls -l /sys/bus/scsi/drivers/sd/A\:B\:C\:D/block*
lrwxrwxrwx 1 root root 0 Jun 16 23:19 /sys/bus/scsi/drivers/sd/5:0:0:1/block:sdd -> ../../../../../../block/sdd

Add a new SCSI device (replace A:B:C:D with the appropriate numbers)

echo "scsi add-single-device A B C D">/proc/scsi/scsi

Delete a SCSI Device (replace A:B:C:D with the appropriate numbers)

echo 1 > /sys/bus/scsi/drivers/sd/A\:B\:C\:D/delete

Rescan of a SCSI bus (replace hostA by the appropriate host ID: host0, host1, host2 or host3…)

echo "- - -" > /sys/class/scsi_host/hostA/scan

Rescan of a SCSI Device (replace A:B:C:D with the appropriate numbers)

echo 1 > /sys/bus/scsi/drivers/sd/A\:B\:C\:D/block/device/rescan.

Reference: http://kbase.redhat.com/faq/docs/DOC-7466
Reference: http://www.ibm.com/developerworks/wikis/display/LinuxP/SCSI+-+Hot+add,+remove,+rescan+of+SCSI+devices

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License