How do I determine a Linux SCSI Generic (sg) Driver device number?
Use: cat /proc/scsi/scsi
Example:
[root@localhost /]# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: SEAGATE Model: ST34573LC Rev: 5702
Type: Direct-Access ANSI SCSI revision: 02
Host: scsi0 Channel: 00 Id: 06 Lun: 00
Vendor: DELL Model: 1x6 U2W SCSI BP Rev: 5.23
Type: Processor ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 05 Lun: 00
Vendor: NEC Model: CD-ROM DRIVE:466 Rev: 1.06
Type: CD-ROM ANSI SCSI revision: 02
Host: scsi3 Channel: 00 Id: 00 Lun: 00
Vendor: SONY Model: LIB-162 Rev: 0102
Type: Medium Changer ANSI SCSI revision: 02
Host: scsi3 Channel: 00 Id: 01 Lun: 00
Vendor: SONY Model: SDX-500C Rev: 010c
Type: Sequential-Access ANSI SCSI revision: 02
Host: scsi3 Channel: 00 Id: 02 Lun: 00
Vendor: SONY Model: SDX-500C Rev: 010c
Type: Sequential-Access ANSI SCSI revision: 02
[root@localhost /]#
The first SCSI device listed will be sg0. In the example above the SONY LIB-162 is fourth device listed so it would be sg3. The SDX-500Cs are the fifth and sixth devices listed so they would sg4 and sg5.