Linux SCSI Target

What is it?

The purpose of this project is to provide a framework, or a foundation that can make developing SCSI target devices on Linux easier. The core of the framework is a Linux kernel module, scsi-target.o, that follows the SCSI Architecture Model (SAM-2) and implements (part of) the SCSI Primary Commands (SPC-2).

The core module is designed to support multiple target ports and multiple logical units. Target ports are created by modules that implement certain SCSI transport protocol standards, such as SBP-2 and iSCSI. Through a target port, a SCSI initiator, or a client, can access logical units inside the target. A logical unit contains a device that responds to SCSI service requests sent by the initiators connected through the target ports.

Device modules and protocol modules are also Linux kernel modules therefore an installation site can choose whatever suit the need.

[Top]

Status

For Linux kernel version 2.4.2x. Porting to 2.6 kernel has been planned.

SAM-2

Follows the standard, except:

SPC-2

The following SPC commands are implemented:

SBP-2

protocol-sbp2.o

Done with the following exceptions:

RBC

[Top]

Build and install

If you not comfortable with building Linux kernel modules outside the kernel source tree, or if you don't know what I am talking about, you might want to stop here and come back later.

  1. Choose the hardware.

    You need at least one of the following controller cards to run the transport protocol module of your choice:

    • IEEE 1394 (aka FireWire) for SBP-2

    If you want to try device modules other than rbc-dim.o or rbc-blk.o, you need the device driver for the specific hardware.

    Apparently, you also need to have the initiator, or the client machine, prepared. For example, install the same kind of controller card and the device driver. And make sure it works so you won't be confused by problems that are beyond the scape of Linux SCSI Target.

  2. Prepare the kernel source tree.

    You need a kernel source tree from which the system you will run the modules was built.

  3. Download the tarball and extract the source code.

  4. Modify the Makefile(s).

    The build scripts are not yet smart enough to detect your environment. You need to tell it where the kernel source tree is and architecture of the target system.

    The kernel source tree location is specified by the KERNEL variable in the file Rules.Make. The architecture is specificy by the ARCH variable in the same file. Only x86 has been tested so far.

  5. Compile.

    Before setting out to compile, you need to create a directory named as "bin" in the same directory where the file Rules.Make is. Kernel modules will be copied into the bin directory.

    make install compiles everything and "installs" the kernel modules into the abovementioned bin directory.

    I use GCC 3.3.3 from Debian unstable to compile the kernel and the modules.

  6. Install the modules.

    If you compiled the kernel modules on the target system, skip to the next step. Otherwise, you need to transfer the module files to the target system.

  7. Load the modules and plug in the cable.

    Note that the transport protocol and device modules must be loaded after the core module scsi-target.o as they depend on it.

    Now you can plug in the cable and try to access the target device. Depend on the operating system of the initiator, you probably need to "scan" the specific bus to discover the new device.

[Top]

License

All source code of this project are available under the terms of GNU General Public License. You should get a copy of the license text with the source code package.

[Top]

Download

The first release, 2.4-20040319, is out. As the release name suggests, it is for 2.4 Linux kernel and released on March 19, 2004. To download the source code, go to the project page: http://sourceforge.net/projects/lst/

[Top]

Bugs and issues

[Top]

Feedback

[Top]

Credits

Thanks to Anmar Oueja and Mark Crewson for inspiring and encouraging me to work on this project.

Special thanks to Ye Ma for helping me start the project and loaning me the hardware.

[Top]