Usually, unlocking the bootloader on Samsung Galaxy Nexus devices wipes the/partition. You can sometimes root without unlocking the bootloader backup the data through a root enabled app, unlock your bootloader and then restore your data. Now, you can unlock as normal, and get that wiped data back.
Now, the XDA forum member Wartickler released a method for the Samsung Galaxy Nexus that restores the data after it’s wiped. Thus, a method was created to scan those drivers and recovered the data. The method is for the Galaxy Nexus, but should actually be compatible with any device with an internal SD card. While it is for use on Windows 7, it should be easily translated over to Linux.
- A rooted android phone
- Busybox installed on your phone
- Cygwin installed to [c:\cygwin] with pv and util-linux from the repo. Make sure to open Cygwin once to make sure that the /bin folder is created. Also, I made a folder at [c:\cygwin\nexus] to put the exported .RAW file,
- Netcat (download the ZIP file and extract nc.exe to [c:\cygwin\bin]),
- ADB (make sure adb.exe is in your path),
- USB Debugging enabled on your phone
- VHD tool from the mighty M$. Put the VhdTool.exe file in [c:\cygwin\nexus],
- Piriform Recuva or your favourite data recovery tool
- A calm sense of peace and serenity that you will get your files back
WARNING: We and even the developer won’t be held responsible for any damage that takes place to your device while following these steps. So, follow the given below procedure at your own risk.
1. Identify which block/partition you want to recover. For our purpose here we are seeking to recover the userdata partition: /dev/block/mmcblk0p12
2. Turn ON your phone.
3. Connect the phone in ADB mode.
4. Unlock the screen
5. Open a Cygwin terminal and enter (This assumes your BusyBox installation is at [/system/bin/busybox]. It may be at [/system/xbin/busybox]):
adb forward tcp:5555 tcp:5555
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
6. Open another Cygwin terminal and enter:
adb forward tcp:5555 tcp:5555
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw
7. Run around the house a few times. For 32GB internal memory this is going to take 3+ hours. That’s a lot of running. When it’s done…
8. We need to convert the .RAW file to a virtual hard drive. VhdTool.exe basically just puts a VHD footer on the end of the RAW file. Open a Windows command prompt, go to [c:\cygwin\nexus], and type:
VhdTool.exe /convert mmcblk0p12.raw
9. Now we need to mount the VHD in Windows.
10. Select the Start button–>right-click Computer–>select Manage. Then Select Storage–>Disk Management.In the menu select Action–>Attach VHD
11. For Location enter [c:\cygwin\nexus\mmcblk0p12.raw] and select the OK button.
12. Right-click on the name (e.g. “Disk 1”) to the left of the Unallocated space and select Initialize Disk.
13. Select the GPT (GUID Partition Table) radio button and select the OK button.
14. Right-click on the Unallocated space and select New Simple Volume…
15. In the Wizard select Next>, leave the default for the volume size, select Next>, select a drive letter (e.g. K), select Next>, MAKE SURE to select the ‘Do not format this volume’ radio button, select Next>, select Finish.
16. A box will pop up asking you to format the drive. You DO NOT want to format the drive at this time.
17. Right-click on the RAW space and select Format… MAKE SURE to change the File system to FAT32. Set the Allocation unit size dropdown to ‘Default.’ MAKE SURE that the Perform a quick format checkbox is CHECKED. You do not want to overwrite the entire new drive with all zeroes (0’s) and destroy your data. Quick Format means that it will only attempt to destroy the index for the drive by establishing a new index. Without this box checked the Windows operating system will write zeroes (0’s) across the entire volume, potentially destroying your data. Select the OK button.
18. A box will pop up saying that Formatting this volume will erase all data on it. That would be doubly true if you actually didn’t check the ‘Perform a quick format’ checkbox. Double check that you actually did check the box and select the OK button.
19. Open the Piriform Recuva application. In the wizard select the ‘Next >’ button. Select the ‘Other’ radio button and select Next >. Select the ‘In a specific location’ radio button and enter: k:\ (assuming K is the drive letter you chose…) Select the Next > button. Select the Enable Deep Scan checkbox. This is the magical setting that finds files that have been deleted…but not really deleted. Select the Start button.
20. Open the Piriform Recuva application. In the wizard select the ‘Next >’ button. Select the ‘Other’ radio button and select Next >. Select the ‘In a specific location’ radio button and enter: k:\ (assuming K is the drive letter you chose…)
21. After that again select the Next > button. Select the Enable Deep Scan checkbox. This is the magical setting that finds files that have been deleted…but not really deleted. Select the Start button.
22. The application may take about an hour to do the ‘Deep Scan.’ It’s time for more laps around the house! Once the application has returned its results you can choose which files to recover using the checkboxes. Select the ‘Recover…’ button and choose the location to which you wish to output your files.
That’s it You’ve done. Enjoy!