Boot time TRIM ?

Eugene Grosbein eugen at grosbein.net
Wed Aug 26 01:44:34 UTC 2020


26.08.2020 3:02, Zaphod Beeblebrox wrote:

> So, as I was looking at the performance of an NVME that I use for swap and
> ZFS cache, I realized after reboot, that since ZFS cache doesn't survive
> reboot and OBVIOUSLY swap doesn't, might it be best practice to issue a
> TRIM on boot?

If you use 12.1 or newer, there is "trimonce" option for a swap in fstab(5)
and there is "swapon -E" if you need it.

> Now... a trim on the whole device from userland before adding swap in RC...
> might work.  AFAIK, we still don't have any structure to swap before it's
> added.

You may have swap partition located at the beginning of MBR slice and BSD label in first 8KB of the slice.
Swap pager does not touch first 8KB of swap area and swapon/trimonce does not touch that part, too.




More information about the freebsd-hackers mailing list