SSD / NVMe - Bits need to be rewritten to maintain performance and integrity

Consider a larger video, over time the speed it reads at falls but no errors develop. Rewriting this file will restore that performance, i.e. cell charge is restored, whether it is the same cell that is rewritten or the data is remapped. I don’t believe just reading a non faulty cell/sector restores cell charges.

Yes there is a write cost but I am not proposing running this once a week, maybe once a year on specific files, but perhaps it warrants some further research as static storage on SSD is becoming more Popular.

Thanks

Is this true for HDDs as well, albeit with a different underlying technology? It may not be user-facing, but don’t HDDs have their own (limited) spare LBA’s reserved for this?

Maybe I’m remembering it incorrectly.

My two cents - if this is really bothering you as a serious issue, I’d imagine a script that does the following run manually as you see fit would ‘solve’ this ‘issue’:

  • disable & delete old snapshots
  • copy file, delete original, rename copy to same name as original
  • repeat above for each file, 1 by 1
  • re-enable snapshots
  • create snapshot

*snapshots stopped because I’m assuming that these changes could quickly fill the entire usable space of targeted drive

I uhh, can’t say that I’d ever want this to be a built-in feature, nor can I imagine that enterprise customers would ever want something like that as a baked-in gui feature on a production device.

The only way I can imagine that ssd firmware & scrubs aren’t enough is if files were written to ssd, which was then removed from all power sources, and then whatever time threshold was crossed for this to become a real problem before files were attempted to be read again.

I’m not trying to dismiss your concerns, but I’ve never seen or experienced this to be a problem in consumer or enterprise world.

Wow, this is a fairly long thread about SSD’s and if the data needs to be rewritten to stability and ensure optimized I/O speed.

I personally do not see this as a problem. How much does a SSD slow down? a few nanoseconds? Is it real world noticeable?

I do believe that if TrueNAS (the company) sees a problem of that nature, they will do whatever it takes to keep the paying customers happy. But while I understand why this thread was written, I think if there was a real problem, it would be a significant topic and I think the drive manufacturers would address it, if for nothing more than to say they have a SSD which retains data longer than everyone else. I’m pretty sure they already have. But I am not an authority on SSD’s.

I’m pretty sure this horse is dead as well. But it was an informative read for me, these are good things to discuss and everyone will not be on the same page, but that is okay too.

In theory, this is a real problem. But, in my opinion, nothing I would want to do anything about. Other than purchase SSDs from well known manufacturers, which hopefully have good enough firmware to take care of it.

It is my understanding when reading a SSD cell, if the voltage levels are marginal, but not failed, the A/D converter and firmware reading the cell has to interpret the voltage as a 1 or 0. (If using multi-level, then however many levels are in the cell… 00->11, etc…)

In theory, this could take time to compare the marginal cell value(s) to a table for interpretation. Yet a freshly written cell probably needs next to no additional time to determine the data in the cell.

However, doing a full, once a year re-write of all data seems to be quite unneeded. With or without any ZFS redundancy.

Leaving it up to the user sounds like it would be easy for any computer professional to implement once a year. And any non-computer person would still be at the mercy of NAS software, ZFS, OS and SSD firmware.

  • it makes no difference if the SSD remains powered on or just left in a box, degregation still happens.
  • The solution would be similar to a scrub but each zfs cluster unit that is over X number of days is re-written.

Just to add a small, real-world data point on the issue.

Old Samsung 840 (both normal and EVO) and 850 EVO SSD still seem to have some issue with this. Before firmware update, they didn’t do rewrites even after encountering marginal reads. After firmware updates they do rewrites, but the definition of “marginal” is such that at that point read speed is measured in kilobytes rather than megabytes.

How soon this happens depends at least on amount of bytes written to disk. Heavily used disks will approach marginal state faster. It’s possible to refresh them by rewriting all data, but that of course makes the total SSD degradation worse.

For anything newer than Samsung 850 EVO we haven’t seen the issue at problematic level. Doing a whole disk read about once per two years does show slowdown on some SSDs (this is on Windows, so no automatic scrubbing). Do the read again next day and the slowdown is gone.

We have several servers that (as expected for their workloads) burn through SSDs in couple of years. Even for SSDs nearing end of their life we have not seen problematic behavior that wouldn’t be corrected by just reading all the data.

