Initial import from FreeBSD RELENG_4:
[dragonfly.git] / share / man / man4 / da.4
1 .\" Copyright (c) 1996
2 .\"     Julian Elischer <julian@FreeBSD.org>.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\"
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD: src/share/man/man4/da.4,v 1.22.2.7 2001/10/01 13:07:23 dd Exp $
27 .\"
28 .Dd October 15, 1998
29 .Dt DA 4
30 .Os
31 .Sh NAME
32 .Nm da
33 .Nd SCSI Direct Access device driver
34 .Sh SYNOPSIS
35 .Cd device da
36 .Cd device da1 at scbus0 target 4 unit 0
37 .Sh DESCRIPTION
38 The
39 .Nm
40 driver provides support for all
41 .Tn SCSI
42 devices of the direct access class that are attached to the system
43 through a supported
44 .Tn SCSI
45 Host Adapter.
46 The direct access class includes disk, magneto-optical,
47 and solid-state devices.
48 .Pp
49 A
50 .Tn SCSI
51 Host
52 adapter must also be separately configured into the system
53 before a
54 .Tn SCSI
55 direct access device can be configured.
56 .Sh PARTITIONING
57 The
58 .Nm
59 driver allows the disk to have two levels of partitioning.
60 One layer, called the
61 .Dq slice layer ,
62 is used to separate the
63 .Fx
64 areas of the disk from areas used by other operating systems.
65 The second layer is the native
66 .Bx 4.4
67 partitioning scheme,
68 .Xr disklabel 5 ,
69 which is used to subdivide the
70 .Fx
71 slices into areas for individual filesystems and swap spaces.
72 For more information, see
73 .Xr fdisk 8
74 and
75 .Xr disklabel 8 ,
76 respectively.
77 .Pp
78 If an uninitialized disk is opened, the slice table will be
79 initialized with a fictitious
80 .Fx
81 slice spanning the entire disk.  Similarly, if an uninitialized
82 (or
83 .No non- Ns Fx )
84 slice is opened, its disklabel will be initialized with parameters returned
85 by the drive and a single
86 .Sq Li c
87 partition encompassing the entire slice.
88 .Sh CACHE EFFECTS
89 Many direct access devices are equipped with read and/or write caches.
90 Parameters affecting the device's cache are stored in mode page 8,
91 the caching control page.  Mode pages can be examined and modified
92 via the
93 .Xr camcontrol 8
94 utility.
95 .Pp
96 The read cache is used to store data from device-initiated read ahead
97 operations as well as frequently used data.  The read cache is transparent
98 to the user and can be enabled without any adverse effect.  Most devices
99 with a read cache come from the factory with it enabled.  The read cache
100 can be disabled by setting the
101 .Tn RCD
102 (Read Cache Disable) bit in the caching control mode page.
103 .Pp
104 The write cache can greatly decrease the latency of write operations
105 and allows the device to reorganize writes to increase efficiency and
106 performance.  This performance gain comes at a price.  Should the device
107 lose power while its cache contains uncommitted write operations, these
108 writes will be lost.  The effect of a loss of write transactions on
109 a file system is non-deterministic and can cause corruption.  Most
110 devices age write transactions to limit vulnerability to a few transactions
111 recently reported as complete, but it is none-the-less recommended that
112 systems with write cache enabled devices reside on an Uninterruptible
113 Power Supply (UPS).  The
114 .Nm
115 device driver ensures that the cache and media are synchronized upon
116 final close of the device or an unexpected shutdown (panic) event.  This
117 ensures that it is safe to disconnect power once the operating system
118 has reported that it has halted.  The write cache can be enabled by
119 setting the
120 .Tn WCE
121 (Write Cache Enable) bit in the caching control mode page.
122 .Sh TAGGED QUEUING
123 The
124 .Nm
125 device driver will take full advantage of the SCSI feature known as tagged
126 queueing.  Tagged queueing allows the device to process multiple transactions
127 concurrently, often re-ordering them to reduce the number and length of
128 seeks.  To ensure that transactions to distant portions of the media,
129 which may be deferred indefinitely by servicing requests nearer the current
130 head position, are completed in a timely fashion, an ordered tagged
131 transaction is sent every 15 seconds during continuous device operation.
132 .Sh BAD BLOCK RECOVERY
133 Direct Access devices have the capability of mapping out portions of
134 defective media.  Media recovery parameters are located in mode page 1,
135 the Read-Write Error Recovery mode page.  The most important media
136 remapping features are 'Auto Write Reallocation' and 'Auto Read
137 Reallocation' which can be enabled via the AWRE and ARRE bits,
138 respectively, of the Read-Write Error Recovery page.
139 Many devices do not ship from the factory with these feature enabled.
140 Mode pages can be examined and modifie
141 via the
142 .Xr camcontrol 8
143 utility.
144 .Sh KERNEL CONFIGURATION
145 It is only necessary to explicitly configure one
146 .Nm
147 device; data structures are dynamically allocated as disks are found
148 on the
149 .Tn SCSI
150 bus.
151 .Sh IOCTLS
152 The following
153 .Xr ioctl 2
154 calls apply to
155 .Tn SCSI
156 disks as well as to other disks.  They are defined in the header file
157 .Aq Pa sys/disklabel.h .
158 .Pp
159 .Bl -tag -width DIOCSDINFO
160 .It Dv DIOCSBAD
161 Usually used to set up a bad-block mapping system on the disk.
162 .Tn SCSI
163 drives incorporate their own bad-block mapping so this command is not
164 implemented.
165 .It Dv DIOCGDINFO
166 Read, from the kernel, the in-core copy of the disklabel for the
167 drive.
168 This may be a fictitious disklabel if the drive has never
169 been initialized, in which case it will contain information read
170 from the
171 .Tn SCSI
172 inquiry commands.
173 .It Dv DIOCSDINFO
174 Give the driver a new disklabel to use.
175 The driver
176 .Em will not
177 write the new
178 disklabel to the disk.
179 .It Dv DIOCWLABEL
180 Enable or disable the driver's software
181 write protect of the disklabel on the disk.
182 .It Dv DIOCWDINFO
183 Give the driver a new disklabel to use.
184 The driver
185 .Em will
186 write the new disklabel to the disk.
187 .El
188 .Sh NOTES
189 If a device becomes invalidated (media is removed, device becomes unresponsive)
190 the disklabel and information held within the kernel about the device will
191 be invalidated.  To avoid corruption of a newly inserted piece of media or
192 a replacement device, all accesses to the device will be discarded until
193 the last file descriptor referencing the old device is closed.  During this
194 period, all new open attempts will be rejected.
195 .Sh FILES
196 .Bl -tag -width /dev/rsdXXXXX -compact
197 .It Pa /dev/rda Ns Ar u
198 raw mode
199 .Tn SCSI
200 disk unit
201 .Ar u ,
202 accessed as an unpartitioned device
203 .Sm off
204 .It Pa /dev/da Ar u Pa s Ar n
205 .Sm on
206 block mode
207 .Tn SCSI
208 disk unit
209 .Ar u ,
210 slice
211 .Ar n ,
212 accessed as an unpartitioned device
213 .Sm off
214 .It Pa /dev/rda Ar u Pa s Ar n
215 .Sm on
216 raw mode
217 .Tn SCSI
218 disk unit
219 .Ar u ,
220 slice
221 .Ar n ,
222 accessed as an unpartitioned device
223 .It Pa /dev/da Ns Ar u Ns Ar p
224 block mode
225 .Tn SCSI
226 disk unit
227 .Ar u ,
228 first
229 .Fx
230 slice, partition
231 .Ar p
232 .It Pa /dev/rda Ns Ar u Ns Ar p
233 raw mode
234 .Tn SCSI
235 disk unit
236 .Ar u ,
237 first
238 .Fx
239 slice, partition
240 .Ar p
241 .Sm off
242 .It Xo
243 .Pa /dev/da
244 .Ar u
245 .Pa s
246 .Ar n
247 .Ar p
248 .Xc
249 .Sm on
250 block mode
251 .Tn SCSI
252 disk unit
253 .Ar u ,
254 .Ar n Ns th
255 slice, partition
256 .Ar p
257 .Sm off
258 .It Xo
259 .Pa /dev/rda
260 .Ar u
261 .Pa s
262 .Ar n
263 .Ar p
264 .Xc
265 .Sm on
266 raw mode
267 .Tn SCSI
268 disk unit
269 .Ar u ,
270 .Ar n Ns th
271 slice, partition
272 .Ar p
273 .El
274 .Sh DIAGNOSTICS
275 None.
276 .Sh SEE ALSO
277 .Xr ad 4 ,
278 .Xr disklabel 5 ,
279 .Xr disklabel 8 ,
280 .Xr fdisk 8
281 .Sh HISTORY
282 The
283 .Nm
284 driver was written for the
285 .Tn CAM
286 .Tn SCSI
287 subsystem by
288 .An Justin T. Gibbs .
289 Many ideas were gleaned from the
290 .Nm sd
291 device driver written and ported from
292 .Tn Mach
293 2.5
294 by
295 .An Julian Elischer .
296 Support for slices was written by
297 .An Bruce Evans .