DA(4)
πΎ da(4) β the SCSI Direct Access device driver, bestie edition
okay so this is da(4), the SCSI Direct Access device driver page from the kernel interfaces manual. if you've got a SCSI disk of literally any kind, this is your girl. let's get into it π«Ά
β¨ NAME β¨
da β the SCSI Direct Access device driver. that's it, that's the whole vibe.
π¦ SYNOPSIS π¦
device da
one line. iconic. no notes. π
πΈ DESCRIPTION πΈ
so the da driver is the one that provides support for all SCSI devices of the direct access class β and yes, that means all of them, as long as they're attached to the system through a supported SCSI Host Adapter. the direct access class includes disk, magneto-optical, and solid-state devices. the whole squad. β¨
and listen, important detail: a SCSI Host adapter must also be separately configured into the system before a SCSI direct access device can be configured. so like, can't skip that step. no shortcuts. π
π CACHE EFFECTS π
many direct access devices are equipped with read and/or write caches. parameters affecting the device's cache are stored in mode page 8, the caching control page. mode pages can be examined and modified via the camcontrol(8) utility. iykyk.
the read cache π
the read cache is used to store data from device-initiated read ahead operations as well as frequently used data. and the best 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. slay.
you can disable the read cache by setting the RCD (Read Cache Disable) bit in the caching control mode page.
the write cache π₯ (handle with care, fr fr)
okay so the write cache can greatly decrease the latency of write operations and allows the device to reorganize writes to increase efficiency and performance. sounds amazing right? well, bestie, 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). like, actually do that. seriously.
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 that's the safety net π«Ά
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. main character energy honestly. tagged queueing allows the device to process multiple transactions concurrently, often re-ordering them to reduce the number and length of seeks. obsessed.
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. lived-in detail, love that for us. β
π§ BAD BLOCK RECOVERY π§
direct access devices have the capability of mapping out portions of defective media. media recovery parameters are located 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. and here's the catch β many devices do not ship from the factory with these features enabled. rude. π
mode pages can be examined and modified via the camcontrol(8) utility.
π KERNEL CONFIGURATION π
good news: it is only necessary to explicitly configure one da device; data structures are dynamically allocated as disks are found on the SCSI bus. one and done, we love efficiency. π
π SYSCTL VARIABLES π
the following variables are available as both sysctl(8) variables and loader(8) tunables:
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.da.disable_wp_protectionβ disable detection of write-protected disks. default is disabled (detection of write-protected disks is enabled). yes, the double negative is real, don't come for me πkern.cam.da.enable_biospeedupβ enableBIO_SPEEDUPprocessing. default is enabled.kern.cam.da.enable_uma_ccbsβ use UMA for CCBs. default is enabled.kern.cam.da.poll_periodβ media polling period in seconds. default is 3 seconds.kern.cam.da.retry_countβ this variable determines how many times thedadriver will retry aREADorWRITEcommand. 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.send_orderedβ send Ordered Tags. on shutdown, step through all thedaperipheral drivers, and if the device is still open, sync the disk to physical media. default is enabled.kern.cam.sort_io_queuekern.cam.da.X.sort_io_queueβ these variables determine whether 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.kern.cam.da.X.delete_methodβ this variable specifies 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 minimumREAD/WRITECDB size is for a givendaunit. valid minimum command size values are6,10,12and16bytes. the default is 6 bytes.
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. 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.)
π 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. during this period, all new open attempts will be rejected. so like, be patient, it'll come back. π«Ά
π FILES π
/dev/da*β SCSI disk device nodes
β DIAGNOSTICS β
none. that's the whole section. nothing. silence. flawless. π
π₯ SEE ALSO π₯
ada(4), cam(4), geom(4), nda(4), gpart(8)
π HISTORY π
the da driver was written for the CAM SCSI subsystem by Justin T. Gibbs. 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 tea, bestie π¦ this page came to you courtesy of Debian, dated September 10, 2022, and it's DA(4) all the way down. go forth and configure your SCSI disks responsibly πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1996 Julian Elischer <julian@FreeBSD.org>. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms