Replacing Drive with SSD

Warren Block wblock at
Sun Sep 6 16:53:20 UTC 2015

On Sun, 6 Sep 2015, Brandon J. Wandersee wrote:

> Warren Block writes:
>> The SSD keeps a map of which blocks have been written.  So writing just
>> once with dd is not a wear problem.  The problem is that now the SSD has
>> no way of knowing whether that block has real data on it or not.  So it
>> can't swap it for wear leveling.  That's what trim does--when a file is
>> deleted, the filesystem uses trim to notify the SSD that those blocks
>> are no longer in use.
> Would this also apply to a *single file* written using dd? Your SSD
> guide recommends creating a swap file from /dev/zero using dd:
>> Because the data goes through the file system, TRIM will be used, and
>> the swap file can be resized without repartitioning the SSD.
> So is the problem with dd and SSDs only relevant when targeting a whole
> block device?

Yes.  Well, really it is about writing with methods that do not track 
whether a block is in use.  When that swap file is deleted, UFS tells 
the SSD that all those blocks are no longer in use.  dd(1) does not even 
have the concept of blocks being used or not, it just copies data.

More information about the freebsd-questions mailing list