I've seen several posts about SD card lifespan
Then please be sure to read mine, which is the other side of the coin from all the "OMG! Your SD card is in danger! You need to protect it now by reading my blog!" stuff:
And a sort of tangent to that which gets into methodology for stress testing SD cards to see just how long they will last:
I'll quote the first one:
If your system writes a MB of logs a day [...] and you have a 4 GB card, it will take 4000 days
before such a cycle has written to the entire card just once. The
actual lifespan of an SD card might be as much as 100,000 write cycles. So all that logging will wear the card out in 4000
* 100000 / 365 =
~ 1 million years
Note that unless your system is very busy, it won't be logging nearly that much anyway. Since pi oriented distros such as raspbian use tmpfs (i.e., RAM) for
/run, that pretty much covers what the system will do as a matter of course. Your own actual activity will be much more significant -- if you were actually averaging 100 MB of writes per day, this would be reduced to 10 000 years.
Of course, that's a bit of an exaggeration as it is based on the idealized lifetime of 100 000 write cycles for the card. That probably only applies to very high end cards. Let's assume a very low end of only 1000 write cycles -- now we are down to just 10 years at 100 MB a day for a cheap 4 GB SD card.1
Note this is about writes and not reads, which are much less expensive wear wise. What wears the card out is erasing (which it must always do before writing, a characteristic of some solid state storage is that all bits are set one way before data is written).
I have Raspberry Pi B+ running slideshow from image and HD video (~40MB) in OpenELEC/Kodi, all day long, reading from the SD card.
Here's a great feature of modern operating systems including linux: file caching. If you have 512 MB of RAM but only use 350 MB of it, the OS has 150 MB left over to use as a cache (you can see this with tools like
top which may include that in their total, making it seem as if you are using all of it -- pay attention to the "buffers/cache" figure). It will use that to store frequently read data so it doesn't have to read from disk all the time. If you are constantly reading a 40 MB film over and over, there's a very good chance that all or most of that will be cached in RAM, i.e. most of the time it won't really be reading from the SD card.
In your case, you might want to guarantee this for yourself by mounting a small tmpfs partition at boot and copying your movie, etc. into there. Tmpfs is in RAM, so that means you are guaranteed no SD card reads, hooray.
This may all seem to go against the hundreds of people who have reported various places online (including here) that their brand new SD card keeps getting corrupted in the pi. I am not calling these people liars, but it is worth considering a few things.
- There are millions of raspberry pis in the world.
- There are tens or hundreds of millions of SD cards in use everyday, in phones, cameras, etc.
No one goes on line to announce, "Hey, guess what? My pi's been on for two years with the same SD card -- no problems so far!". It's true for me, and true for a lot of other people as well I am sure.
It seems to me looking around that complaints about SD card corruption are reported disproportionately by pi users (but this could also have to do with my search profile). It could well be that there are some pis out there that have some defect that is causing this problem, or because of the nature of the power system under certain circumstances.
But there's no point worrying about that until it happens, because it probably won't, and if it does, there's not much you can do about bad hardware except replace it.
A tip about filesystems in general that probably applies even more so to ones on SD cards because of the mechanism described below: Don't fill them to capacity. Stay below 75-80% and ideally, closer to 50%. So if you have an 8GB card, think about it as a 6GB card and don't fill it beyond that. If you know you need 8GB, buy a 16 GB card. This logic doesn't apply to things like cameras, BTW, just root filesystems for devices like the pi.
1. A somewhat tech savvy person might object that this is still very idealized since some physical blocks are prone to get used much more than others. That person is unaware of wear levelling <- read this to be even more tech savvy ;) SD cards have a logic chip in them and use virtual addressing to spread wear evenly, maximizing their lifespan.