Linux SCSI Tricks
You can find out what SCSI devices you have by doing:
lsscsi
Typical output is:
[0:0:0:0] disk ATA ST3160812AS 3.AD /dev/sda
[2:0:4:0] tape HP Ultrium 2-SCSI F6CH /dev/st0
[2:0:5:0] tape HP Ultrium 2-SCSI F6CH /dev/st1
[2:0:6:0] mediumx OVERLAND LXB 0107 -
[2:0:9:0] tape HP Ultrium 1-SCSI E50H /dev/st2
[2:0:10:0] mediumx OVERLAND LXB 0107 -
There are two drives in one autochanger: /dev/st0 and /dev/st1 and a third tape drive at /dev/st2. For using them with Bacula, one would normally reference them as /dev/nst0 … /dev/nst2. Note also, there are two different autochangers identified as “mediumx OVERLAND LXB”. They can be addressed via their /dev/sgN designation, which can be obtained by counting from the beginning as 0 to each changer. In the above case, the two changers are located on /dev/sg3 and /dev/sg5. The one at /dev/sg3, controls drives /dev/nst0 and /dev/nst1; and the one at /dev/sg5 controls drive /dev/nst2.
If you do not have the lsscsi
command, you can obtain the same information as follows:
cat /proc/scsi/scsi
For the above example with the three drives and two autochangers, I get:
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: ST3160812AS Rev: 3.AD
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 04 Lun: 00
Vendor: HP Model: Ultrium 2-SCSI Rev: F6CH
Type: Sequential-Access ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 05 Lun: 00
Vendor: HP Model: Ultrium 2-SCSI Rev: F6CH
Type: Sequential-Access ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 06 Lun: 00
Vendor: OVERLAND Model: LXB Rev: 0107
Type: Medium Changer ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 09 Lun: 00
Vendor: HP Model: Ultrium 1-SCSI Rev: E50H
Type: Sequential-Access ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 10 Lun: 00
Vendor: OVERLAND Model: LXB Rev: 0107
Type: Medium Changer
As an additional example, I get the following (on a different machine from the above example):
Attached devices:
Host: scsi2 Channel: 00 Id: 01 Lun: 00
Vendor: HP Model: C5713A Rev: H107
Type: Sequential-Access ANSI SCSI revision: 02
Host: scsi2 Channel: 00 Id: 04 Lun: 00
Vendor: SONY Model: SDT-10000 Rev: 0110
Type: Sequential-Access ANSI SCSI revision: 02
The above represents first an autochanger and second a simple tape drive. The HP changer (the first entry) uses the same SCSI channel for data and for control, so in Bacula, you would use:
Archive Device = /dev/nst0
Changer Device = /dev/sg0
If you want to remove the SDT-10000 device, you can do so as root
with:
echo "scsi remove-single-device 2 0 4 0">/proc/scsi/scsi
and you can put add it back with:
echo "scsi add-single-device 2 0 4 0">/proc/scsi/scsi
where the 2 0 4 0 are the Host, Channel, Id, and Lun as seen on the output from cat /proc/scsi/scsi
. Note, the Channel must be specified as numeric.
Below is a slightly more complicated output, which is a single autochanger with two drives, and which operates the changer on a different channel from from the drives:
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: ATA Model: WDC WD1600JD-75H Rev: 08.0
Type: Direct-Access ANSI SCSI revision: 05
Host: scsi2 Channel: 00 Id: 04 Lun: 00
Vendor: HP Model: Ultrium 2-SCSI Rev: F6CH
Type: Sequential-Access ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 05 Lun: 00
Vendor: HP Model: Ultrium 2-SCSI Rev: F6CH
Type: Sequential-Access ANSI SCSI revision: 03
Host: scsi2 Channel: 00 Id: 06 Lun: 00
Vendor: OVERLAND Model: LXB Rev: 0106
Type: Medium Changer ANSI SCSI revision: 02
The above tape drives are accessed on /dev/nst0 and /dev/nst1, while the control channel for those two drives is /dev/sg3.
Go back to the btape chapter.
Go back to the Tape Autochanger Setup chapter.
Go back to the main Advanced Features Usage page.