Is there a way to estimate the lifetime of a SD card? If not, is there a utility I can use that monitors its integrity and reliability so I know when to use a new SD card?
11I'm also confused by the reasoning behind the "close" votes as not constructive. Is it because different SD cards will have different answers?– ramblinjanJun 13, 2012 at 20:05
2What makes it a bad question is that the answers will be guesses– finnwJun 13, 2012 at 20:52
19That would make those answers bad answers. Just because it can't be answered accurately now doesn't mean it can't be accurately answered.– ramblinjanJun 13, 2012 at 20:57
22@finnw - A question which is difficult to answer isn't a bad question, it's a good question! It's a question which people are going to keep on asking, so is perfect for a site intended as a reference for answering questions that people want answered. Bad answers on the other hand can be voted down. Not allowing people to try to answer defeats the purpose of a stack exchange site.– Mark BoothJun 14, 2012 at 10:28
2I don't get these moderators trying to shutdown questions for no good reason. If you want to help, try to improve the question by adding more tags or something. Do something constructive!– kaptanMay 14, 2019 at 19:20
There are several tools that will check integrity of a filesystem, and recurring errors will point to a SD card reaching the end of its lifetime.
fsck is a commonly used Linux application and you can use it to check a partition like this:
x is the partition number.
As for estimating the lifetime, the Sandisk Product Manual states:
SanDisk SD cards have an endurance specification for each sector of 100,000 writes typical (reading a logical sector is unlimited).
However, I do not know how many read/writes the typical OS uses on average.
I think 'typical' would be indescribable. It would be completely dependent on the software installed. It may be possible to calculate the read/writes of a clean install but that will vary with each little update making the statistic fairly meaningless. I think the tools you listed combined with the knowledge that it will take a good while to burn up a card should be sufficient base data to go on. Jun 14, 2012 at 16:48
@tencent I think it's the best we can do.– JivingsJun 16, 2012 at 14:21
1I'm on Ubuntu Server 20 LTS for Raspberry Pi, and there, the SD card is not on
/dev/mmcblk0.– AbdullApr 13, 2021 at 21:28
SD cards do the monitoring themselves, so you don't have to. Modern commercial-grade SD cards will use sophisticated wear leveling algorithms which detect and isolate bad blocks as they appear, so at any given moment no bad blocks are exposed to the file system. That's why HDD tools like
badblocks (and by extension
fsck) are useless for failure prediction: they will show you the card is fine even if it is already aging.
Things keep going until the SD card runs out of reserved spare blocks, at which point most cards permanently lock themselves to read-only mode. This is intended to give the user a chance to read out the data and move it to another medium. This is how you know you need to get a new one.
Since the card typically runs out of spare blocks while you're writing on it, having journaling enabled greatly helps to recover your data.
If you really want to anticipate a failure, get an SSD and keep your data there. Then you'll be able to use
smartctl to check how many blocks have already been relocated internally, and how many more remain, often represented as a percentage of the estimated lifetime of your SSD.
Very good to know! SD healt should then be possible by see when the size has started to shrink,
df -hOct 29, 2019 at 21:07
6@DanFroberg No, the size visible to the user will remain constant. It's the pool of reserved blocks that runs out, and that pool is not visible via regular SD card access. Nov 5, 2019 at 7:49
1Doesn't answer the question– AbdullApr 13, 2021 at 21:35
3@Abdull TL;DR: the SD card needs to be replaced when it becomes read-only. Apr 14, 2021 at 7:43
Frequently, when the card goes bad is too late, read only or not. Some applications need to anticipate and prepare for that. Additionally being able to collect analytics on actual card performance and wear in the field is also useful. Nov 10, 2021 at 20:33
You can scan all blocks of your partitions with
time badblocks -sv /dev/mmcblk0p2 -o mmcblk0p2.log
mmcblk0p2 refers to the partition and has to be replaced by the partition to scan. You can list your partitions with
Bad blocks will be recorded to the log file.
Unmounting of the file system is not necessary.
You can also do non-destructive write tests (
-n option), if you find it necessary.
If you don't need to preserve the data you can also do faster (destructive) write test (
For ATP branded Industrial SD Cards, they provide "SD Lifetime Monitoring Tool" software for Linux/Windows. But if you use this tool you must run this tool from a Host Operating System. That means you can not use this software inside SD Card to check itself. Because if you run this software, SD card can not be accessable.
For Reference - Google: ATP Industrial Grade SD Card Specification (Revision 3.8)
Nice but those cards basically do not exists. Can't find any on amazon.fr or other usual websites in EU.– MappaMMay 19, 2020 at 15:02
I just came across a tool to check Panasonic SD Cards for remaining endurance:
It only has Mac and Windows versions though.