Project

General

Profile

Actions

FixCorruptedUserDataPartition

Warnings

This tutorial is a work in progress. Remove this warning when it will be tested (and somehow indicate on which devices it was tested on).

Tutorial

Compatible devices

Only the following devices that are supported by Replicant are supported by this tutorial:

Setup ADB

Follow the instructions for setting up ADB on your computer so that you can access a root shell on your device.

NOTE: when prompted on your Replicant device, make sure that you check the box that says Always allow from this computer when you grant your computer USB debugging permissions. Otherwise, you will be unable to obtain root shell access on your Replicant device when you reboot it into the recovery OS to actually perform the backup.

NOTE: for security reasons, you may want to revoke these non-expiring permissions once the backup is complete.

Reboot into the recovery

To reboot in the recovery, you can follow the instructions in the RebootIntoTheRecovery wiki page.

Get the user data partition

First we need to find the real path of the partition. On the Galaxy SII (GT-I9100) we can use the following command:

adb shell "realpath /dev/block/platform/dw_mmc/by-name/UMS" 

On my device it gave me the following result: /dev/block/mmcblk0p11

To download it you can use the following command:

adb pull /dev/block/mmcblk0p11 ./mmcblk0p11.img

Note that this can take hours as the partition is usually quite big. You will also need to have the space to store it.

As it takes most of the space in the internal storage already, make sure to have at least as much space as the device internal storage size. For instance if the internal storage size is 16G, you will need at least 16G of free space (computers tend to slowly use space with things like logs and so on so it's a good idea to have a bit more space than needed).

Fix it

First verify which filesystem you have:

file mmcblk0p11.img

If the filesystem is a vfat filesystem and that it is damaged, you can try to repair it with the following command:

fsck.vfat -a -w mmcblk0p11.img

If you want to recreate it from scratch (your data will be lost) you can do the following:

fsck.vfat -a -w mmcblk0p11.img

Put it back

To restore your repaired/recreated/modified image on your device you can run the following:

adb push mmcblk0p11.img /dev/block/mmcblk0p11

Make sure that you're restoring it to the right device and that mmcblk0p11 is the right partition otherwise it could break your device for good and you might never be able to repair it.

Reboot

Once that's done you can reboot your device by selecting "reboot system now"

Updated by Denis 'GNUtoo' Carikli about 1 year ago ยท 8 revisions

Also available in: PDF HTML TXT