[CentOS] Utility to zero unused blocks on disk

Tue Feb 9 21:05:35 UTC 2016
Chris Murphy <lists at colorremedies.com>

On Mon, Feb 8, 2016 at 11:18 PM, John R Pierce <pierce at hogranch.com> wrote:
> On 2/8/2016 9:54 PM, Chris Murphy wrote:
>>
>> Secure erase is really the only thing to use on SSDs. Writing a pile
>> of zeros just increases wear (minor negative) but also doesn't
>> actually set the cells to the state required to accept a new write, so
>> you've just added a lot more work for the SSD's garbage collector and
>> wear leveling, so it's going to be slower than before you did the
>> zeroing. Secure erase on an SSD erases the cells so they're ready to
>> accept writes.
>
>
> at least one SSD I had, the vendor told me writing a full pass of zeros on
> it via dd or whatever would completely reset the garbage collection and
> effectively defrag it.

Yes it'd be "defragged" in that it has no file system at all to be
fragmented in the first place (easier done with a mkfs). But a huge
percent of the available cells on the drive (the portion not
overprivisioned) would contain valid data (zeros) as far as the drive
firmware is concerned, and those cells storing zeros are not in a
state to accept writes. So unless it's a very good SSD that's so
overprovisioned that it can perform well without the benefit of trim,
and some can, this is odd advice. It's much simpler to just do a full
device mkfs, which will do a whole device trim, and if you want you
can then use wipefs to remove that filesystem's signature.

-- 
Chris Murphy