A bit more on SD and SSD...wear characteristics.

Aug 11, 2023 Last reply: 2 years ago 40 Replies

Doing the research reveals the true case about wear on flash memory style devices and that is that substantially reads do *not* damage the cells at all, at least no more than reading, say, DRAM. It is block erases and writes that do and so, paradoxically, when used as a PROM, probably wear levelling is entirely unnecessary. And if done gratuitously may actually reduce lifetime. By 'gratuitously;, I mean that it is done when there is no write operation in progress. I cannot see any reason why one would shuffle blocks around *except* as a result of a write operation, however.



There appears to be one aspect of read operations that *does* disturb the data (read distrurbance), and that is that read operations can minutely affect the state of physically adjacent but unread cells. However this is generally at least an order of magnitude below write damage, and is normally dealt with by error correction.



So smart SSDS with good wear levelling will *occasionally* rewrite read only blocks, but this is in terms of hundreds of thousands of reads.



In my particular application the reads to reasonably static configuration files will exceed 32 million per annum, or rather they would *without disk caching*...



Now I am unaware as to how long Linux will regard a read only file that is fully cached (my files are less than 1kBytes) as valid. I cannot see *any* reason why re-reading file data that the operating systems



*knows* has not changed, would result in any actual 'physical' reads to the SD card *at all*.

And in fact in my particular application one code and data is loaded, even changing the configurations files should not result in a physical read, as the disk cache itself used to do the writing will retain the information.



I think the summary of all of this research is significant for PI users running Linux in what may be generally classed as 'read often, write seldom' accesses to an SD card, and that is that by far and away the greatest protection the card has is the Linux disk buffering algorithm itself, provided that constant reads do not exceed its capacity. In a typical 24x7 applications there is no reason why, post boot, any SD reads should happen *at all*, once the disk cache is full. It also shows the absolutely vital role that '-noatime' plays in protecting read only files that are read continuously from producing unwanted writes.



As far as writes go there will (nearly) always be a 1:1 correlation eventually between writes to the linux file system and writes to the SD card: The exception being data that us rewritten to the same disk file cache before it gets flushed to physical storage.



So the general rule in utilising the SD card in the most effective manner, is to reduce writes to a minimum by firstly mounting the card



-noatime, and secondly using RAM disks to do any logging that you can't turn off, and for all operations where ephemeral data are being recorded and read, but which do not need to survive a reboot. Then, having a superfluity of RAM available for disk caching will reduce SD *reads* to essentially zero. No matter how often the file system is accessed by the application.



And in fact using iostat on my running application shows no (physical) reads or writes *AT ALL*. As evinced by the rock steady light on the Pi Zero.


Am 11.08.23 um 11:54 schrieb The Natural Philosopher:

What exactly is your question?

My question is "Why did you think that a post has to be a question?"

This is information for Pi people using SD cards. Condensing a mornings research into some general practical conclusions.

If you are not interested in it, just skip it.

Because the posting otherwise is unsoliceted spam?

I'll ask when I am interested.

Not correct.

As we are in a Linux group, you might remember that Linus posted his first kernel here (on comp.os.minix) and it was not a question.

[snip long research summary]

Well, you were responded to by Jörg -- it has a mental defect where it can't help but be a prime asshole. That mental defect earned it a permanant position in my killfile. I only saw it's response because of your response.

And condensing a few hundred scattered individual articles in the two groups into a single place for future reference. It was a useful summary post, even if Jörg had an issue.

Indeed, some can't seem to 'get' that simple bit of logic into their thick heads.

Oh? You think that unsolicited information about Linux and rasberry Pis is spam, in linux and raspberry Pi newsgroups? What on earth do you think that spam acrually IS?

Well, next time why not shut the f*ck up when you are not.

You don't get to decide policy.

All you have is a keyboard and a killfile. It's very democratic. You can only create your own safe space, you cant dictate it for anyone else

Am 11.08.23 um 23:07 schrieb The Natural Philosopher:

Postings from anonymous Trolls with fake identities.

When is an identity real, and when is it fake?

Surely it is only fake if it is pretending to be someone, or something, it is not.

You all forgot how to trim postings? :-/

Part was.

| [...] PS. Could someone please try to finger me from overseas, as I've | installed a "changing .plan" (made by your's truly), and I'm not certain | it works from outside? It should report a new .plan every time.

formatting link

But I agree, announcements may be okay, if they are on topic.

F'up2 colm.

This is substantially correct. Reading from an SD/SSD *can* result in re-writes, thus shortening the life of the medium. How MUCH/OFTEN ... well, it depends.

The BEST IDEA is to shift EVERY relevant file that might possibly try to be read/writ to/from an SD off into RAM as quickly as possible. Depending on your distro you might be able to shift the entire OS to RAM. Some "live" distros are kinda like this already. A Pi with 4+ gb of RAM may be adequate enough for this approach.

In any case, SDs are "smart" devices, they have a controller to manage various needs. They are not just "stupid" memory space even though they try to *appear* as such to the user.

A few of my applications involve like a DECADE of reliability. As such the hidden tricks of SDs becomes relevant (as do memory leaks).

TNP’s been consistently posting under the same identity since, hmm, the

1990s I think? I think I’d call it a nom de plume.

At any rate, chatter about the longevity characteristics of storage devices seems on topic here to me.

No-one could possibly be called Jörg Lorenz.

I have been using nyms since before the usenet was in the internet. Why? Because I realised back in the 1980s that employers can peer into your private discussions, and I didn't like it. I lost a job through not being religious enough once. What I have to say is what I have to say, regardless of whether it can be connected to who I am as far as the electoral register, the bank and the taxman are concerned. There are some deeply weird and disturbed people on the internet as well as elsewhere. I don't want my house set on fire or my tyres slashed any more than already. If you don't like it, just kill file me and STFU.

It was earlier than that actually Richard. Before we met. It was pretty much my 'social media' identity from the word go.

Curiously my experiences with Usenet absolutely put me off any involvement with twitter or facebook.

I think so, It was something I didn't know the full answer to, and judging by the responses, the same was true of others. Everyone had a bit of the picture, but the whole practical issue with respect to using PIs was not available. I tried to summarise what everyone had contributed into the salient issues.

This is a general hardware question and not of any relevance to Linux in particular.

This group is about the Raspberry Pi range of SBCs almost all of which use SD cards for primary storage and far from all of which run Linux.

If you look at the headers, assuming you can read, you will see that its cross posted to comp.sys.raspberry-pi, and since all PIs other than the Pico run off primarily an SD card, and primarily run Linux, it is of extreme relevance to them.

It also touches on aspects of the Linux operating system - its logging, and its file system behaviour, and its file cacheing, that are of considerable interest to people who may not appreciate how deeply these affect its performance.

Of course if you simply want to gaze at a glass terminal and pretend you are back in the days of a PDP11, it's of no interest to you at all.

But don't judge everyone else by your own standards

Am 12.08.23 um 11:48 schrieb Ahem A Rivet's Shot:

comp.os.linux.misc

Stop this X-posting! Get it?

comp.os.linux.misc

Stop this X-posting! Get it?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required