Solid state drives are complicated. TRIM is an operation in the SATA command set that can be used to mark specific blocks of a SSD unused, which helps the SSD retain good performance when large amounts of data have been deleted. It requires operating system support. macOS actually didn't support TRIM for quite a long time, so there's at least some drives available in the wild that cope well with not being regularly TRIMed.
NetBSD 7.0 added a
fdiscard system call, which allows portions of a device or file to be TRIMed.
discard mount option for the FFS file system has also been available for some time:
discard Use DISCARD/TRIM commands if disk and driver support
EXPERIMENTAL - negatively influences filesystem
performance by increasing fragmentation, causes free
block map inconsistency on unclean shutdown, and is
incompatible with log. If log option is also used,
discard is automatically disabled.
(per the mount(8) manual page)
The state of the art has changed over the years, and various SSD manufacturers now recommend occasional routine use of the TRIM command. So the drawbacks of mounting with
discard probably aren't worthwhile.
In February 2022, mrg committed a blkdiscard(8) command to NetBSD that utilizes the
fdiscard system call to a device or file.
According to this mailing list thread about blkdiscard, at least the
wd disk driver (used for SATA-ish drives),
dk (used for GPT partitions), and
cgd doesn't know about
fdiscard yet, so all of this might not be effective on encrypted partitions, yet.
Before (re-)installing NetBSD it's now possible to drop to a shell and TRIM a complete drive to re-initialize it before installation:
# blkdiscard -v /dev/rwd0d
(This will wipe the drive!)
It's also possible to write a blank file, then use
blkdiscard to mark sections of your drive unused:
# dd if=/dev/zero of=./testfile bs=4m count=10000
# blkdiscard -v ./testfile
This could be performed as a routine maintenance task, e.g. by cron(8).