5

I have an SD card in a Moto G (2015) running marshmallow, not rooted. It was formatted as internal storage, and contains photos and videos from the birth of our daughter, but has become corrupted.

Since it was formatted as internal storage, it's ESDFS filesystem and presumably encrypted. I can't decrypt it without accessing the encryption key, which I can't do because I'm not rooted. Presumably rooting will delete that encryption key.

I presume it's corrupted because any attempt to look at the SD card from within android unmounts the card, and the phone can't see any of the pictures/video on there. When the card is inserted, the 'storage' menu will initially acknowledge the card and tell me how full it is, but any attempt to look inside the card will result in it unmounting.

I've tried running fsck - within system/bin there are fsck_msdos and fsck.f2fs, but both come up as 'permission denied' when looking for them, and 'no such file' when I try to run them.

I can access /data from an adb shell, but attempting to get into /data/data/media results in 'permission denied'

Can anyone help? E.g: 1) will rooting delete the encryption key so that the card can't be accessed? 2) is there a way to get fsck working? 3) any other ideas for getting the media off this card?

Many thanks in advance. I'm a bit of a noob, so clear instructions much appreciated!

4

2 Answers 2

3

1) will rooting delete the encryption key so that the card can't be accessed?

No, actually "rooting" will not delete anything. Rooting is just adding an application for superuser or root-level access. That being said, in order to root your device you must have an unlocked bootloader. Unlocking the bootloader will wipe the entire device, including the encryption key, and all other data on the device. On the Moto G 2015 there is no way around this. Oh, and removing the card and performing the operation will not work, once it is rooted, the system will be different and the encryption key will change.

2) is there a way to get fsck working?

Not without root access. To be honest, even if you did get it to run the chances it would correct this type of problem are very low.

3) any other ideas for getting the media off this card?

Unfortunately no... once media has been adopted by the system, it is encrypted with a unique key to that system. If you can access the key, it is possible to access the data via Linux assuming the data is not corrupted. If the data is corrupted the chances of recovering encryped, corrupt data are extremely small.

As much as I would like to be able to give you an answer to recover your precious photos and videos, I don't believe there is one. All I can say is that moving forward I suggest NOT using adopted storage if possible (if this card was simple external/portable storage, the chances of recovering media from it would raise exponentially) and use a cloud backup solution like Google Photo which has the ability to maintain a backup of your photos and video automatically.

3
  • 2
    This possibly suggests a way to extract encryption key
    – beeshyams
    Commented Aug 12, 2016 at 13:57
  • You don't need to unlock bootloader to root a device. It is needed only to install custom OS, recovery,etc. If one wants to install a pre-rooted OS (which falls under installing custom OS), then it's required to unlock bootloader. But it's NOT NEEDED if one is rooting the existing OS in the device using an exploit. Commented Jan 8, 2017 at 6:42
  • 1
    Rooting existing OS requires having a local root vulnerability and working shell code. If your current firmware does not include known security issues, there's no way to root the system without unlocking the bootloader (which will force wiping entire device in case of Moto G). Commented Nov 26, 2017 at 13:56
2

Having seen the same problem more than once and after giving up on trying to root my phone (runtime root), I've opted for a method that I hoped would work and actually worked.

The method I've chosen will require an identical SD card and a card reader, however I believe it should work also with any SD card as long as it is larger - haven't tested it though.

Remove the supposedly corrupted SD card from the phone and plug it into a Linux machine. After finding what device was representing it (commonly /dev/mmcblk*), use dd to extract its contents:

$ sudo dd if=/dev/mmcblk0 of=/tmp/sdcard.dump bs=4M

sdcard.dump will be absolutely useless as it is encrypted and you don't have the encryption key, but it doesn't matter. Eject that SD card and insert the new, probe the SD card device (say /dev/mmcblk1) then run:

$ sudo dd if=/tmp/sdcard.dump of=/dev/mmcblk1 bs=4M
$ sync; sync

Eject the new SD card and plug it in your phone. In my case the phone was tricked into using that new card as its existing storage, thus mounting it and allowing me to gain access to its contents.

If you get errors while reading the corrupted SD card, try using ddrescue instead of dd when creating the initial image. Chances are that despite the errors you will still get access to a large portion of the data on the card.

2
  • I suppose you'll want to replace sdcard.sump with sdcard.dump in the first command. Commented Sep 21, 2018 at 9:15
  • This answer has a similar idea behind it, only instead of replacing the card, they replaced the internal SD reader of the phone with an external USB reader. Commented Sep 21, 2018 at 9:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .