FreeBSD 12.2-RELEASE-p9 trim: open failed: /dev/ada0: Operation not permitted

Kurt Hackenberg kh at panix.com
Fri Sep 3 20:49:11 UTC 2021


On 2021/09/03 16:30, David Christensen wrote:

>> It might be that a raw device could be trimmed, but perhaps there's 
>> some safety there to stop it from wiping a device that is backing a 
>> mounted filesystem.
...
> That is a good point -- the filesystem knows what blocks are in use, 
> what blocks are not in use, and when blocks are removed from use. 
> Somehow, trim(8) gets this information (from the kernel filesystem stack?).
> 
> 
> RTFM trim(8):

Do I understand correctly that you want to set a state, so that the 
filesystem, ongoing, erases a block when it frees the block?

According to that man page, the trim command does something different: 
it erases blocks immediately, unconditionally, regardless of whether 
they're in use.

The man page says:

"The trim utility erases specified region of the device."

"The whole device is erased by default..."

If you're using ZFS, perhaps you should look for a way to configure the 
ZFS filesystem to erase on free.


More information about the freebsd-questions mailing list