186d7f5d3SJohn Marino.\" Copyright (c) 1996 286d7f5d3SJohn Marino.\" Julian Elischer <julian@FreeBSD.org>. All rights reserved. 386d7f5d3SJohn Marino.\" 486d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without 586d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions 686d7f5d3SJohn Marino.\" are met: 786d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 886d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer. 986d7f5d3SJohn Marino.\" 1086d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 1186d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 1286d7f5d3SJohn Marino.\" documentation and/or other materials provided with the distribution. 1386d7f5d3SJohn Marino.\" 1486d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1586d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1686d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1786d7f5d3SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1886d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1986d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2086d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2186d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2286d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2386d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2486d7f5d3SJohn Marino.\" SUCH DAMAGE. 2586d7f5d3SJohn Marino.\" 2686d7f5d3SJohn Marino.\" $FreeBSD: src/share/man/man4/da.4,v 1.22.2.7 2001/10/01 13:07:23 dd Exp $ 2786d7f5d3SJohn Marino.\" $DragonFly: src/share/man/man4/da.4,v 1.7 2008/05/02 02:05:05 swildner Exp $ 2886d7f5d3SJohn Marino.\" 2986d7f5d3SJohn Marino.Dd October 15, 1998 3086d7f5d3SJohn Marino.Dt DA 4 3186d7f5d3SJohn Marino.Os 3286d7f5d3SJohn Marino.Sh NAME 3386d7f5d3SJohn Marino.Nm da 3486d7f5d3SJohn Marino.Nd SCSI Direct Access device driver 3586d7f5d3SJohn Marino.Sh SYNOPSIS 3686d7f5d3SJohn Marino.Cd device da 3786d7f5d3SJohn Marino.Cd device da1 at scbus0 target 4 unit 0 3886d7f5d3SJohn Marino.Sh DESCRIPTION 3986d7f5d3SJohn MarinoThe 4086d7f5d3SJohn Marino.Nm 4186d7f5d3SJohn Marinodriver provides support for all 4286d7f5d3SJohn Marino.Tn SCSI 4386d7f5d3SJohn Marinodevices of the direct access class that are attached to the system 4486d7f5d3SJohn Marinothrough a supported 4586d7f5d3SJohn Marino.Tn SCSI 4686d7f5d3SJohn MarinoHost Adapter. 4786d7f5d3SJohn MarinoThe direct access class includes disk, magneto-optical, 4886d7f5d3SJohn Marinoand solid-state devices. 4986d7f5d3SJohn Marino.Pp 5086d7f5d3SJohn MarinoA 5186d7f5d3SJohn Marino.Tn SCSI 5286d7f5d3SJohn MarinoHost 5386d7f5d3SJohn Marinoadapter must also be separately configured into the system 5486d7f5d3SJohn Marinobefore a 5586d7f5d3SJohn Marino.Tn SCSI 5686d7f5d3SJohn Marinodirect access device can be configured. 5786d7f5d3SJohn Marino.Sh PARTITIONING 5886d7f5d3SJohn MarinoThe 5986d7f5d3SJohn Marino.Nm 6086d7f5d3SJohn Marinodriver allows the disk to have two levels of partitioning. 6186d7f5d3SJohn MarinoOne layer, called the 6286d7f5d3SJohn Marino.Dq slice layer , 6386d7f5d3SJohn Marinois used to separate the 6486d7f5d3SJohn Marino.Dx 6586d7f5d3SJohn Marinoareas of the disk from areas used by other operating systems. 6686d7f5d3SJohn MarinoThe second layer is the native 6786d7f5d3SJohn Marino.Bx 4.4 6886d7f5d3SJohn Marinopartitioning scheme, 6986d7f5d3SJohn Marino.Xr disklabel 5 , 7086d7f5d3SJohn Marinowhich is used to subdivide the 7186d7f5d3SJohn Marino.Dx 7286d7f5d3SJohn Marinoslices into areas for individual filesystems and swap spaces. 7386d7f5d3SJohn MarinoFor more information, see 7486d7f5d3SJohn Marino.Xr fdisk 8 7586d7f5d3SJohn Marinoand 7686d7f5d3SJohn Marino.Xr disklabel 8 , 7786d7f5d3SJohn Marinorespectively. 7886d7f5d3SJohn Marino.Pp 7986d7f5d3SJohn MarinoIf an uninitialized disk is opened, the slice table will be 8086d7f5d3SJohn Marinoinitialized with a fictitious 8186d7f5d3SJohn Marino.Dx 8286d7f5d3SJohn Marinoslice spanning the entire disk. Similarly, if an uninitialized 8386d7f5d3SJohn Marino(or 8486d7f5d3SJohn Marino.No non- Ns Dx ) 8586d7f5d3SJohn Marinoslice is opened, its disklabel will be initialized with parameters returned 8686d7f5d3SJohn Marinoby the drive and a single 8786d7f5d3SJohn Marino.Sq Li c 8886d7f5d3SJohn Marinopartition encompassing the entire slice. 8986d7f5d3SJohn Marino.Sh CACHE EFFECTS 9086d7f5d3SJohn MarinoMany direct access devices are equipped with read and/or write caches. 9186d7f5d3SJohn MarinoParameters affecting the device's cache are stored in mode page 8, 9286d7f5d3SJohn Marinothe caching control page. Mode pages can be examined and modified 9386d7f5d3SJohn Marinovia the 9486d7f5d3SJohn Marino.Xr camcontrol 8 9586d7f5d3SJohn Marinoutility. 9686d7f5d3SJohn Marino.Pp 9786d7f5d3SJohn MarinoThe read cache is used to store data from device-initiated read ahead 9886d7f5d3SJohn Marinooperations as well as frequently used data. The read cache is transparent 9986d7f5d3SJohn Marinoto the user and can be enabled without any adverse effect. Most devices 10086d7f5d3SJohn Marinowith a read cache come from the factory with it enabled. The read cache 10186d7f5d3SJohn Marinocan be disabled by setting the 10286d7f5d3SJohn Marino.Tn RCD 10386d7f5d3SJohn Marino(Read Cache Disable) bit in the caching control mode page. 10486d7f5d3SJohn Marino.Pp 10586d7f5d3SJohn MarinoThe write cache can greatly decrease the latency of write operations 10686d7f5d3SJohn Marinoand allows the device to reorganize writes to increase efficiency and 10786d7f5d3SJohn Marinoperformance. This performance gain comes at a price. Should the device 10886d7f5d3SJohn Marinolose power while its cache contains uncommitted write operations, these 10986d7f5d3SJohn Marinowrites will be lost. The effect of a loss of write transactions on 11086d7f5d3SJohn Marinoa file system is non-deterministic and can cause corruption. Most 11186d7f5d3SJohn Marinodevices age write transactions to limit vulnerability to a few transactions 11286d7f5d3SJohn Marinorecently reported as complete, but it is none-the-less recommended that 11386d7f5d3SJohn Marinosystems with write cache enabled devices reside on an Uninterruptible 11486d7f5d3SJohn MarinoPower Supply (UPS). The 11586d7f5d3SJohn Marino.Nm 11686d7f5d3SJohn Marinodevice driver ensures that the cache and media are synchronized upon 11786d7f5d3SJohn Marinofinal close of the device or an unexpected shutdown (panic) event. This 11886d7f5d3SJohn Marinoensures that it is safe to disconnect power once the operating system 11986d7f5d3SJohn Marinohas reported that it has halted. The write cache can be enabled by 12086d7f5d3SJohn Marinosetting the 12186d7f5d3SJohn Marino.Tn WCE 12286d7f5d3SJohn Marino(Write Cache Enable) bit in the caching control mode page. 12386d7f5d3SJohn Marino.Sh TAGGED QUEUING 12486d7f5d3SJohn MarinoThe 12586d7f5d3SJohn Marino.Nm 12686d7f5d3SJohn Marinodevice driver will take full advantage of the SCSI feature known as tagged 12786d7f5d3SJohn Marinoqueueing. Tagged queueing allows the device to process multiple transactions 12886d7f5d3SJohn Marinoconcurrently, often re-ordering them to reduce the number and length of 12986d7f5d3SJohn Marinoseeks. To ensure that transactions to distant portions of the media, 13086d7f5d3SJohn Marinowhich may be deferred indefinitely by servicing requests nearer the current 13186d7f5d3SJohn Marinohead position, are completed in a timely fashion, an ordered tagged 13286d7f5d3SJohn Marinotransaction is sent every 15 seconds during continuous device operation. 13386d7f5d3SJohn Marino.Sh BAD BLOCK RECOVERY 13486d7f5d3SJohn MarinoDirect Access devices have the capability of mapping out portions of 13586d7f5d3SJohn Marinodefective media. Media recovery parameters are located in mode page 1, 13686d7f5d3SJohn Marinothe Read-Write Error Recovery mode page. The most important media 13786d7f5d3SJohn Marinoremapping features are 'Auto Write Reallocation' and 'Auto Read 13886d7f5d3SJohn MarinoReallocation' which can be enabled via the AWRE and ARRE bits, 13986d7f5d3SJohn Marinorespectively, of the Read-Write Error Recovery page. 14086d7f5d3SJohn MarinoMany devices do not ship from the factory with these feature enabled. 14186d7f5d3SJohn MarinoMode pages can be examined and modified via the 14286d7f5d3SJohn Marino.Xr camcontrol 8 14386d7f5d3SJohn Marinoutility. 14486d7f5d3SJohn Marino.Sh KERNEL CONFIGURATION 14586d7f5d3SJohn MarinoIt is only necessary to explicitly configure one 14686d7f5d3SJohn Marino.Nm 14786d7f5d3SJohn Marinodevice; data structures are dynamically allocated as disks are found 14886d7f5d3SJohn Marinoon the 14986d7f5d3SJohn Marino.Tn SCSI 15086d7f5d3SJohn Marinobus. 15186d7f5d3SJohn Marino.Sh IOCTLS 15286d7f5d3SJohn MarinoThe following 15386d7f5d3SJohn Marino.Xr ioctl 2 15486d7f5d3SJohn Marinocalls apply to 15586d7f5d3SJohn Marino.Tn SCSI 15686d7f5d3SJohn Marinodisks as well as to other disks. They are defined in the header file 15786d7f5d3SJohn Marino.In sys/disklabel.h . 15886d7f5d3SJohn Marino.Bl -tag -width ".Dv DIOCSDINFO" 15986d7f5d3SJohn Marino.It Dv DIOCSBAD 16086d7f5d3SJohn MarinoUsually used to set up a bad-block mapping system on the disk. 16186d7f5d3SJohn Marino.Tn SCSI 16286d7f5d3SJohn Marinodrives incorporate their own bad-block mapping so this command is not 16386d7f5d3SJohn Marinoimplemented. 16486d7f5d3SJohn Marino.It Dv DIOCGDINFO 16586d7f5d3SJohn MarinoRead, from the kernel, the in-core copy of the disklabel for the 16686d7f5d3SJohn Marinodrive. 16786d7f5d3SJohn MarinoThis may be a fictitious disklabel if the drive has never 16886d7f5d3SJohn Marinobeen initialized, in which case it will contain information read 16986d7f5d3SJohn Marinofrom the 17086d7f5d3SJohn Marino.Tn SCSI 17186d7f5d3SJohn Marinoinquiry commands. 17286d7f5d3SJohn Marino.It Dv DIOCSDINFO 17386d7f5d3SJohn MarinoGive the driver a new disklabel to use. 17486d7f5d3SJohn MarinoThe driver 17586d7f5d3SJohn Marino.Em will not 17686d7f5d3SJohn Marinowrite the new 17786d7f5d3SJohn Marinodisklabel to the disk. 17886d7f5d3SJohn Marino.It Dv DIOCWLABEL 17986d7f5d3SJohn MarinoEnable or disable the driver's software 18086d7f5d3SJohn Marinowrite protect of the disklabel on the disk. 18186d7f5d3SJohn Marino.It Dv DIOCWDINFO 18286d7f5d3SJohn MarinoGive the driver a new disklabel to use. 18386d7f5d3SJohn MarinoThe driver 18486d7f5d3SJohn Marino.Em will 18586d7f5d3SJohn Marinowrite the new disklabel to the disk. 18686d7f5d3SJohn Marino.El 18786d7f5d3SJohn Marino.Sh NOTES 18886d7f5d3SJohn MarinoIf a device becomes invalidated (media is removed, device becomes unresponsive) 18986d7f5d3SJohn Marinothe disklabel and information held within the kernel about the device will 19086d7f5d3SJohn Marinobe invalidated. To avoid corruption of a newly inserted piece of media or 19186d7f5d3SJohn Marinoa replacement device, all accesses to the device will be discarded until 19286d7f5d3SJohn Marinothe last file descriptor referencing the old device is closed. During this 19386d7f5d3SJohn Marinoperiod, all new open attempts will be rejected. 19486d7f5d3SJohn Marino.Sh FILES 19586d7f5d3SJohn Marino.Bl -tag -width /dev/rsdXXXXX -compact 19686d7f5d3SJohn Marino.It Pa /dev/rda Ns Ar u 19786d7f5d3SJohn Marinoraw mode 19886d7f5d3SJohn Marino.Tn SCSI 19986d7f5d3SJohn Marinodisk unit 20086d7f5d3SJohn Marino.Ar u , 20186d7f5d3SJohn Marinoaccessed as an unpartitioned device 20286d7f5d3SJohn Marino.Sm off 20386d7f5d3SJohn Marino.It Pa /dev/da Ar u Pa s Ar n 20486d7f5d3SJohn Marino.Sm on 20586d7f5d3SJohn Marinoblock mode 20686d7f5d3SJohn Marino.Tn SCSI 20786d7f5d3SJohn Marinodisk unit 20886d7f5d3SJohn Marino.Ar u , 20986d7f5d3SJohn Marinoslice 21086d7f5d3SJohn Marino.Ar n , 21186d7f5d3SJohn Marinoaccessed as an unpartitioned device 21286d7f5d3SJohn Marino.Sm off 21386d7f5d3SJohn Marino.It Pa /dev/rda Ar u Pa s Ar n 21486d7f5d3SJohn Marino.Sm on 21586d7f5d3SJohn Marinoraw mode 21686d7f5d3SJohn Marino.Tn SCSI 21786d7f5d3SJohn Marinodisk unit 21886d7f5d3SJohn Marino.Ar u , 21986d7f5d3SJohn Marinoslice 22086d7f5d3SJohn Marino.Ar n , 22186d7f5d3SJohn Marinoaccessed as an unpartitioned device 22286d7f5d3SJohn Marino.It Pa /dev/da Ns Ar u Ns Ar p 22386d7f5d3SJohn Marinoblock mode 22486d7f5d3SJohn Marino.Tn SCSI 22586d7f5d3SJohn Marinodisk unit 22686d7f5d3SJohn Marino.Ar u , 22786d7f5d3SJohn Marinofirst 22886d7f5d3SJohn Marino.Dx 22986d7f5d3SJohn Marinoslice, partition 23086d7f5d3SJohn Marino.Ar p 23186d7f5d3SJohn Marino.It Pa /dev/rda Ns Ar u Ns Ar p 23286d7f5d3SJohn Marinoraw mode 23386d7f5d3SJohn Marino.Tn SCSI 23486d7f5d3SJohn Marinodisk unit 23586d7f5d3SJohn Marino.Ar u , 23686d7f5d3SJohn Marinofirst 23786d7f5d3SJohn Marino.Dx 23886d7f5d3SJohn Marinoslice, partition 23986d7f5d3SJohn Marino.Ar p 24086d7f5d3SJohn Marino.Sm off 24186d7f5d3SJohn Marino.It Xo 24286d7f5d3SJohn Marino.Pa /dev/da 24386d7f5d3SJohn Marino.Ar u 24486d7f5d3SJohn Marino.Pa s 24586d7f5d3SJohn Marino.Ar n 24686d7f5d3SJohn Marino.Ar p 24786d7f5d3SJohn Marino.Xc 24886d7f5d3SJohn Marino.Sm on 24986d7f5d3SJohn Marinoblock mode 25086d7f5d3SJohn Marino.Tn SCSI 25186d7f5d3SJohn Marinodisk unit 25286d7f5d3SJohn Marino.Ar u , 25386d7f5d3SJohn Marino.Ar n Ns th 25486d7f5d3SJohn Marinoslice, partition 25586d7f5d3SJohn Marino.Ar p 25686d7f5d3SJohn Marino.Sm off 25786d7f5d3SJohn Marino.It Xo 25886d7f5d3SJohn Marino.Pa /dev/rda 25986d7f5d3SJohn Marino.Ar u 26086d7f5d3SJohn Marino.Pa s 26186d7f5d3SJohn Marino.Ar n 26286d7f5d3SJohn Marino.Ar p 26386d7f5d3SJohn Marino.Xc 26486d7f5d3SJohn Marino.Sm on 26586d7f5d3SJohn Marinoraw mode 26686d7f5d3SJohn Marino.Tn SCSI 26786d7f5d3SJohn Marinodisk unit 26886d7f5d3SJohn Marino.Ar u , 26986d7f5d3SJohn Marino.Ar n Ns th 27086d7f5d3SJohn Marinoslice, partition 27186d7f5d3SJohn Marino.Ar p 27286d7f5d3SJohn Marino.El 27386d7f5d3SJohn Marino.Sh DIAGNOSTICS 27486d7f5d3SJohn MarinoNone. 27586d7f5d3SJohn Marino.Sh SEE ALSO 27686d7f5d3SJohn Marino.Xr ad 4 , 27786d7f5d3SJohn Marino.Xr disklabel 5 , 27886d7f5d3SJohn Marino.Xr disklabel 8 , 27986d7f5d3SJohn Marino.Xr fdisk 8 28086d7f5d3SJohn Marino.Sh HISTORY 28186d7f5d3SJohn MarinoThe 28286d7f5d3SJohn Marino.Nm 28386d7f5d3SJohn Marinodriver was written for the 28486d7f5d3SJohn Marino.Tn CAM 28586d7f5d3SJohn Marino.Tn SCSI 28686d7f5d3SJohn Marinosubsystem by 28786d7f5d3SJohn Marino.An Justin T. Gibbs . 28886d7f5d3SJohn MarinoMany ideas were gleaned from the 28986d7f5d3SJohn Marino.Nm sd 29086d7f5d3SJohn Marinodevice driver written and ported from 29186d7f5d3SJohn Marino.Tn Mach 29286d7f5d3SJohn Marino2.5 29386d7f5d3SJohn Marinoby 29486d7f5d3SJohn Marino.An Julian Elischer . 29586d7f5d3SJohn MarinoSupport for slices was written by 29686d7f5d3SJohn Marino.An Bruce Evans . 297