Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,305 Members 41,763 Now Online
XDA Developers Android and Mobile Development Forum

[Q] make /data backup as img on computer

Tip us?
 
GearX
Old
#1  
GearX's Avatar
Senior Member - OP
Thanks Meter 65
Posts: 250
Join Date: Feb 2009
Location: Munich
Exclamation [Q] make /data backup as img on computer

hey folks I've got a huge problem and I hope someone can help me or forward me to someone who might know!

So I had some very important data on my HTC One on the sdcard folder (/data/sdcard/Android is the specific folder) and I did a little ROM flashing on monday. So far everything went quite brilliant but today I recognised the data was lost so I googled for 3 hours and tried to do an IMG Backup of the whole /data path with the terminal on my mac. It went well so far with the commands
Code:
Select Code
./adb shell
dd if=/dev/block/mmcblk0p35 of=/sdcard/databackup.img
But the problem is that this command does a full backup of /data which is far bigger than the free 7GB on /data/sdcard where the backup will be saved on. That means it throws errors after half an error of backing up and canceling the process by saving the largest possible file on the sdcard.

Does someone maybe know one of these points:

1) how to specify the path which folder should be backed up

2) backup via mtp

3) transfer the data directly to the computer without saving anything on data/sdcard


I really don't know if this is the right category to post in but I trust in you guys and I think that this is my last chance to maybe save the lost files
hTC One M7


2 + 2 = 4 -House M.D.
 
GearX
Old
(Last edited by GearX; 25th June 2014 at 04:42 PM.)
#2  
GearX's Avatar
Senior Member - OP
Thanks Meter 65
Posts: 250
Join Date: Feb 2009
Location: Munich
I'll just help myself and other users which may have the same problem some time

http://forum.xda-developers.com/gala...5/post34185439

That helped me a lot and I've taken some parts of it. Here is a short version:

This is a little how2 get the raw out of your smartphone partition. As an example I take my htc one m7

1) download Google SDK
2) make sure all drivers of your smartphone are installed (including adb)
3) download cygwin (install to c:/cygwin)
4) download netcat (extract only the nc.exe to c:/cygwin/bin)
5) make sure usb debugging is enabled on your device
6) create a folder for the raw to cygwin (e.g. c:/cygwin/One)

1st step => make the raw file

Install cygwin. in the packages window you need to search for "pv" and "util-linux" in the repo windows. If you don't you will have trouble.

Before you start operating you should know that if you have a display lock you should disable it for the time of the backup process.

Now start up 2 windows of cygwin. The first command in both windows must be:
Code:
Select Code
$ export PATH="/cygdrive/c/ADB/sdk/platform-tools":$PATH
the fat marked part is various and depends where you have unzipped the adb so you need to change it for your usage.

Next step is that you need to make a txt file on your device to see the partition table and decide which partition you need to choose. To make that textfile you simply type into one of the cygwin windows:
Code:
Select Code
adb shell
then:
Code:
Select Code
su
then:
Code:
Select Code
 find /dev/block/platform/ -name 'mmc*' -exec fdisk -l {} \; > /sdcard/list_of_dev_partitions.txt
then exit shell:
Code:
Select Code
exit
Now search on the root of your sdcard a file named
Code:
Select Code
list_of_dev_partitions
. You found it? great! Open it and search for the partitions address you want to backup. In my case it was the whole /data partition with the address /dev/block/platform/msm_sdcc.1/mmcblk0p37

So the next step was to open the tunnel for a disk dump by typing
Code:
Select Code
adb forward tcp:5555 tcp:5555
then
Code:
Select Code
adb shell
then
Code:
Select Code
su
then
Code:
Select Code
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p37
And again you need to replace the fat marked part with you partition path or otherwise it won't work! For my HTC One M7 it looks like this /system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/platform/msm_sdcc.1/mmcblk0p37

Samsung or LG phones have another path. Always keep that in mind.

Now switch to the second cygwin windows and type

Code:
Select Code
adb forward tcp:5555 tcp:5555
then
Code:
Select Code
cd /One
then
Code:
Select Code
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw
fat typings => use your personal data!!!

If you did everything right then your second window of cygwin should display something like this:



If it says 0 bytes then your partition path is not correct. You may have a typing failure. Check everything! If it works => congrats now go and drink some beer with friends. 27GB take about 2,5 hours to backup!

2nd step => make it workable

When the backup process is done then do following steps on Windows:
1) click start
2) right click on computer
3) click Manage
4) select any storage and click on disk management
5) "add virtual partition"
6) as location enter the path of your raw (select "show all files" )
7) right click on new partition -> initialise
8) select partition table button & hit OK
9) right click on on the partition and make a new volume
10) leave the volume size, select a untaken drive letter, "do not format this volume" -> hit okay
11) open explorer, right click on new volume, quick format it in FAT32

3rd step => recovery!

Now your backup handles like a "broken" SDCard in your computer. For the data recovery I recommend test disk for recovery because you can choose many file formats to recover. You can also try with Piriform Recuva but I had the best results with test disk. That tool is available for many OS
Attached Thumbnails
Click image for larger version

Name:	Unbenannt.PNG
Views:	35
Size:	9.1 KB
ID:	2817034  
hTC One M7


2 + 2 = 4 -House M.D.
 
techjohnny
Old
#3  
Member
Thanks Meter 1
Posts: 80
Join Date: Aug 2008
Quote:
Originally Posted by GearX View Post
hey folks I've got a huge problem and I hope someone can help me or forward me to someone who might know!

So I had some very important data on my HTC One on the sdcard folder (/data/sdcard/Android is the specific folder) and I did a little ROM flashing on monday. So far everything went quite brilliant but today I recognised the data was lost so I googled for 3 hours and tried to do an IMG Backup of the whole /data path with the terminal on my mac. It went well so far with the commands
Code:
Select Code
./adb shell
dd if=/dev/block/mmcblk0p35 of=/sdcard/databackup.img
But the problem is that this command does a full backup of /data which is far bigger than the free 7GB on /data/sdcard where the backup will be saved on. That means it throws errors after half an error of backing up and canceling the process by saving the largest possible file on the sdcard.

Does someone maybe know one of these points:

1) how to specify the path which folder should be backed up

2) backup via mtp

3) transfer the data directly to the computer without saving anything on data/sdcard


I really don't know if this is the right category to post in but I trust in you guys and I think that this is my last chance to maybe save the lost files
What about using an OTG and mounting a larger SD Card to backup to?
 
GearX
Old
#4  
GearX's Avatar
Senior Member - OP
Thanks Meter 65
Posts: 250
Join Date: Feb 2009
Location: Munich
Quote:
Originally Posted by techjohnny View Post
What about using an OTG and mounting a larger SD Card to backup to?
OTG?

Gesendet von meinem HTC One mit Tapatalk
hTC One M7


2 + 2 = 4 -House M.D.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes