1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
<table class="head">
<tr>
<td class="head-ltitle">SD(4)</td>
<td class="head-vol">Device Drivers Manual</td>
<td class="head-rtitle">SD(4)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">sd</code> — <span class="Nd">SCSI and
ATAPI disk driver</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">sd* at scsibus? target ? lun ?</code>
<br/>
<code class="Cd">sd3 at scsibus0 target 3 lun 0</code>
<br/>
<code class="Cd">sd* at atapibus? drive ? flags 0x0000</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The <code class="Nm">sd</code> driver provides support for SCSI
bus and Advanced Technology Attachment Packet Interface (ATAPI) disks. It
allows the disk to be divided up into a set of pseudo devices called
<a class="permalink" href="#partitions"><i class="Em" id="partitions">partitions</i></a>.
In general the interfaces are similar to those described by
<a class="Xr">wd(4)</a>.</p>
<p class="Pp">Where the <a class="Xr">wd(4)</a> device has a fairly low level
interface to the system, SCSI devices have a much higher level interface and
talk to the system via a SCSI host adapter (e.g., <a class="Xr">ahc(4)</a>).
A SCSI adapter must also be separately configured into the system before a
SCSI disk can be configured.</p>
<p class="Pp" id="Direct">When the SCSI adapter is probed during boot, the SCSI
bus is scanned for devices. Any devices found which answer as
‘<a class="permalink" href="#Direct"><i class="Em">Direct</i></a>’
type devices will be attached to the <code class="Nm">sd</code> driver.</p>
<p class="Pp">For the use of flags with ATAPI devices, see
<a class="Xr">wd(4)</a>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="PARTITIONING"><a class="permalink" href="#PARTITIONING">PARTITIONING</a></h1>
<p class="Pp">On many systems <a class="Xr">disklabel(8)</a> is used to
partition the drive into filesystems. On some systems the
<span class="Ux">NetBSD</span> portion of the disk resides within a native
partition, and another program is used to create the
<span class="Ux">NetBSD</span> portion.</p>
<p class="Pp">For example, the i386 port uses <a class="Xr">fdisk(8)</a> to
partition the disk into a BIOS level partition. This allows sharing the disk
with other operating systems.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="CONFIGURATION_OPTIONS"><a class="permalink" href="#CONFIGURATION_OPTIONS">CONFIGURATION
OPTIONS</a></h1>
<p class="Pp">The following <a class="Xr">config(1)</a> options may be applied
to SCSI disks as well as to other disks.</p>
<dl class="Bl-tag">
<dt id="SDRETRIES"><a class="permalink" href="#SDRETRIES"><code class="Dv">SDRETRIES</code></a></dt>
<dd>Set the number of retries that will be performed for operations it makes
sense to retry (e.g., normal reads and writes). The default is four
(4).</dd>
<dt id="SD_IO_TIMEOUT"><a class="permalink" href="#SD_IO_TIMEOUT"><code class="Dv">SD_IO_TIMEOUT</code></a></dt>
<dd>Set amount of time, in milliseconds, a normal read or write is expected to
take. The defaults is sixty seconds (60000 milliseconds). This is used to
set watchdog timers in the SCSI HBA driver to catch commands that might
have died on the device.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="IOCTLS"><a class="permalink" href="#IOCTLS">IOCTLS</a></h1>
<p class="Pp">The following <a class="Xr">ioctl(2)</a> calls apply to SCSI disks
as well as to other disks. They are defined in the header file
<code class="In"><<a class="In">sys/dkio.h</a>></code> and use data
structures defined in
<code class="In"><<a class="In">sys/disklabel.h</a>></code>.</p>
<dl class="Bl-tag">
<dt id="DIOCGDINFO"><a class="permalink" href="#DIOCGDINFO"><code class="Dv">DIOCGDINFO</code></a></dt>
<dd>Read, from the kernel, the in-core copy of the disklabel for the drive.
This may be a fictitious disklabel if the drive has never been
initialized, in which case it will contain information read from the SCSI
inquiry commands.</dd>
<dt id="DIOCSDINFO"><a class="permalink" href="#DIOCSDINFO"><code class="Dv">DIOCSDINFO</code></a></dt>
<dd>Give the driver a new disklabel to use. The driver <i class="Em">will
not</i> write the new disklabel to the disk.</dd>
<dt id="DIOCKLABEL"><a class="permalink" href="#DIOCKLABEL"><code class="Dv">DIOCKLABEL</code></a></dt>
<dd>Keep or drop the in-core disklabel on the last close.</dd>
<dt id="DIOCWLABEL"><a class="permalink" href="#DIOCWLABEL"><code class="Dv">DIOCWLABEL</code></a></dt>
<dd>Enable or disable the driver's software write protect of the disklabel on
the disk.</dd>
<dt id="DIOCWDINFO"><a class="permalink" href="#DIOCWDINFO"><code class="Dv">DIOCWDINFO</code></a></dt>
<dd>Give the driver a new disklabel to use. The driver <i class="Em">will</i>
write the new disklabel to the disk.</dd>
<dt id="DIOCLOCK"><a class="permalink" href="#DIOCLOCK"><code class="Dv">DIOCLOCK</code></a></dt>
<dd>Lock the media cartridge into the device, or unlock a cartridge previously
locked. Used to prevent user and software eject while the media is in
use.</dd>
<dt id="DIOCEJECT"><a class="permalink" href="#DIOCEJECT"><code class="Dv">DIOCEJECT</code></a></dt>
<dd>Eject the media cartridge from a removable device.</dd>
</dl>
<p class="Pp" id="ioctl">In addition, the <a class="Xr">scsi(4)</a> general
<a class="permalink" href="#ioctl"><code class="Fn">ioctl</code></a>()
commands may be used with the <code class="Nm">sd</code> driver, but only
against the ‘<code class="Li">c</code>’ (whole disk)
partition.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="NOTES"><a class="permalink" href="#NOTES">NOTES</a></h1>
<p class="Pp">If a removable device is attached to the
<code class="Nm">sd</code> driver, then the act of changing the media will
invalidate the disklabel and information held within the kernel. To avoid
corruption, all accesses to the device will be discarded until there are no
more open file descriptors referencing the device. During this period, all
new open attempts will be rejected. When no more open file descriptors
reference the device, the first next open will load a new set of parameters
(including disklabel) for the drive.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
<dl class="Bl-tag Bl-compact">
<dt><span class="Pa">/dev/sd</span><var class="Ar">u</var><var class="Ar">p</var></dt>
<dd>block mode SCSI disk unit <var class="Ar">u</var>, partition
<var class="Ar">p</var></dd>
<dt><span class="Pa">/dev/rsd</span><var class="Ar">u</var><var class="Ar">p</var></dt>
<dd>raw mode SCSI disk unit <var class="Ar">u</var>, partition
<var class="Ar">p</var></dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="DIAGNOSTICS"><a class="permalink" href="#DIAGNOSTICS">DIAGNOSTICS</a></h1>
<p class="Pp">None.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">ioctl(2)</a>, <a class="Xr">intro(4)</a>,
<a class="Xr">scsi(4)</a>, <a class="Xr">wd(4)</a>,
<a class="Xr">disklabel(5)</a>, <a class="Xr">disklabel(8)</a>,
<a class="Xr">fdisk(8)</a>, <a class="Xr">scsictl(8)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">sd</code> driver was originally written for
Mach 2.5, and was ported to <span class="Ux">FreeBSD</span> by Julian
Elischer. It was later ported to <span class="Ux">NetBSD</span>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">June 9, 2016</td>
<td class="foot-os">NetBSD 10.1</td>
</tr>
</table>
|