Re: newfs TRIM flag device support

From: Mark Millard <marklmi_at_yahoo.com>
Date: Fri, 16 Feb 2024 03:41:25 UTC
[Only replying to lists I subscribe to.]

On Feb 15, 2024, at 19:19, Ordinary Bit <ordinarybit@proton.me> wrote:

> I'm reading the newfs manual https://man.freebsd.org/cgi/man.cgi?newfs(8) to be able to know about the TRIM flag. In the manual under -t parameter, it mentioned about "underlying device support", what exactly is this device?

2 contrasting examples:


Example 0: Optane NVMe media (PCIe card or U.2, for example)

Optane has no need of TRIM and, so, never supports TRIM.


Example 1: microsd card media usage

A microsd card in the normal type of microsd card slot on
Small Board Computers (normally) supports TRIM. Take the
same card and put it in a USB reader/writer and use it
via USB on the same system: no TRIM is supported by
FreeBSD over USB.


FYI:

When the file system has TRIM enabled, FreeBSD put out a
notice if TRIM will not actually be used in the actual
context in use.

> Is it the host (for example, Raspberry Pi SD/eMMC host reader) or the SD/eMMC card (controller) or both?
>        -t      Turn  on the TRIM enable flag.  If enabled, and if the underly-
>       ing device supports the BIO_DELETE  command,  the  file system
>       will  send  a  delete request to the underlying device for each
>       freed block.  The trim enable flag is typically set for flash-
>       memory devices to reduce write amplification which reduces wear
>       on write-limited flash-memory and often improves long-term per-
>       formance.   Thinly provisioned storage also benefits by return-
>       ing unused blocks to the global pool.



===
Mark Millard
marklmi at yahoo.com