NDA(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’– NDA(4) πŸ’–

okay bestie, so this is the Kernel Interfaces Manual page for NDA(4), and trust me, it's giving storage icon energy ✨ β€” let's get into it πŸŽ€


🌸 NAME 🌸

nda β€” the NVMe Direct Access device driver, aka the main character of your SSD's whole existence πŸ’…


✨ SYNOPSIS ✨

device nvme
device scbus

like, that's it. that's the whole summoning ritual πŸ•―οΈ


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the nda driver is literally out here providing support for direct access devices, and these babies implement the NVMe command protocol. they're attached to the system through a host adapter that's supported by the CAM subsystem. no cap, that's the whole vibe 🫢


πŸ”₯ HARDWARE πŸ”₯

the nda driver supports NVMe (Non-Volatile Memory Express) storage devices connected via PCIe or over NVMF (NVMe over Fabric) via the CAM subsystem. it's giving versatile πŸ‘‘


⭐ SYSCTL VARIABLES ⭐

these variables are available as BOTH sysctl(8) variables AND loader(8) tunables, which is honestly so convenient of them πŸ’–

  • hw.nvme.use_nvd β€” when this is set to 0, the nvme(4) driver will create nda device nodes for block storage. when it's set to 1, it creates nvd(4) device nodes for block storage instead. see nvd(4) when set to 1, iykyk πŸ’…
  • kern.cam.nda.nvd_compat β€” when this is 1, nvd(4) aliases get created for ALL nda devices, including partitions and other geom(4) providers that take their names from the disk's name. BUT (and this is important bestie) nvd(4) devices will not be reported in the kern.disks sysctl(8). noted πŸ“
  • kern.cam.nda.sort_io_queue β€” this one determines whether the software queued entries are 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 determines if the nda devices participate in the speedup protocol. when a device participates, then when the upper layers send a BIO_SPEEDUP, all current BIO_DELETE requests that haven't been sent to the hardware yet get completed successfully and immediately, WITHOUT being sent to the hardware. this is used in low disk space scenarios when the filesystem hits a critical shortage and needs blocks immediately. and 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 β€” slay, efficiency 🌈 when participation is disabled, BIO_SPEEDUP requests are just ignored, no biggie πŸ’β€β™€οΈ
  • kern.cam.nda.max_trim β€” the maximum number of LBA ranges to be collected together for each DSM trim sent to the hardware. defaults to 256, which is the max 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 between 1 and 256 inclusive β€” don't push it bestie 🚨

the following report per-device settings, and they're read-only unless otherwise indicated. replace N with the device unit number, got it? πŸ’œ

  • kern.cam.nda.N.rotating β€” reports whether the storage volume is spinning or flash. its value is hard coded to 0, indicating flash. so yeah, it's a flash girlie ⚑
  • kern.cam.nda.N.unmapped_io β€” reports whether the nda driver accepts unmapped I/O for this unit.
  • kern.cam.nda.N.flags β€” reports the current flags. and the flags are:
    • 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 after sysctl(8) nodes have been created.
  • kern.cam.nda.N.sort_io_queue β€” same as the kern.cam.nda.sort_io_queue tunable, literally the same thing πŸ’«
  • kern.cam.nda.N.trim_ticks β€” writable. when 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 and send them at one time improves trim performance. when 0, no delaying of trims is done. your call bestie ⏳
  • 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 of BIO_DELETE requests queued to the device.

🧚 NAMESPACE MAPPING 🧚

okay so each 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 a nvme(4) device are at target 0. however, the namespace ID maps to the CAM lun, as reported in kernel messages and in the devlist sub command of camcontrol(8) β€” so like, that's where you find it πŸ”

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 (thank goodness πŸ™). device nodes for nda will be created and destroyed dynamically as namespaces are activated or detached. it's giving flexible 🌸


πŸ“ FILES πŸ“

  • /dev/nda* β€” NVMe storage device nodes, the whole point πŸ’–

πŸ‘‘ SEE ALSO πŸ‘‘

cam(4), geom(4), nvd(4), nvme(4), gpart(8) β€” go read these too bestie, they're all connected 🫢


πŸ’€ HISTORY πŸ’€

the nda driver first appeared in FreeBSD 12.0. a legend was born ✨


πŸ™ˆ AUTHORS πŸ™ˆ

Warner Losh <imp@FreeBSD.org> β€” we stan 🫑


πŸ’Œ and that's the whole page bestie! this Debian version is dated October 2, 2025 and it's the NDA(4) Kernel Interfaces Manual β€” go forth and slay your NVMe game πŸ’…βœ¨πŸŽ€
πŸ“¦ where this page comes from