2 .\" Nate Lawson. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the author nor the names of any co-contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY Nate Lawson AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .Nd usermode SCSI disk emulator
43 .Ar bus : Ns Ar target : Ns Ar lun
48 utility emulates a SCSI target device using the
51 It supports the basic commands of a direct access device, like
53 In typical operation, it opens a control device and
54 enables target mode for the specified LUN.
55 It then communicates with
56 the SIM using CCBs exchanged via
60 READ and WRITE CDBs are satisfied with the specified backing store file.
62 For performance, all backing store accesses use
66 requires a kernel compiled with
67 .Cd "options VFS_AIO" .
70 .Bl -tag -width indent
72 Enable 16 addresses if supported by the SIM.
75 Enable synchronous transfers if supported by the SIM.
78 Enable tagged queuing if supported by the SIM.
79 Default is no tagged queuing.
80 .It Fl W Cm 8 | 16 | 32
81 Enable 16 or 32 bit wide transfers if supported by the SIM.
84 Set buffer size for transfers.
85 Transfers larger than this will be split into multiple transfers.
86 .It Fl c Ar sectorsize
87 Set sector size for emulated volume.
90 Enable debugging output in
92 and its associated control device.
94 Use a different size for the emulated volume.
95 Must be less than or equal to the size of
97 If the number ends with a
105 the number is multiplied by 2^10 (1K), 2^20 (1M), 2^30 (1G), 2^40 (1T),
106 2^50 (1P) and 2^60 (1E)
111 .Bl -tag -width indent
112 .It Ar bus : Ns Ar target : Ns Ar lun
113 Attach to specified bus ID, target ID, and LUN.
115 File to use as a backing store.
118 All options default to the minimal functionality of SCSI-1.
121 checks the SIM for the requested capability before enabling target mode.
123 .Bl -tag -width ".Pa /usr/share/examples/scsi_target" -compact
126 .It Pa /usr/share/examples/scsi_target
130 Create a 5 megabyte backing store file.
132 .Dl "dd if=/dev/zero of=vol size=1m count=5"
134 Enable target mode on bus 0, target ID 1, LUN 0, using
136 as the backing store for READ6/10 and WRITE6/10 commands.
137 Only the first 1000 bytes of
140 Debugging information will be output.
141 16-bit wide transfers will be used if the SIM supports them.
143 .Dl "scsi_target -d -s 1000 -W 16 0:1:0 vol"
151 example first appeared in
154 .An Justin T. Gibbs .
158 .An Nate Lawson Aq nate@root.org .