Recovering Android encrypted SD card

So I started my phone (Samsung Galaxy S2 running Android 4.1.2) and I was met with greyed-out icons for each app that resides on my (encrypted) SD card.

The notifications area showed the following messages:

Preparing SD card
Checking for errors.

SD card encryption
SD card encryption error occurred

Tapping on the latter message took me to the ‘Encrypt’ settings section, which said the following:

Unable to encrypt SD card. Not enough space on card. Approximately 1.00 MB needed. Delete some files
To use your SD card, it must be encrypted.
Tap Continue to encrypt your SD card

It appears that Android loses the ability to decrypt the card when it gets full!

Google play error -8

I have also come across this problem when attempting to update my apps, with Google Play presenting error code -8. This is probably due to running out of space on the SD card.

There was no indication that the SD card encryption was failing, but when I restarted my phone it failed.

Try removing content

As the ‘not enough free space on card’ message suggests, a potential fix is to use a card reader on your PC to free up space on the card by deleting some files.

If you don’t have any files that you can remove from your card, or if you’re wary about doing so, then you can try to Repair the SD card filesystem via PC.

I chose to delete the ‘LOST.DIR’ directory, because this is a system directory that contains corrupted files and it will be recreated by Android (though its contents will not). It could be better to simply remove some music or images if you’ve got them backed up elsewhere, but remember that you’ll have to choose by the filename because you won’t be able to open any of the encrypted files.

  1. Turn off the phone.
  2. Remove the SD card.
  3. Mount the card on your PC.
  4. Copy its contents somewhere as a backup.
  5. Delete the ‘LOST.DIR’ directory.
  6. Unmount the card.
  7. Put it back in the phone, power on and pray.

The first time I tried this it worked for me - I put the card back in the phone and it was decrypted as normal.

Inspecting the contents of the ‘LOST.DIR’ directory on my SD card, it initially looked like I could have lost up to 6 files, but their file sizes and time stamps were identical so this is unlikely. In fact the time stamps suggested that the files were created when my phone crashed yesterday. Better lose a few files than the entire contents of the card.

Now off to double-check my backup routines!

Deleting LOST.DIR not working?

The second time I had to try this, deleting ‘LOST.DIR’ did not work, possibly because it wasn’t large enough to allow Android the space it needs to decrypt the card.

At this point you’ll just have to browse around the card and delete some files. The filenames are not encrypted so you should be able to identify a document, some music or a picture to delete.

Repair the SD card filesystem via PC

The first time I hit this problem I thought I’d check its filesystem to make sure that it wasn’t corrupt, before I removed any files. This could potentially free up some space.

To do this, remove the SD card from the phone and run a file system check via a PC to fix any errors.

  1. Turn off the phone.
  2. Remove the SD card.
  3. Mount the card on your PC.
  4. Copy its contents somewhere as a backup.
  5. Run fsck (Linux) or chkdsk (Windows) to check and repair the SD card’s filesystem.
  6. Unmount the card.
  7. Put it back in the phone, power on and pray.

The attempt on my Linux PC

me@pc ~ mount /mnt/mmc
me@pc ~ mkdir encrypted-android-sd-card
me@pc ~ cp /mnt/mmc encrypted-android-sd-card -r
me@pc ~ $ sudo fsck -VCr /mnt/mmc
fsck from util-linux 2.25.2
[/usr/sbin/fsck.vfat (1) -- /mnt/mmc] fsck.vfat /dev/sdd1 
fsck.fat 3.0.28 (2015-05-16)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 1
Perform changes ? (y/n) y
/dev/sdd1: 850 files, 119106/119106 clusters
/dev/sdd1: status 1, rss 2376, real 6.760662, user 0.036000, sys 0.041000
me@pc ~ $ umount /mnt/mmc

It didn’t look like there were any errors and it didn’t make a difference when I put the card back in the phone. I had to delete some files after all.


Last modified: 04/08/2016 Tags:

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top