You are on page 1of 3

Tags: Can't mount data, data partition, Ext4, corrupt, beschdigt, bootloop, recov

er ,fix ,rescue, retten, wiederherstellen, ClockworkMod, Recovery Mode, android,


Samsung
Needed programs:
adb command line program (adb.exe, AdbWinApi.dll, AdbWinUsbApi.dll)
HEX Editor PilotEdit (Trial version for 30 days) - can handle big files!
Raise Data Recovery for Ext2-Ext4 (26EUR)
ClockworkMod+Rootrechte should be installed (I have ClockworkMod 4.0.0.2)
Short Description:
You recognise this problem when you boot your Samsung S2 and it repeats the boot
animation all the time (bootloop).
If you try to mount the /data partition in ClockworkMod->"mounts and storage", y
ou get the Error "Can't mount /data".
Btw it is normal if you boot in ClockworkMod, the /data partition won't be mount
ed automatically as the other ones, so you have to try to mount it to test this.
Normally you can mount the /data partition, if not it is corrupted. (Btw it is n
ormal the /emmc partition can never be mounted)
The /data partition is after the internal memory partition (/sdcard partition) a
nd your external SD card, the most important partition to save your old system.
The /emmc, /system, /boot partitions are important for the system to work, but t
hey don't save any personal settings or files.
The /cache partition is unimportant and can be formated always, the same for /da
lvikcache, which is on the /data partition (you can erase them at the end of all
of this).
So basically we create a dump file of the /data partition. Then fix the header o
f it, so we can open it with a recovery program and copy all files from it to th
e PC.
Then we format the /data partition and boot the fresh system (so new fresh files
will be created on the /data partition).
Then we zip the copied files to zip files and unzip them to the /data partition
and overwrite some of the fresh files with the old files.
At the end you should have (almost) the same /data partition and the same system
on your Samsung S2 like before the header got corrupted.
Sadly I could not make it work to use the apps, which have their data inside the
.android_secure folder. Probably the only way is to reinstall these apps again.
INSTRUCTION:
1. First backup all files you can. Take out your external SD card, and try to ba
ckup all files from your internal memory partition called "/sdcard" or "USB stor
age".
For this you can connect Samsung S2 with USB, boot Samsung S2 in recovery mode (
ClockworkmMod) with pushing and holding the buttons
volumeup+homebutton+powerbutton until logo shows up, then let the powerbutton of
f while still holding the other 2 buttons.
In recovery mode you can go to "mounts and storage" and choose "mount USB storag
e", then you can access the internal memory with your PC and backup all files.
For the following steps you have to have more than 2GG space on your internal me
mory partition.
2. After all backups, connect your PC with command line: adb devices
Find out the place name of the /data partition with command line: adb shell cat
/res/recovery.fstab
(in my case for /data it is /dev/block/mmcblk0p10)
3. Create a complete dump file of the /data partition with command line: adb she
ll dd if=/dev/block/mmcblk0p10 of=/sdcard/data.img
Replace "/dev/block/mmcblk0p10" with whatever place name your /data partition ha

s. Specify the save place of the dump file with of= parameter (Remember /sdcard
is the internal memory).
Be sure you have enough space on the internal memory to create the dump file. Th
e /data partition needs 2GB.
Check the file size of the created dump file, the dump file of the /data partiti
on has to have exactly 2.147.483.648 bytes!
Sometimes it doesn't work out right and an uncomplete 1,99GB file is created, so
you have to try it several times.
You can also check the created dump files with a CRC program, once you have 2 id
entical dump files, these are probably complete.
4. For the following steps you have to move the dump file from your internal mem
ory partition to your PC.
To fix the header of the dump file, open "data.img" with the Hex-Editor PilotEdi
t (click there on Edit->HEX Mode) and rewrite the beginning of the dump file wit
h an usual header of an ext4 file system.
For me this worked:
line 1-64: only zeros!
line 65: 00 80 00 00 00 00 02 00 00 00 00 00 67 12 00 00
line 66: D2 7A 00 00 00 00 00 00 02 00 00 00 02 00 00 00
line 67: 00 80 00 00 00 80 00 00 00 20 00 00 A4 2D 71 38
line 68: AB 2D 71 38 AE 03 FF FF 53 EF 01 00 02 00 00 00
line 69: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00
line 70: 00 00 00 00 0B 00 00 00 00 01 00 00 14 00 00 00
line 71: 42 00 00 00 03 00 00 00 57 F8 F4 BC AB F4 00 00
line 72: 67 5F 94 6F C0 F9 F2 5B 00 00 00 00 00 00 00 00
Then save the file as a new file "fixed_data.img" and copy it to your internal m
emory partition.
5. After fixing the header of the dump file, you can open and copy all files fro
m the fixed dump file "fixed_data.img"
with a recovery program like Raise Data Recovery for Ext2-Ext4 (26EUR great prog
ram!). (No need to search for lost files!)
In my case for /data partition the most important folders are app, data, propert
y, system, wifi.
Just in any case, don't delete the original and fixed dump files!
6. Now with having the /data partition backuped with the dump files,
you can format your /data partition on Samsung S2 in recovery mode->"mounts and
storage" (you can also use the "wipe data/factory reset" command in ClockworkMod
).
After formating, boot your Samsung S2 and make the first small steps to complete
the installation of the new system.
(Now there are new fresh files on the /data partition)
7. Now pack with a program like WinRAR the copied folders (which you could copy
with the recovery program) "app", "property", "system", "wifi" to a first zip ar
chive "first.zip".
And zip the folder "data" to a second zip archive "second.zip".
Copy these .zip files to your internal memory partition on the Samsung S2.
8. Boot in recovery mode and connect with command line: adb devices
In recovery mode mount the /data partition inside point "mounts and storage"
Unzip and overwrite the content of the zip file "first.zip" with command line: a
db shell unzip -o /sdcard/first.zip -d /data
With parameter -d you have to specify the place name of the /data partition.
9. Then boot the Samsung S2, it will take some time while booting to integrate t
he copied files.

10. After complete boot process, reboot again in recovery mode and connect with
command line: adb devices
In recovery mode mount the /data partition inside point "mount and storage"
Unzip and overwrite the content of the zip file "second.zip" with command line:
adb shell unzip -o /sdcard/second.zip -d /data
With parameter -d you have to specify the place name of the /data partition.
11. Boot the Samsung S2 again, it will take some time while booting to integrate
the copied files.
After complete boot process you should have restored all your old files to the n
ew /data partition, so you should have almost exactly your old system, before th
e /data partition corrupted.
It is important to split the unzip & install process of the data folder and the
other folders, or the Samsung S2 would have problems to integrate all files at o
nce.
So this is why you have to do it step by step, unzip first.zip then boot&integra
te, unzip second.zip (the data folder) then boot&integrate.
Sadly I could not make it work to use the apps, which have their data inside the
.android_secure folder. Probably the only way is to reinstall these apps again.