The question for me would be why the Pi's SD card is getting worn out so rapidly, what you are doing which causes that ?
If it's something you are doing, the way you are doing it, it could just be a matter of doing it some other way.
Hippy,
This appears to have been a general issue running Linux on a Pi from a SD Card for a very long time. A web search comes up with articles dating back 10 years. I have two posts to raspberrypi.stackexchange.com that date to 2012 which I'll include later, and another one with recommendations for choosing SD cards for the Pi that was started in 2014 and has been continually updated since then.
julianE,
i couldn't help myself from doing some more research and I've come up with the following links.
These come with the disclaimers that 1) I have no expertise with SD Cards and 2) I have not tested any of these suggestions.
I did buy some high quality SD cards to see if they will last longer and am trying one now.
This could extend the life of your SD Card, and another thing to try is a bigger capacity higher quality SD Card.
This post, which is the one started in 2014, claims that the problem is because cheap SD Cards don't include wear levelLing so the writes to the SD Card eventually wear out some of the blocks, making the card unusable:
What are the best SD cards to use in a Raspberry Pi?
and makes two recommendations:
1) Use a more exepensive SD Card that does have wear leveling
2) Use a bigger capacity SD Card than you actually need.
This post from two years ago makes a similar claim that "Vast majority of SD cards do not have wear-leveling" but the person posting this wanted to let people know that "SD cards with wear-leveling used to be expensive, and small in size, and were usually reserved for specialized use (i.e. industrial applications). Today, you can get a 64GB SD card with WL for as low as 15 EUR.":
Quick reminder that SD cards with wear-leveling are now fairly common (i.e. WD Purple microSD)
The poster discusses his problems getting WD to give him a simple yes or no answer to whether one of their SD Cards did have wear levelling but, unfortunately, doesn't describe how we might easily find this out for other cards.
This post covers several things but the item I want to draw attention to here is where it points out that the important thing about having extra capacity is the amount of extra free space you get and not the amount of extra total space:
How can I extend the life of my SD card?
It gives the example that "if you have a 2 GB SD card with 200 MB free then switching to a 4 GB card will give you 11 times the free space, wear levelling capacity and thus longevity, while switching to a 16 GB card will give you 71 times the free space"
My understanding is that that SSD Hard Drives also use flash chips but they come with wear levelling and are many, many times much larger than SD Cards so while they are are subject to exactly the same wear problem as SD Cards they take much longer to fail.
The last post "How can I extend the life of my SD card?" also gives several suggestions about how to modify your Linux configuration so as to greatly reduce the amount of writes the the OS does to the SC Card:
- Disable Swap (You only have 512kB RAM on the Pi Nano so this may not be practical)
- Disabling Journaling on the Filesystem (The downside of doing this is that if the OS crashes then the files on your SD Card could be corrupted. The card would still be OK but you'd still need to re-install Linux)
- The noatime Mount Flag (Provided that your app does not depend on being able to detect when a file has been udpated I'm not aware of any downside to this)
- Directories in RAM (You will lose the contents of any directories in RAM when the OS is shutdown or rebooted)
These last options could be more expensive in that they require your time to research and make these OS configuration changes but, on the other hand you could try them on any SD Card to further extend the life of that card.
the way the SD cards fail is intermittent, i had some refuse to boot while others would run but with some functions failing.
Answer 1 in this post states that when SD Cards fail they "just go read-only if you are lucky and die if you are not" which is consistent with the two types of failure that you describe:
Tool to monitor SD-Card health