Android - Check and fix SD card errors within Android itself?

You can fix this with the help of root and a terminal emulator (e.g. Android Terminal Emulator (or, alternatively, using adb shell). The binary to do the job is called fsck, and usually located in either /system/xbin or /system/bin. Sometimes you need a special variant of it, which might e.g. be called fsck.exfat or the like. So first let's make sure we find the right binary:

cd /system/xbin
ls fsc*

If not found, repeat with /system/bin. I will assume here it was found in the first place, and is simply called fsck (adjust the following correspondingly if that's not the case).

As fsck comes from the "Linux core", we can consult its man page for the syntax. Though there might be some options not working on Android, the most basic ones should. See the linked man page for details (or run a Linux VM and use man fsck in case that page disappears) -- I will stick to the basics here:

First we need to find the device your SD card is bound to. If it's mounted, the mount command will assist us:

mount

That's it, basically: Check the output and see where your SD card sits. Usually this is something using vold, but it's different between devices. Output may include something like /dev/block/vold/179:17 on /mnt/storage/sdcard -- in that case, the first part of my quote is our device. In order to repair the "drive", you need to unmount it first. This can be done via the settings menu, or, as we're just in the terminal, by issuing

umount /dev/block/vold/179:17

Now we can go for the repair job. Basic syntax is:

fsck [options] [-t fstype] <filesystem> [fsoptions]

So we first try the simplest approach and hope fsck figures out everything itself:

fsck -C -r /dev/block/vold/179:17

Which basically means: Show progress (-C), and always ask the user to repair (-r) any errors on /dev/block/vold/179:17. If this does not work out, check with the linked man page for further options.


If you repeatedly have errors on your SD card, you should make sure that it is really of the stated capacity using H2testw (link only in German, software in German and English. I believe this is the official home despite appearances to the contrary). Bad SD cards will automatically corrupt.


thank for this, it saves my day :)

root@android:/ # mount | grep -i sdcard
/dev/block/nandk /mnt/sdcard vfat rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0

root@android:/ # /system/bin/fsck_msdos -y /dev/block/nandk