Sample Header Ad - 728x90

Interpreting the output of badblocks: when is it time to replace the MicroSD card?

6 votes
1 answer
1442 views
## Context I am running a Raspberry Pi Zero with a Micro SD as it is designed.  However, for this specific application, I cannot use a read-only system as I usually do with a Raspberry Pi. ## Objective Keep an eye on the health state of the Micro SD (and eventually get a notification somehow that it is time to replace the Micro SD). ## Questions 1. What is the best way to monitor the health state of the Micro SD (no fsck as I cannot unmount the Micro SD while the system is running)? 2. Is the following proposed approach the best solution in terms of practicality and effectiveness? ## Proposed approach I thought of using the output of badblocks to keep an eye on the state of the Micro SD, and eventually replacing it when it is time.  But when is it time to replace the Micro SD?  How many bad blocks are too many?  Should I look at write or read errors, or both? I made the following consideration: Micro SD cards automagically reallocate data outside of bad blocks. So if the Micro SD is 80% full, there are 20% of blocks that can "go bad" and still keep the Micro SD running. Adding a little bit of a confidence interval, can we say that if badblocks outputs a number of bad blocks that is below, let's say, 50% of the free-space blocks, it is still safe to use the SD card? To clarify: - Total number of blocks: 100 - Free space (in blocks): 20 - Maximum number of blocks that are acceptable to be corrupted (or whatever): 10
Asked by giovi321 (919 rep)
Apr 6, 2024, 12:35 PM
Last activity: Apr 8, 2024, 03:48 PM