xref: /freebsd/share/man/man4/da.4 (revision dce6e6518b85561495cff38a3074a69d29d58a55)
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$
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.Sh DESCRIPTION
37The
38.Nm
39driver provides support for all
40.Tn SCSI
41devices of the direct access class that are attached to the system
42through a supported
43.Tn SCSI
44Host Adapter.
45The direct access class includes disk, magneto-optical,
46and solid-state devices.
47.Pp
48A
49.Tn SCSI
50Host
51adapter must also be separately configured into the system
52before a
53.Tn SCSI
54direct access device can be configured.
55.Sh PARTITIONING
56The
57.Nm
58driver allows the disk to have two levels of partitioning.
59One layer, called the
60.Dq slice layer ,
61is used to separate the
62.Fx
63areas of the disk from areas used by other operating systems.
64The second layer is the native
65.Bx 4.4
66partitioning scheme,
67.Xr disklabel 5 ,
68which is used to subdivide the
69.Fx
70slices into areas for individual file systems and swap spaces.
71For more information, see
72.Xr fdisk 8
73and
74.Xr disklabel 8 ,
75respectively.
76.Pp
77If an uninitialized disk is opened, the slice table will be
78initialized with a fictitious
79.Fx
80slice spanning the entire disk.
81Similarly, if an uninitialized
82(or
83.No non- Ns Fx )
84slice is opened, its disklabel will be initialized with parameters returned
85by the drive and a single
86.Sq Li c
87partition encompassing the entire slice.
88.Sh CACHE EFFECTS
89Many direct access devices are equipped with read and/or write caches.
90Parameters affecting the device's cache are stored in mode page 8,
91the caching control page.
92Mode pages can be examined and modified via the
93.Xr camcontrol 8
94utility.
95.Pp
96The read cache is used to store data from device-initiated read ahead
97operations as well as frequently used data.
98The read cache is transparent
99to the user and can be enabled without any adverse effect.  Most devices
100with a read cache come from the factory with it enabled.
101The read cache can be disabled by setting the
102.Tn RCD
103(Read Cache Disable) bit in the caching control mode page.
104.Pp
105The write cache can greatly decrease the latency of write operations
106and allows the device to reorganize writes to increase efficiency and
107performance.
108This performance gain comes at a price.
109Should the device
110lose power while its cache contains uncommitted write operations, these
111writes will be lost.
112The effect of a loss of write transactions on
113a file system is non-deterministic and can cause corruption.
114Most
115devices age write transactions to limit vulnerability to a few transactions
116recently reported as complete, but it is none-the-less recommended that
117systems with write cache enabled devices reside on an Uninterruptible
118Power Supply (UPS).
119The
120.Nm
121device driver ensures that the cache and media are synchronized upon
122final close of the device or an unexpected shutdown (panic) event.
123This ensures that it is safe to disconnect power once the operating system
124has reported that it has halted.
125The write cache can be enabled by setting the
126.Tn WCE
127(Write Cache Enable) bit in the caching control mode page.
128.Sh TAGGED QUEUING
129The
130.Nm
131device driver will take full advantage of the SCSI feature known as tagged
132queueing.
133Tagged queueing allows the device to process multiple transactions
134concurrently, often re-ordering them to reduce the number and length of
135seeks.
136To ensure that transactions to distant portions of the media,
137which may be deferred indefinitely by servicing requests nearer the current
138head position, are completed in a timely fashion, an ordered tagged
139transaction is sent every 15 seconds during continuous device operation.
140.Sh BAD BLOCK RECOVERY
141Direct Access devices have the capability of mapping out portions of
142defective media.
143Media recovery parameters are located in mode page 1,
144the Read-Write Error Recovery mode page.
145The most important media
146remapping features are 'Auto Write Reallocation' and 'Auto Read
147Reallocation' which can be enabled via the AWRE and ARRE bits,
148respectively, of the Read-Write Error Recovery page.
149Many devices do not ship from the factory with these feature enabled.
150Mode pages can be examined and modified
151via the
152.Xr camcontrol 8
153utility.
154.Sh KERNEL CONFIGURATION
155It is only necessary to explicitly configure one
156.Nm
157device; data structures are dynamically allocated as disks are found
158on the
159.Tn SCSI
160bus.
161.Sh IOCTLS
162The following
163.Xr ioctl 2
164calls apply to
165.Tn SCSI
166disks as well as to other disks.
167They are defined in the header file
168.Aq Pa sys/disklabel.h .
169.Pp
170.Bl -tag -width DIOCSDINFO
171.It Dv DIOCSBAD
172Usually used to set up a bad-block mapping system on the disk.
173.Tn SCSI
174drives incorporate their own bad-block mapping so this command is not
175implemented.
176.It Dv DIOCGDINFO
177Read, from the kernel, the in-core copy of the disklabel for the
178drive.
179This may be a fictitious disklabel if the drive has never
180been initialized, in which case it will contain information read
181from the
182.Tn SCSI
183inquiry commands.
184.It Dv DIOCSDINFO
185Give the driver a new disklabel to use.
186The driver
187.Em will not
188write the new
189disklabel to the disk.
190.It Dv DIOCWLABEL
191Enable or disable the driver's software
192write protect of the disklabel on the disk.
193.It Dv DIOCWDINFO
194Give the driver a new disklabel to use.
195The driver
196.Em will
197write the new disklabel to the disk.
198.El
199.Sh NOTES
200If a device becomes invalidated (media is removed, device becomes unresponsive)
201the disklabel and information held within the kernel about the device will
202be invalidated.
203To avoid corruption of a newly inserted piece of media or
204a replacement device, all accesses to the device will be discarded until
205the last file descriptor referencing the old device is closed.
206During this period, all new open attempts will be rejected.
207.Sh FILES
208.Bl -tag -width /dev/rsdXXXXX -compact
209.It Pa /dev/rda Ns Ar u
210raw mode
211.Tn SCSI
212disk unit
213.Ar u ,
214accessed as an unpartitioned device
215.Sm off
216.It Pa /dev/da Ar u Pa s Ar n
217.Sm on
218block mode
219.Tn SCSI
220disk unit
221.Ar u ,
222slice
223.Ar n ,
224accessed as an unpartitioned device
225.Sm off
226.It Pa /dev/rda Ar u Pa s Ar n
227.Sm on
228raw mode
229.Tn SCSI
230disk unit
231.Ar u ,
232slice
233.Ar n ,
234accessed as an unpartitioned device
235.It Pa /dev/da Ns Ar u Ns Ar p
236block mode
237.Tn SCSI
238disk unit
239.Ar u ,
240first
241.Fx
242slice, partition
243.Ar p
244.It Pa /dev/rda Ns Ar u Ns Ar p
245raw mode
246.Tn SCSI
247disk unit
248.Ar u ,
249first
250.Fx
251slice, partition
252.Ar p
253.Sm off
254.It Xo
255.Pa /dev/da
256.Ar u
257.Pa s
258.Ar n
259.Ar p
260.Xc
261.Sm on
262block mode
263.Tn SCSI
264disk unit
265.Ar u ,
266.Ar n Ns th
267slice, partition
268.Ar p
269.Sm off
270.It Xo
271.Pa /dev/rda
272.Ar u
273.Pa s
274.Ar n
275.Ar p
276.Xc
277.Sm on
278raw mode
279.Tn SCSI
280disk unit
281.Ar u ,
282.Ar n Ns th
283slice, partition
284.Ar p
285.El
286.Sh DIAGNOSTICS
287None.
288.Sh SEE ALSO
289.Xr ad 4 ,
290.Xr disklabel 5 ,
291.Xr disklabel 8 ,
292.Xr fdisk 8
293.Sh HISTORY
294The
295.Nm
296driver was written for the
297.Tn CAM
298.Tn SCSI
299subsystem by
300.An Justin T. Gibbs .
301Many ideas were gleaned from the
302.Nm sd
303device driver written and ported from
304.Tn Mach
3052.5
306by
307.An Julian Elischer .
308Support for slices was written by
309.An Bruce Evans .
310