Solution for MediaScannerService on Android draining your battery

Have you ever experienced that the system service Media climbing to the top of your application list on the Battery tab on your Android device? I had this particular problem, and it took me a very long time to actually figure out what caused the problem. I had read on forums that it might be because of corrupted files, but the only solution presented was to go through every single file on your memory card and verify that it was indeed working. That sounded like a very time-consuming way to solve the issue, and I imagined there had to be a better way. And there was.

I unmounted the memory card from the phone and inserted it into my computer. Then I copied all of the files I could read on the memory card (there was apparently some file system corruption, so some files were unreadable) onto my computer hard drive. I then ejected the card from the computer, reinserted it on the phone and formatted it completely. Once that was done I ejected it from the phone again, put it back into the computer and copied all of the files back onto the memory card. Finally I put it back into the phone again.

As far as I can tell everything is working as it should now and the MediaScannerService is no longer draining excessive battery power. Win!

Another alternative instead of copying all the files and formatting the memory card is to run the traditional Windows chkdsk program on the entire memory card, which should also be able to fix the corrupted filesystem. Regardless of which method you decided to use, you should have something that works again. It does indeed seem like file corruption wasn't the problem (as mentioned on the forum), but FAT filesystem corruption issues.

Before I actually tried this approach, I actually ran the memory card through a level 5 (recover good sectors) recovery on SpinRite, and it didn't make any difference to the problem. I'm glad the solution I found worked for me.