Hacker News new | ask | show | jobs
by nemesisrobot 3811 days ago
Almost all laptops these days come with SSDs and last I checked, OpenBSD doesn't support TRIM. Has this been fixed? Is lack of TRIM a non-issue?
4 comments

Due to TRIM bugs I just follow an advise of never using it. Rather I set aside like 5% of disk that is never touched. This works with both old and new SSD without affecting long-term performance on laptops. As an added bonus it makes full-disk encryption more sound.
I thought SSDs were integrating TRIM into the drive's firmware/controller nowadays.
That's impossible (AFAIK at least) - the drives can't know what parts of the filesystem are in use, only the OS can.
A quick Googling shows it exists only in high-end SSDs, but the information is from 2013.

Just anecdotally, my Nexus 9 does not even have the fstrim command anymore, nor do I see any discard options in the fstab. My Nexus 7 2012 had lots of interest about fstrim improving performance, but not my Nexus 9. I assumed the TRIM issue had disappeared.

Uhh... The nexus 7 and 9? You realize those have SD and MMC cards soldered to the motherboards and work /entirely/ unlike an SSD, right?

Also, the OP is right: TRIM works by telling the SSD which blocks that were previously used are now unused, so that the SSD, at a lower level, can eventually erase the larger flash sector. There is literally no way for the SSD to know this intrinsically because SSDs do not expose a filesystem interface.

Regardless of the differences, the Nexus 7 used trim (introduced in Android 4.3) on it's flash-based (SSD also uses flash) solid-state memory and my Nexus 9 does not. The trim "bug" is well known for some Android devices, but now it has died off. I was attempting to guess why.

Another quick Googling seems to say improved garbage collection (in the SSD itself) has lessened the need for fstrim.

Hopefully someone who is knowledgeable will chime in.

trim is implemented in the controller in that a controller implementing trim is capable of receiving, understanding and acting upon the trim command. It's actually issued higher up in the stack; I've only ever seen it mentioned in the context of an OS issuing the command to the drive if a file on a filesystem on the drive is deleted, or if a utility intended to issue trim against all empty blocks was run.

You're correct in that trim is less necessary if a drive has good garbage collection. I don't know anything about the implementation of either, but I would expect trim to be easier, cheaper and better than GC. It seems like GC would require work to discover/remember things provided as input w/ trim. I've assumed that GC was only implemented by vendors in their controllers because trim wasn't available in the popular OSs yet, and/or because their controllers were already doing most of the work required by GC anyway so it was cheap to implement.

Finally, you can't equate SSDs with the SD or eMMC used in some of the phones/tablets. Yes it's all flash, but an SSD is typically multi-channel with many flash modules, a DRAM cache and a much more sophisticated controller implementing a standard storage interface (AHCI/SATA or SAS or NVMe). eMMC and SD are much simpler, cheaper and slower.

Not saying that you're wrong, but SD cards for example assume that they're going to be running FAT and make assumptions/optimizations based on that.
http://www.tedunangst.com/flak/post/lessons-learned-about-TR... I do believe it supports trim, since 2011. Need to check the code if and how it's implemented today. I'm using 2 SSDs in a RAID-0 with OpenBSD for 1 year now. No problems and lightning fast.
Been using an SSD in my laptop for 6 months now... UFS / FFS doesnt really seem to fragment that much

# fsck / | grep frag 6395 files, 106651 used, 409612 free (300 frags, 51164 blocks, 0.1% fragmentation)

# fsck /usr | grep frag 396741 files, 4832173 used, 19820289 free (4953 frags, 2476917 blocks, 0.0% fragmentation)

# fsck /home | grep frag 1192199 files, 27780639 used, 3176062 free (216374 frags, 369961 blocks, 0.7% fragmentation)

The effect of fragmentation on file systems on SSDs is minimal, and fragmentation is not related to TRIM. http://askubuntu.com/a/537211/1624