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