[stgt] Using tgtd to pass through a SCSI tape drive

Mark Harvey markh794 at gmail.com
Thu Jul 29 03:38:10 CEST 2010


I've had success using the passthru / sg devices for tape and robot

On "target" host:
# lsscsi -g
[0:0:0:0]    disk    MAXTOR   ATLAS10K4_36SCA  DFM0  /dev/sda  /dev/sg0
[0:0:6:0]    process PE/PV    1x3 SCSI BP      1.1   -         /dev/sg1
[2:0:0:0]    tape    IBM      ULT3580-TD4      8192  /dev/st0  /dev/sg2
[2:0:0:1]    mediumx IBM      3573-TL          6.50  -         /dev/sg3
[2:0:1:0]    tape    IBM      ULT3580-TD4      8192  /dev/st1  /dev/sg4
[2:0:1:1]    mediumx IBM      3573-TL          6.50  -         /dev/sg5

# tgtadm --lld iscsi --op new --mode target --tid 1 -T
iqn.2001-04.com.example:vtl1
# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1
--bstype=sg --device-type=pt -b /dev/sg2
# tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2
--bstype=sg --device-type=pt -b /dev/sg3
# tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
# tgtadm --lld iscsi --op show --mode target

Target 1: iqn.2001-04.com.example:vtl1
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
        LUN: 1
            Type: (null)
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: sg
            Backing store path: /dev/sg2
            Backing store flags:
        LUN: 2
            Type: (null)
            SCSI ID: IET     00010002
            SCSI SN: beaf12
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: sg
            Backing store path: /dev/sg3
            Backing store flags:
    Account information:
    ACL information:
        ALL

On Initiator host:
# iscsiadm -m discovery -t sendtargets -p dpg-markh.sydlab.veritas.com
10.251.60.20:3260,1 iqn.2001-04.com.example:vtl1

# iscsiadm -m node -T iqn.2001-04.com.example:vtl1 -p 10.251.60.20 --login
Logging in to [iface: default, target: iqn.2001-04.com.example:vtl1,
portal: 10.251.60.20,3260]
Login to [iface: default, target: iqn.2001-04.com.example:vtl1,
portal: 10.251.60.20,3260]: successful

# lsscsi -g
[0:0:0:0]    disk    VMware,  VMware Virtual S 1.0   /dev/sda  /dev/sg0
[snip]
[2:0:0:0]    storage IET      Controller       0001  -         /dev/sg12
[2:0:0:1]    tape    IBM      ULT3580-TD4      8192  /dev/st8  /dev/sg13
[2:0:0:2]    mediumx IBM      3573-TL          6.50  -         /dev/sg14

 # mtx -f /dev/sg14 status
  Storage Changer /dev/sg14:1 Drives, 23 Slots ( 3 Import/Export )
Data Transfer Element 0:Empty
      Storage Element 1:Empty
      Storage Element 2:Empty
      Storage Element 3:Empty
      Storage Element 4:Empty
      Storage Element 5:Empty
      Storage Element 6:Empty
      Storage Element 7:Empty
      Storage Element 8:Empty
      Storage Element 9:Full :VolumeTag=QU5448L1
      Storage Element 10:Empty
      Storage Element 11:Empty
      Storage Element 12:Empty
      Storage Element 13:Empty
      Storage Element 14:Empty
      Storage Element 15:Empty
      Storage Element 16:Empty
      Storage Element 17:Empty
      Storage Element 18:Empty
      Storage Element 19:Empty
      Storage Element 20:Empty
      Storage Element 21 IMPORT/EXPORT:Full
      Storage Element 22 IMPORT/EXPORT:Empty
      Storage Element 23 IMPORT/EXPORT:Empty


Cheers
Mark

On Thu, Jul 29, 2010 at 4:53 AM, Tim Small <tim at seoss.co.uk> wrote:
> Hi,
>
> I was wondering if it's currently possible to use tgtd to pass through a
> real SCSI tape drive?  The closest I got was this:
>
> ./tgtadm -d --lld iscsi --op new --mode logicalunit --tid 3 --lun 2
> --backing-store=/dev/sg3 --bstype=sg --device-type=tape
>
> ... having patched tgtadm 1.0.6 a bit to allow it to pass that device
> type, but a probe from the initiator seemed to make tgtd crash.
>
> Is this actually possible yet, and if so, are there prerequisites in
> terms of the kernel version and code version etc.?  I couldn't find any
> reference to this in the documentation for 1.0.6, and I couldn't see a
> way to get a list of supported bstypes or device-types from tgtadm
> either.  There seemed to be more types in the code than the manual
> pages, so I just tried a few more or less at random (what's the
> different between a bsg and an sg?  A quick look at the Linux kernel
> headers didn't even seem to illuminate this)...
>
> In the meantime, I have things working using scst, but I'd prefer to go
> back to stgt if I can, as that's what I've used elsewhere (in addition
> to not requiring out-of-tree code which asks you to do weird stuff in
> /proc/).
>
> Cheers,
>
> Tim.
>
> --
> South East Open Source Solutions Limited
> Registered in England and Wales with company number 06134732.
> Registered Office: 2 Powell Gardens, Redhill, Surrey, RH1 1TQ
> VAT number: 900 6633 53  http://seoss.co.uk/ +44-(0)1273-808309
>
> --
> To unsubscribe from this list: send the line "unsubscribe stgt" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list