Saturday, October 24, 2015

recovery mode - Is there a way to get a disk image of the user storage space on modern Android devices?


I want to know if it's possible to get a "disk image" of the storage space on Android devices when they don't use external storage like SD cards.


I'm mostly interested because my kids factory reset my Kindle Fire HDX and I was hoping I could get a disk image (using something like dd in Linux) and then try to recover some of the user data like photos and videos (using something like PhotoRec, http://www.cgsecurity.org/wiki/PhotoRec). I've done this lots of times with SD cards and hard disks by simply mounting the storage device in a desktop running Debian, and executing something like:


# dd if=/dev/sdb1 of=image.iso


Then you can use PhotoRec and/or TestDisk, depending on what you want, to get useful stuff out of the image file.


Even some of my very old Android devices seem to allow mounting a storage device in this way (without removing SD card from the phone) and following this process. Unfortunately, it looks like many new devices that don't have removable storage (like my Kindle Fire HDX and my Nexus 5) only allow you to interface with a computer using Media Transfer Protocol (MTP) and Picture Transfer Protocol (PTP).


Can I use these protocols to get a bit-by-bit copy of the storage in the device? Is there a way to add the older storage device capabilities to new phones?



Answer



After doing some more research, I think I've found a partial solution here:


http://forum.xda-developers.com/showthread.php?t=2450045




  • First, you need to get ADB set up on your computer. In Linux it's pretty easy. Something like running # apt-get install android-tools-adb or downloading and extracting a directory.





  • Find your partitions. Run something like: adb shell cat /proc/partitions There are other options in the link for how to find and identify all the partitions.




  • Copy the data The dd tool should be available. You can run something like dd if=/dev/block/mmcblk0p9 of=/sdcard/image.img




Unfortunately, I have two problems with this. The first is that the permissions on partition devices might require root access. The second is that the Kindle Fire HDX and many other modern devices that don't have "USB Mass Storage" also don't use SD cards. So there is no easy location to write the image you want that isn't already used for something else on the device.


I'm trying to find a way to mount network devices or transfer data over USB between the device and computer (adb push and adb pull won't do what's needed as far as I can tell). I'll update this if I can find a good solution. Otherwise I'll ask some other questions about it.


Edit: This page has a great description along the lines of what I have above: http://www.df.lth.se/~jokke/androidfilerecovery/



As noted below, root is necessary, but there are usually lots of ways to get that easily. Unfortunately, I was working with the Fire HDX 8.9. Halfway through my copying data to an image file, the thing auto downloads an update to 4.1.1. Next thing I know, root access disappears and I don't think there's an exploit out for it yet. I probably lost any recoverable data after the update was written to the internal storage anyway. I'm so frustrated with Amazon lately...


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...