tl;dr: I think what mr. Gibson is talking about was a real issue for some earlish SSDs. Who knows, if it’s an issue for some still, but it’s definitely not common enough that doing automatic rewrites (and thus reducing SSD lifetime) would make sense.

-JLarja

To me it seems as if @shoulders hasn’t properly read or understood @HoneyBadger’s explanation.
If SSD firmware does detect marginal charges on read and then rewrites the cells themselves (which I believe to be true fopr most reputable SSDs) then a full read during a scrub will rewrite all “rotten” cells or, if the SSD fails to do so, ZFS will.
This should eliminate any issue caused by bitrot before it actually becomes a problem, as long as there are regular scrubs (regular meaning at least once a year probably).
I think thats basically what @HoneyBadger said.

If, for some reason, that is still not enough for some usecase, shouldn’t zfs rewrite which will come to TrueNAS with OpenZFS 2.4.0 (in 26.04 I think?) basically be the feature that @shoulders wants (needed or not)?

Not bitrot, cell charge, but I will leave it at that.

If I understood everything here correctly if the cell charge decreased enough over time the cell will become unreadable which is then called bitrot. The potential performance decrease should also be eliminated if the marginal cells get rewritten from firmware during a scrub.

That’s correct, but between “full” cell charge and the point it fails “bitrot” I am saying that I think there is a performance drop in read speeds.

So your data is never at risk because of how zfs and potential a SSD works but there is a performance drop.

…and that point should be where the firmware detects a marginal charge (not yet bitrot - still readable) and rewrite the data for you without ZFS noticing.
Do you think there is already a read performance impact before the charge becomes marginal?
Otherwise we’re running in circles here.
And if you think so and it’s actually an issue for you: as I said, zfs rewrite should solve this.

Yes.

If I am wrong about this so be it, but it is the issue I am raising.

Thanks

Okay, and shouldn’t this, be it true and/or noticable or not, be mitigated by running a zfs rewrite once a year?

looks like it, thanks.

From bing. It also mentions block allocation which is another performance issue with SSDs that can be fixed by rewrites especially when you are using multi-level nand technology, but I am aware it is on about ZFS blocks here, however the rewrites would cause other SSD cells to be used.

The zfs rewrite command in OpenZFS allows you to re-read and re-write existing data blocks without changing file metadata. It’s useful for applying new compression settings, rebalancing data after adding vdevs, or refreshing block allocation for performance reasons.

P.S. I am not a drive expert

Additional Thoughts

  • I wonder if zfs rewrite is used anywhere in TrueNAS for other things, perhaps it should be, unders something like Performance Health Check
  • TrueNAS keeps our data safe well but does it only improve performance when you swap a drive out, delete and recreate a vdev etc?

me neither, also not a zfs expert, but:

It’s a new feature - it can’t be used by truenas at all until openzfs 2.4.0 is integrated (as I said: that happens with 26.04 I think. I haven’t read anything about integrating it into the UI or other features yet though. Also, if I understood correctly, as zfs rewrite …rewrites all data it will lead to doubled space usage if you have snapshots prior to the rewrite.

Performance in ZFS is quite a complicated topic considering the implications of vdev architecture (mirrors vs raidz, multiple vs single vdevs), spcecial/l2arc/slog devices, free space and so on… I think it’s relatively hard to answer that question but others might still be able to do that quite well.

If a block has not been touched in X days, then rewrite it, nothing more is required logic wise.

The fact that this function has been added sort alludes to my point, although I recognised it has other functionality such as adding encryption to a current dataset etc..

zfs rewrite wasn’t added with anything resembling your point in mind I think :sweat_smile:
It’s very useful for rebalancing after adding a vdev or a expanding a RAIDZ… or adding encryption, yes.

I think we’ve now said basically anything relevant to this topic now though.

Regular reads of data written to SSD will force the drive’s firmware to catch cells with weak charge and bad cells. So, regular scrubs, as always is what’s needed.
As for the “performance drop in read speeds” all I am seeing is hand waving, without metrics to substantiate the claim. If regularly rewriting the in situ data is the answer for the alleged read performance drop, thereby significantly decreasing drive life, I’ll take the supposed read performance hit.

This has now been explained in the podcast