Jun 07

How to test an SD Card on Ubuntu

Category: Linux,Ubuntu   — Published by tengo on June 7, 2010 at 2:02 pm

sd cardSD cards and portable storage is getting increasigly large. So before you dump gigabytes of data onto these chips, it's a good idea to check if the SD card, SDHC, CF-Card or USB Stick is actually in good shape by thoroughly testing the preformated media.

On Windows, there are some nifty focused utils to do just this, like h2test. As Linux comes packaged with many disk testing utilities and the average Linux user is quite aware of them, you won't get any specific advice on how to check removable media.

My advice to to test removable media, mostly formatted in MS-DOS legacy filesystems like FAT32 or FAT is to use dosfsck, which comes with most debian based *nix systems:

> dosfsck -va /dev/<device path> (verbose mode; automatically repair the file system)

or

> dosfsck -vtr  /dev/<device path> (verbose mode; interactively repair the file system; test for bad clusters)