TRIM utility

Rodney W. Grimes freebsd-rwg at pdx.rh.CN85.dnsmgr.net
Sat Nov 24 17:05:23 UTC 2018


> On 24 Nov 2018, at 15:44, Wojciech Puchar <wojtek at puchar.net> wrote:
> > 
> >> Yes. It would. That's hard with the current storage stack to do via the
> >> disk interface. And often the underlying protocols do not support partial
> >> ranges. There is no good way to do this with buf/bio interface we have. So
> > 
> > what is an actual difference between "secure erase" and trimming whole disk?

I wonder if any drive recognises a single trim command
that covers the whole drive, or if that is even possible
to do.  Or if it recognizes that all blocks are infact
in a free/trimmed state (should be easy if they have
a total block inuse counter, just watch for it to hit 0).


> It depends a lot on the device.  Some devices encrypt all blocks
> automatically, and a Secure Erase command might just throw away the key,
> not go over all the data and actively wipe it.
> 
> Most SSDs will likely also trim all the blocks to be erased, since users
> have come to expect the SSD performance to go back to the 'out of box'
> level, after such an operation.

I do not think they actually "trim" anything, I am pretty
sure they just do a full FDT re-initializse and keep the
block use counters for future allocations, in effect this
looks like you trimmed the whole drive but usually completed
in just a fex seconds or less.

Some manufactures actually recommend this procedure to
revive a drives performance that has degraded over time.

> 
> If you are lucky, the manufacturer's documentation will explain the
> specifics, but don't count on it. :)

And there is that problem :-(


-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the freebsd-hackers mailing list