How to Check SD Card Health on Linux

To check an SD card’s health on Linux, first look for errors when you use it (dmesg and a filesystem check with fsck), then test the whole card with f3 (f3write and f3read), which writes test data, reads it back, and reports bad or fake capacity. Most SD cards don’t support SMART health reports, so a full read/write test is the most reliable check. Back up the card first.

Quick Answer

Back up, then run f3write /media/you/SDCARD and f3read /media/you/SDCARD. “Data LOST: 0” means the card passed.

Step 1: Check for Errors

  1. Insert the card and run sudo dmesg | tail -50 to look for I/O errors.
  2. Find the device name with lsblk (for example, /dev/mmcblk0p1 or /dev/sdb1).
  3. Unmount it (sudo umount /dev/sdb1) and run sudo fsck -f /dev/sdb1 to check the filesystem.

Step 2: Test the Card With f3

  1. Install f3: sudo apt install f3 (Debian/Ubuntu) or your distro’s package manager.
  2. Mount the card and run f3write /path/to/mount. It fills free space with test files.
  3. Run f3read /path/to/mount. It verifies every file.
  4. Delete the .h2w test files when done.
Linux terminal running f3write and f3read to test an SD card for bad or fake capacity
f3 reports corrupted or missing data.

Tools Compared

Tool Checks Destructive?
dmesg Kernel I/O errors No
fsck Filesystem consistency No (repairs if needed)
f3write / f3read Real capacity, bad areas No (uses free space)
f3probe –destructive Fast fake-capacity test Yes, erases the card
badblocks -w Every block Yes, erases the card
smartctl SMART data No, but most SD cards don’t report SMART

Signs a Card Is Failing

  • Files that won’t open or copy, or errors in dmesg.
  • The card switching to read-only on its own.
  • f3read reporting corrupted or lost data.
  • Capacity much smaller than the label (a fake card).

Troubleshooting

  • Card is read-only: Check the lock switch on full-size cards or adapters. Many cards go read-only permanently when worn out.
  • Wrong device risk: Double-check lsblk output before running any destructive command.
  • Testing on Windows? Similar tools exist; also see when drives won’t open.

Frequently Asked Questions

How long does f3 take?

It depends on size and speed; a 64 GB card can take an hour or more.

Can I repair a failing card?

fsck can fix filesystem errors, but worn flash memory can’t be repaired. Replace the card.

Summary

  1. Back up the card.
  2. Check dmesg and run fsck.
  3. Test with f3write and f3read.
  4. Replace cards that lose data.