For SSDs we have a variety of programs that read their remaining life. I'm looking for the same thing for memory cards in a situation where they get a lot of writes. Google is not only not returning any answers but not even anybody asking the question
4 Answers
SD cards are SSDs, it's the exact same technology, but because SD cards aren't built for the same purpose they don't include the required features like smart. There is no way to tell how long the SD card will last, because the required data isn't collected so there is no way to generate an estimate. If SD cards did have the relevant details you would use the exact same programs you use on any other SSD, an SSD just means solid state device.
- 387
SD cards do not expose any standard interface to retrieve health status or to perform self-diagnosis tests like SSDs do with SMART.
However, you can get some indirect estimates by polling the filesystem statistics; for example EXT4 can be polled with the command dumpe2fs, which reports the total amount of data ever written to the filesystem, which in turn guesstimates the wearing undertaken by the device during its life.
I've been using SD cards as my root FS for years; in my experience, 300GB are enough to kill a branded 4GB card with no more than 200MB of free space permanently available.
From this empirical data you may deduce that 300/0.2 = 1500 are the approximate lowest estimate write cycles an SD card may bear.
- 261
As already noted some vendors do provide some SMART-like health reporting mechanism. Here's the best list of such vendors I've found.
- 1,665
Building off davide's answer, use:
lsblk -f
to find partition with ext4 FSTYPE and then
sudo dumpe2fs /dev/mmcblk0p2 | grep Lifetime
substituting mmcblk0p2 with your partition name. Example output:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
mmcblk0
├─mmcblk0p1 vfat FAT32 bootfs C336-AC83 204.6M 20% /boot
└─mmcblk0p2 ext4 1.0 rootfs eaaa4faa-eab6-400c-950f-dc96ae4e0400 93.1G 16% /
and
dumpe2fs 1.46.2 (28-Feb-2021)
Lifetime writes: 211 GB
So in this case I have 211 GB written on a 128 GB card, which about 2 cycles. 1500 cycles are expected according to davide. So this card has plenty of expected life. But you never know! I suppose reformatting the filesystem would reset the count, too. This is just an estimate. Also check out https://github.com/dkrahmer/MediaTester/ to actually test the card. I use win32diskimager to make full backups occasionally.
- 11