I was surprised by this and thought I'd share it here:

It appears that the TRIM command, enabled by trimforce, on 10.11.6 (where I
tested this) is not only invoked when volume space becomes available due to
deletion of files, but also when a disk gets mounted.

Meaning that if you store hidden data in free space on a HFS+ volume, it'll
get zeroed out as soon as it gets mounted with the TRIM command available
(not that you'd usually do that, it's just that I want to explain the
behavior).

I found this out when doing speed performance tests (
http://blog.tempel.org/2017/04/adding-fast-external-disks-to-various.html)
where I would write random data to a disk. As long as I did this via USB 3
adapters (which apparently never support TRIM), the random data remained
visible on the disk even when switching adapters. But as soon as I
connected the same disk via a Thunderbolt adapter (which always supports
TRIM as then the disk appears directly with its SATA interface, I guess),
the same blocks appear zeroed. And that only happens if the data was within
the free space of a HFS+ volume but not if it was outside any mountable
volume.

It makes sense to me to do that, as it ensures optimal performance even
after a crash or after swapping adapters, or after having used the disk on
a computer that did not support TRIM.

Is this behavior known here, or even documented?

And do other file system developers here consider using TRIM the same way?

Is there even an API to let the disk layer know about invoking TRIM on
these areas? Or does everyone have to hand-code talking to the disk
interface, issuing TRIM cmds, and hoping they don't get it wrong, i.e. can
every file system make use of the trimforce setting, or does everyone have
to bake their own?

-- 
Thomas Tempelmann, http://www.tempel.org/
Follow me on Twitter: https://twitter.com/tempelorg
Read my programming blog: http://blog.tempel.org/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (Filesystem-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/filesystem-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to