DA(4)
π da(4) β SCSI Direct Access device driver π
okay bestie, gather round, because this is the manual page for da, the SCSI Direct Access device driver, and it is lowkey the moment. no cap. π¦
β¨ NAME β¨
da β SCSI Direct Access device driver. it's giving "the driver that talks to your disks". periodt. π
πΈ SYNOPSIS πΈ
device da
that's it. that's the whole vibe. add that line and you're in. π
π DESCRIPTION π
so the da driver provides support for all SCSI devices of the direct access class that are attached to the system through a supported SCSI Host Adapter. and what's in the direct access class, you ask? π
- disk devices
- magneto-optical devices
- solid-state devices
all of them. the whole squad. π«Ά
β οΈ but heads up: a SCSI Host adapter must also be separately configured into the system before a SCSI direct access device can be configured. no adapter, no device. the way that works is just... the way that works. π
π CACHE EFFECTS π
many direct access devices come equipped with read and/or write caches. and the parameters affecting the device's cache are stored in mode page 8, the caching control page. you can examine and modify mode pages via the camcontrol(8) utility. β¨
π the read cache
the read cache is used to store data from device-initiated read ahead operations as well as frequently used data. and here's the slay part: the read cache is transparent to the user and can be enabled without any adverse effect. most devices with a read cache come from the factory with it enabled, iykyk.
want it off? set the RCD (Read Cache Disable) bit in the caching control mode page. boom. π¦
π₯ the write cache
okay so the write cache can greatly decrease the latency of write operations and lets the device reorganize writes to increase efficiency and performance. iconic behavior. BUT β and this is a big but β this performance gain comes at a price. π
β οΈ Should the device lose power while its cache contains uncommitted write operations, these writes will be lost. The effect of a loss of write transactions on a file system is non-deterministic and can cause corruption.
most devices age write transactions to limit vulnerability to a few transactions recently reported as complete, but it is none-the-less recommended that systems with write cache enabled devices reside on an Uninterruptible Power Supply (UPS). fr fr, get the UPS.
the da device driver ensures that the cache and media are synchronized upon final close of the device or an unexpected shutdown (panic) event. this ensures that it is safe to disconnect power once the operating system has reported that it has halted. so you can pull the plug β but only after the OS says it halted. respect the order. π
the write cache can be enabled by setting the WCE (Write Cache Enable) bit in the caching control mode page. π
β TAGGED QUEUING β
the da device driver will take full advantage of the SCSI feature known as tagged queueing. and what does that do? it allows the device to process multiple transactions concurrently, often re-ordering them to reduce the number and length of seeks. multitasking queen. π
and to ensure that transactions to distant portions of the media β which may be deferred indefinitely by servicing requests nearer the current head position β are completed in a timely fashion, an ordered tagged transaction is sent every 15 seconds during continuous device operation. every 15 seconds. clockwork. β°
π¦ BAD BLOCK RECOVERY π¦
Direct Access devices have the capability of mapping out portions of defective media. the media recovery parameters live in mode page 1, the Read-Write Error Recovery mode page.
the most important media remapping features are 'Auto Write Reallocation' and 'Auto Read Reallocation', which can be enabled via the AWRE and ARRE bits, respectively, of the Read-Write Error Recovery page. π
π many devices do not ship from the factory with these features enabled. rude, honestly.
mode pages can be examined and modified via the camcontrol(8) utility. same utility, same slay. β¨
π KERNEL CONFIGURATION π
good news: it is only necessary to explicitly configure one da device. just one. because data structures are dynamically allocated as disks are found on the SCSI bus. the kernel handles the rest, bestie. no extra work. π«Ά
π SYSCTL VARIABLES π
the following variables are available as both sysctl(8) variables and loader(8) tunables:
kern.cam.da.retry_countβ this variable determines how many times thedadriver will retry a READ or WRITE command. note: this does not affect the number of retries used during probe time or for thedadriver dump routine. this value currently defaults to 4.kern.cam.da.default_timeoutβ this variable determines how long thedadriver will wait before timing out an outstanding command. the units for this value are seconds, and the default is currently 60 seconds.kern.cam.sort_io_queuekern.cam.da.X.sort_io_queueβ these variables determine whether the request queue should be sorted trying to optimize head seeks. set to1to enable sorting,0to disable,-1to leave it as-is. the default is sorting enabled for HDDs and disabled for SSDs. different devices, different vibes. πkern.cam.da.X.delete_methodβ this variable specifies the method to handleBIO_DELETErequests:ATA_TRIMβ ATA TRIM via ATA COMMAND PASS THROUGH command,UNMAPβ UNMAP command,WS16β WRITE SAME(16) command with UNMAP flag,WS10β WRITE SAME(10) command with UNMAP flag,ZEROβ WRITE SAME(10) command without UNMAP flag,DISABLEβ disableBIO_DELETEsupport.
kern.cam.da.X.minimum_cmd_sizeβ this variable determines what the minimum READ/WRITE CDB size is for a givendaunit. valid minimum command size values are6,10,12and16bytes. the default is 6 bytes.
and here's the lore on how it actually picks: the da driver issues a CAM Path Inquiry CCB at probe time to determine whether the protocol the device in question speaks (e.g. ATAPI) typically does not allow 6 byte commands. if it does not, the da driver will default to using at least 10 byte CDBs. and if a 6 byte READ or WRITE fails with an ILLEGAL REQUEST error, the da driver will then increase the default CDB size for the device to 10 bytes and retry the command. π
CDB size is always chosen as the smallest READ/WRITE CDB that will satisfy the specified minimum command size, and the LBA and length of the READ or WRITE in question. (e.g., a write to an LBA larger than 2^32 will require a 16 byte CDB.) math is math. π§
π NOTES π
if a device becomes invalidated (media is removed, device becomes unresponsive) the disklabel and information held within the kernel about the device will be invalidated.
to avoid corruption of a newly inserted piece of media or a replacement device, all accesses to the device will be discarded until the last file descriptor referencing the old device is closed. and during this period, all new open attempts will be rejected. π«
π so like... yeah. close your fds. it's not a suggestion.
π FILES π
/dev/da*β SCSI disk device nodes
π§ DIAGNOSTICS π§
None.
literally none. nothing to report. the silence is deafening. π
π SEE ALSO π
ada(4), cam(4), geom(4), nda(4), gpart(8)
go read those too, bestie, they're all part of the extended universe. π«Ά
π HISTORY π
the da driver was written for the CAM SCSI subsystem by Justin T. Gibbs. and many ideas were gleaned from the sd device driver written and ported from Mach 2.5 by Julian Elischer. legends only. π
and that's the whole page, babes β this one came from the Debian edition of the manual, dated December 20, 2017, and it's filed under DA(4). mwah, go format a disk responsibly. π
β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1996 Julian Elischer <julian@FreeBSD.org>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms