NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SSD TRIM / "discard" works after a remount with mount -a?



On 8 March 2016 at 19:03, Swift Griggs <swiftgriggs%gmail.com@localhost> wrote:
[snip]
>
>>> 3. dd if=/dev/zero bs=4096k of=/my/affected/file/system/DELETEME.000
>>>   I'm assuming short blocks get written as partials.
>>
>> I would skip this step and the following ones. They likely do more harm
>> than good.
>
>
> I'd like to know where you are coming from on that. I get that SSDs have to
> be wear leveled, but I'm wondering what's going to happen the next time that
> I write to a block that was deleted but not properly trim'd. Wouldn't that
> cause a pause / blocking while the TRIM operation had to complete?

As I understand it TRIM doesn't actually perform any clearing
operations it just tells the SSD that the block(s) in question are
free and can be re-used.

At the filesystem level the filesystem knows which blocks are free and
used, but when it gets to the hardware level this has just decended
into 'store this block of data at this location'. In the days of
spinning rust this was fine, but as you say modern SSDs require writes
to be spread across the flash to reduce wear. TRIM allows the
operating system to inform the SSD that a particular block is free,
which allows the controller to best track usage and distribute writes.

However, if you don't have TRIM enabled then the underlying drive will
just 'fill up' until new writes just use old blocks.

The steps you outlined would probably ensure the currently used blocks
are 'trimmed', however this is done at the expense of a write cycle
for all the currently unused blocks. On modern drives this probably
makes very little difference to the overall effective life (but hence
why it's probably not worth it also). Techreport did a quite
interesting torture test, summerised here:

http://arstechnica.com/gadgets/2015/03/consumer-ssds-benchmarked-to-death-and-last-far-longer-than-rated/

(tldr; consumer drives generally last much longer than the quoted
MTBF, oh, and Samsung 850 PROs are just great!!)

Incidentally, the 'refresh' tool Samsung released for the slow
performing 840 EVOs essentially does a similar thing, it causes a full
rewrite.

Cheers,

Ian


Home | Main Index | Thread Index | Old Index