How can I check integrity of Sd card in Raspberry Pi?

My Raspberry Pi system stopped working yesterday and it looks like the Sd card is corrupted. I tried another card and that was ok.

Is there some way to run an integrity check on the suspect card, in either Windows or Linux?


Yes, Windows tool called h2testw it will erase the content of the SD Card, but it surely tells you if the card is defect or not.

Thanks for the reply but I was looking for something that’s not desctructive.

I’ve just come across Flash Drive Tester which may do the job.

Thanks again

You can’t get full proper tests without writing to the drive. If you don’t want to loose the data just image it first with something like Win32DiskImager.

1 Like

Thanks for the reply.

The sd card is somehow corrupted since it can’t boot. Sectors on the sd card are error protected so if a bit/byte whatever has been corrupted and the ECC can’t cope with it, it should show up on a read test. However, it is possible that during a write cycle bits/bytes got overwritten incorrectly in which case the ECC would still be correct.

The first step was to do a read test and no errors were reported. Next I’ll retry the sd card since its possible the connections were a little flaky so I’ll clean them - again. It does read ok in another device.

After retrying, if it still doesn’t work I’ll just rebuild the system.


ECC isn’t full proof. Writing known information to the entirety of the card and then reading it back like h2testw does is pretty close to full proof. It also doubles as a stress test and fake tester (storage that reports itself larger than it actually is).

in most cases the config.txt is empty.
If the whole card is write protected it’s a protecten feature for defect card. finally you can only read the data for backup and replace the card.