18 лютого 2013

Command line tricks to restore the system or data partition in Android smartphones




Picture cropped from original by LO28@xda
http://forum.xda-developers.com/showthread.php?t=1624931
Command line tricks to restore the system or data partition of Android smartphones after the fail of RUU update with four exclamation points in corners.


HTC T528D couldn't boot nor a normal boot, neither recovery, neither even bootloader but it was visible through fastboot and after clearing the cache:

fastboot erase cache


I could reflash it one more time with RUU-update.
After the successfully update I unlocked it's bootloader through htcdev website.

I had just one problem - I couldn't do any acts in recovery mode, even CWM. I have seen only black screen or vertical color lines in the recovery mode.


===========================================

1. install ADB
2. check if your phone is visible through ADB

adb devices
* daemon not running. starting it now on port 5037 * * daemon started successfully * List of devices attached HC2CYMK01124        device


===========================================

Reboot to recovery without re-flashing the recovery.img


-------

adb reboot bootloader

check if you connected

fastboot devices
HC2CYMK01124    fastboot


fastboot boot e:\android\htc\t528d\new\Recovery2.img

check if you connected

adb devices
* daemon not running. starting it now on port 5037 * * daemon started successfully * List of devices attached HC2CYMK01124        device



===========================================

Packing /data to TAR (i.e. /tmp/sdcard/databak.tar)

-------

adb shell tar -c -f /tmp/sdcard/databak.tar /data

===========================================

Counting MD5 checksum:

-------

adb shell md5sum /tmp/sdcard/databak.tar >/tmp/sdcard/databak.tar.md5

===========================================

Formatting /system

-------

1. Define the system partition:

adb shell mount system
adb shell mount
/dev/block/mmcblk0p22 on /system type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
!  /system = /dev/block/mmcblk0p22


adb shell umount system

2. Format /dev/block/mmcblk0p22 (system):

adb shell mke2fs -t ext4 /dev/block/mmcblk0p22
mke2fs 1.41.11 (14-Mar-2010) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 81920 inodes, 327680 blocks 16384 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=335544320 10 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912
Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or 180 days, whichever comes first.  Use tune2fs -c or -i to override.

3. Checking file system for errors:

adb shell e2fsck -pfD /dev/block/mmcblk0p22
/dev/block/mmcblk0p22: 11/81920 files (0.0% non-contiguous), 13824/327680 blocks

4. Set journal for partition:

adb shell tune2fs -O has_journal /dev/block/mmcblk0p22
tune2fs 1.41.11 (14-Mar-2010)

5. Make shure that /system has been reformated:

adb shell mount system
adb shell mount
rootfs on / type rootfs (rw) tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755) devpts on /dev/pts type devpts (rw,relatime,mode=600) proc on /proc type proc (rw,relatime) sysfs on /sys type sysfs (rw,relatime) /dev/block/mmcblk0p24 on /cache type ext4 (rw,nodev,noatime,nodiratime,user_xattr,acl,barrier=1,data=ordered) /dev/block/mmcblk1p1 on /sdcard type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=i so8859-1,shortname=mixed,errors=remount-ro) ! /dev/block/mmcblk0p22 on /system type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)

adb shell ls -l /system
drwx------    2 root     root         16384 Feb 17 23:05 lost+found
adb shell df
Filesystem           1K-blocks      Used Available Use% Mounted on tmpfs                   447632        32    447600   0% /dev /dev/block/mmcblk0p24 201568      4248    197320   2% /cache /dev/block/mmcblk1p1   7745504   4222228   3523276  55% /sdcard ! /dev/block/mmcblk0p22  1290112     34688   1189888   3% /system

system almost empty

===========================================

Unpacking TAR (i.e. "/sdcard/clockworkmod/backup/t528d_sgg/system.ext4.tar"):

-------

adb shell tar -x -f /sdcard/clockworkmod/backup/t528d_sgg/system.ext4.tar -C /

===========================================

by SGG.im
Kyiv, 2013



Сергій Горіченко



Немає коментарів:

Дописати коментар