SCSI-to-USB Bridge for Mass Storage Devices

With the SCSG device type you can use USB drives like SCSI drives. This device maps SCSI devices to the generic SCSI driver of Linux (SG 3). Therefore, SCSG can represent any drive supported by this driver, in particular USB mass storage devices. SCSI commands are not emulated, but they are directly sent to the connected device.

Attaching SCSG devices

The SCSG type expects a device file /dev/sg* as a parameter. Linux automatically creates these device files when a device supported by the Linux SG driver is connected, e.g. a USB stick, a USB hard drive or a USB DVD drive. Even USB floppy disk drives and SATA drives at a USB-to-SATA adapter have successfully been tested.
lsscsi lists all devices available for a bridge and the respective device files:

>lsscsi --generic
[0:0:0:0]    disk    Y-E DATA USB-FDU          4.01  /dev/sdc   /dev/sg3
[1:0:0:0]    disk    Generic  MassStorageClass 2011  /dev/sda   /dev/sg0
[1:0:0:1]    disk    Generic  MassStorageClass 2011  /dev/sdb   /dev/sg1
[2:0:0:0]    cd/dvd  TSSTcorp CDDVDW SN-208AB  LA02  /dev/sr0   /dev/sg2

With this information you can create bridges for USB devices, which for the computer appear to be SCSI devices:

>s2p -i 0 /dev/sg0 -i 4 /dev/sg3 -i 4:1 /dev/sg2
>s2pctl -l
+--------+------+-------------------------------------------
| ID:LUN | Type | Image File/Device File/Description
+--------+------+-------------------------------------------
|  0:0   | SCSG | /dev/sg0 (Generic  MassStorageClass 2011)
|  4:0   | SCSG | /dev/sg3 (Y-E DATA USB-FDU          4.01)
|  4:1   | SCSG | /dev/sg2 (TSSTcorp CDDVDW SN-208AB  LA02)
+--------+------+-------------------------------------------

There are no image files with the SCSG device type. s2p forwards all SCSI commands directly to a connected device. SCSG therefore does not emulate a particular device, but represents a real device connected to the Pi.

SCSI-to-USB bridge with IDE and SATA drives

With a USB adapter you can also use IDE and SATA drives. How well this works depends on the adapter and the respective device. With a Linux PC, the SCSI2Pi SCSI-to-USB bridge and a SATA DVD writer it was even possible to burn DVDs. But there are also drives that do not work that well.

Formatting floppy disks with USB floppy disk drives

With s2pformat you can format floppy disks or other media, not only on the Pi but also on a regular Linux PC with USB floppy disk drive. In case a drive supports several formats s2pformat offers a choice.

>s2pformat /dev/sg7
Vendor:   'Y-E DATA'
Product:  'USB-FDU         '
Revision: '4.01'
Current number of sectors: 2880
Current sector size: 512
Select a format, press Enter without input to quit:
  1. 2880 sectors, 512 bytes per sector
  2. 1232 sectors, 1024 bytes per sector
  3. 2400 sectors, 512 bytes per sector
1
Format with 2880 sectors, 512 bytes per sector? (N/y)
y
Are you sure? Formatting will erase all data and may take long. (N/y)
y

After formatting you have to create a filesystem, e.g. with mkfs.

With an Atari and the driver package HDDRIVER you can format floppy disks without an additional tool.

Adjusting the SCSI level

Some USB devices support much newer SCSI versions than SCSI-2:

>s2pdump -g /dev/sg7 -I
Checking device corresponding to Linux SG driver device file '/dev/sg7'

INQUIRY product data:
Vendor:               'Generic '
Product:              'MassStorageClass'
Revision:             '2011'
Device Type:          Direct Access
SCSI Level:           SPC-4
Response Data Format: SCSI-2
Removable:            Yes
...

With drivers that do not support new standards the s2p option --scsi-level may help, which permits a "downgrade" of the SCSI version. The device name can be changed with --name.
HDDRIVER is a driver package for Atari computers that also supports up to date SCSI levels. HDDRIVER and the related tools even make use of new SCSI commands for optimizations.