NDA(4)
π NDA(4) β NVMe Direct Access device driver π
okay bestie, welcome to the nda manual page, from the Kernel Interfaces Manual (that's the section 4 vibe, kernel interfaces, we love her) β¨
πΈ NAME πΈ
nda β NVMe Direct Access device driver
no cap, that's the whole name. short, iconic, does exactly what it says.
π SYNOPSIS π
device nvme
device scbus
like, that's it. that's the whole summoning ritual. two lines in your kernel config and you're in business π
π¦ DESCRIPTION π¦
so the nda driver is out here providing support for direct access devices that implement the NVMe command protocol, and which are attached to the system through a host adapter that the CAM subsystem supports. that's the tea. that's the whole job. she's a driver, she does direct access, she speaks NVMe, and CAM is her ride-or-die π«Ά
β¨ SYSCTL VARIABLES β¨
these cuties are available both as sysctl(8) variables and as loader(8) tunables. yes, both. versatile queen behavior π
hw.nvme.use_nvdβ when this is set to0, thenvme(4)driver will createndadevice nodes for block storage. when it's set to1, it createsnvd(4)device nodes for block storage instead. (peepnvd(4)if you've got it set to1, okay? she's the other girl.)kern.cam.nda.nvd_compatβ set this to1andnvd(4)aliases get created for allndadevices, and that includes partitions and othergeom(4)providers that take their names from the disk's name. BUT β and this is the important part, bestie βnvddevices will not be reported in thekern.diskssysctl(8). so they're there, they're just not on the guest list πkern.cam.nda.sort_io_queueβ this one decides whether the software queued entries get sorted in LBA order or not. and honestly? sorting is almost always a waste of time. the default is to not sort. periodt.kern.cam.nda.enable_biospeedupβ this variable determines whether thendadevices participate in the speedup protocol. when a device participates in the speedup, then when the upper layers send aBIO_SPEEDUP, all currentBIO_DELETErequests that haven't yet been sent to the hardware get completed successfully and immediately, without ever being sent to the hardware. this is for low disk space scenarios when the filesystem hits a critical shortage and needs blocks right now. and here's the reasoning: since trims have maximum benefit when the LBA is unused for a long time, skipping the trim when space is needed for immediate writes results in little to no excess wear. when participation is disabled,BIO_SPEEDUPrequests are just ignored. (she said "I'm not participating" and honestly, valid.)kern.cam.nda.max_trimβ the maximum number of LBA ranges to be collected together for each DSM trims send to the hardware. defaults to256, which is the maximum number of ranges the protocol supports. sometimes poor trim performance can be mitigated by limiting the number of ranges sent to the device. this value must be between1and256inclusive. no rounding, no vibes, just those numbers π₯
okay so the next batch of variables report per-device settings, and they're read-only unless otherwise indicated. replaceNwith the device unit number. so likekern.cam.nda.0.rotating,kern.cam.nda.1.rotating, you get it π
kern.cam.nda.N.rotatingβ reports whether the storage volume is spinning or flash. its value is hard coded to0, indicating flash. she's flash and she's not being subtle about it.kern.cam.nda.N.unmapped_ioβ reports whether thendadriver accepts unmapped I/O for this unit.kern.cam.nda.N.flagsβ reports the current flags. and here's the breakdown:OPENβ the device is open.DIRTYβ set when a write to the drive is scheduled. cleared after flush commands.SCTX_INITβ an internal flag, set aftersysctl(8)nodes have been created.
kern.cam.nda.N.sort_io_queueβ same as thekern.cam.nda.sort_io_queuetunable. twins fr fr.kern.cam.nda.N.trim_ticksβ writable. when it's greater than zero, hold trims for up to this many ticks before sending to the drive. sometimes waiting a little bit to collect more trims to send at one time improves trim performance. when it's0, no delaying of trims is done. patience is a virtue but only sometimes π§kern.cam.nda.N.trim_goalβ writable. when delaying a bit to collect multiple trims, send the accumulated DSM TRIM to the drive.kern.cam.nda.N.trim_lbasβ total number of LBAs that have been trimmed.kern.cam.nda.N.trim_rangesβ total number of LBA ranges that have been trimmed.kern.cam.nda.N.trim_countβ total number of trims sent to the hardware.kern.cam.nda.N.deletesβ total number ofBIO_DELETErequests queued to the device.
π NAMESPACE MAPPING π
every nvme(4) drive has one or more namespaces associated with it. one instance of the nda driver gets created for each of the namespaces on the drive. all the nda nodes for an nvme(4) device are at target 0. HOWEVER β and this is the plot twist β the namespace ID maps to the CAM lun, as reported in kernel messages and in the devlist sub command of camcontrol(8). iykyk π
namespaces are managed with the ns sub command of nvmecontrol(8). not all drives support namespace management, but all drives support at least one namespace. and device nodes for nda will be created and destroyed dynamically as namespaces are activated or detached. she's flexible like that π
π FILES π
/dev/nda*β NVMe storage device nodes
π SEE ALSO π
cam(4), geom(4), nvd(4), nvme(4), gpart(8)
go read those too bestie, they're all in the group chat πΈ
β HISTORY β
the nda driver first appeared in FreeBSD 12.0. a legend from day one, no cap.
π«Ά AUTHORS π«Ά
Warner Losh <imp@FreeBSD.org>
and that's the whole page, bestie!! this one came from the Debian side of the family, dated June 6, 2020 β so go forth, mount your NVMe, respect the max_trim bounds of 1 to 256 inclusive, and remember: don't sort the I/O queue. it's almost always a waste of time πβ¨ππ¦
π¦ 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) 2017 Netflix, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms