SCSI_TARGET(8)

NAME
scsi_target - usermode SCSI disk emulator

SYNOPSIS
scsi_target [-AdST] [-b size] [-c size] [-s size] [-W num] bus:target:lun filename

DESCRIPTION
The scsi_target utility emulates a SCSI target device using the targ(4) device driver. It supports the basic commands of a direct access device, like da(4). In typical operation, it opens a control device and enables target mode for the specified LUN. It then communicates with the SIM using CCBs exchanged via read(2) and write(2). READ and WRITE CDBs are satisfied with the specified backing store file.

For performance, all backing store accesses use aio(4). Thus, scsi_target requires a kernel compiled with options VFS_AIO.

Options:

-A  Enable 16 addresses if supported by the SIM. Default is 8.

-S  Enable synchronous transfers if supported by the SIM. Default is disabled.

-T  Enable tagged queuing if supported by the SIM. Default is no tagged queuing.

-W 8 | 16 | 32
    Enable 16 or 32 bit wide transfers if supported by the SIM. Default is 8.

-b bufsize
    Set buffer size for transfers. Transfers larger than this will be split into multiple transfers.

-c sectorsize
    Set sector size for emulated volume. Default is 512.

-d  Enable debugging output in scsi_target and its associated control device.

-s volsize
    Use a different size for the emulated volume. Must be less than or equal to the size of filename.

Required arguments:

bus:target:lun
    Attach to specified bus ID, target ID, and LUN.

filename
    File to use as a backing store.

All options default to the minimal functionality of SCSI-1. To be safe, scsi_target checks the SIM for the requested capability before enabling target mode.

FILES
/dev/targ*
    Control devices.
/usr/share/examples/scsi_target
    Source directory.

EXAMPLES
Create a 5 megabyte backing store file.

    dd if=/dev/zero of=vol size=1m count=5

Enable target mode on bus 0, target ID 1, LUN 0, using vol as the backing store for READ6/10 and WRITE6/10 commands. Only the first 1000 bytes of vol will be used. Debugging information will be output. 16-bit wide transfers will be used if the SIM supports them.

    scsi_target -d -v 1000 -W 16 0:1:0 vol

SEE ALSO
scsi(4), targ(4)

AUTHORS
-nosplit The scsi_target example first appeared in FreeBSD 3.0 and was written by Justin T. Gibbs. It was rewritten for FreeBSD 5.0 by Nate Lawson <nate@root.org>.