8

I have Samsung S 3 mini.

I did something really bad to my INTERNAL SD CARD partition layout. As I remember correctly, I tried to repartition my External SD card via fdisk right on Android via 'adb shell'. And I delete existed (there was only one as I recall) partition on mmcblk0 (which is appears to be not an External, but Internal =)

Now I have:

~ # cat /proc/partitions
major minor  #blocks  name
 179        0    7634944 mmcblk0
 179       64       2048 mmcblk0boot1
 179       32       2048 mmcblk0boot0
 179       96    3866624 mmcblk1
 179       97    3862528 mmcblk1p1
~ # ls -la /dev/block/mmcblk*
brw-------    1 root     root      179,   0 Jan  1 10:30 /dev/block/mmcblk0
brw-------    1 root     root      179,  32 Jan  1 09:28 /dev/block/mmcblk0boot0
brw-------    1 root     root      179,  64 Jan  1 09:28 /dev/block/mmcblk0boot1
-rw-rw-rw-    1 root     root      16777216 Jan  1 10:07 /dev/block/mmcblk0p20
-rw-r--r--    1 root     root             0 Jan  1 10:07 /dev/block/mmcblk0p22
brw-------    1 root     root      179,  96 Jan  1 09:28 /dev/block/mmcblk1
brw-------    1 root     root      179,  97 Jan  1 09:28 /dev/block/mmcblk1p1
~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
tmpfs                   411756     16452    395304   4% /dev
/dev/block/mmcblk1p1   3858432   1473472   2384960  38% /external_sd
~ # 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/mmcblk1p1 on /external_sd type vfat (rw,nodev,noatime,nodiratime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
~ # tail ./etc/recovery.fstab
/system     ext4    /dev/block/mmcblk0p22
/cache      ext4    /dev/block/mmcblk0p23
/data       ext4    /dev/block/mmcblk0p25 length=-16384
/efs        ext4    /dev/block/mmcblk0p11
/boot       emmc    /dev/block/mmcblk0p20
/recovery   emmc    /dev/block/mmcblk0p21
/preload    ext4    /dev/block/mmcblk0p24
/modem      ext4    /dev/block/mmcblk0p12
/sdcard     datamedia   /dev/null
/external_sd    vfat    /dev/block/mmcblk1p1
~ # tail ./etc/fstab
/dev/block/mmcblk0p23 /cache ext4 rw
/dev/block/mmcblk0p25 /data ext4 rw
/dev/block/mmcblk0p22 /system ext4 rw
/dev/null /sdcard datamedia rw
~ # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
print
Warning: /dev/block/mmcblk0 contains GPT signatures, indicating that it has a
GPT table.  However, it does not have a valid fake msdos partition table, as it
should.  Perhaps it was corrupted -- possibly by a program that doesn't
understand GPT partition tables.  Or perhaps you deleted the GPT table, and are
now using an msdos partition table.  Is this a GPT partition table?
Yes/No?

My ClockWorkMod recovery tool can't mount anything (/cache, /system, nothing). This is what kind of stuff I get in CWM:

-- Wiping cache...
Formatting /cache...
Need size of filesystem
E:format_volume: make_extf4fs failed on /dev/block/mmcblk0p23
Cache wipe complete.
W:failed to mount /dev/block/mmcblk0p23 (Block device required)
E:Can't mount /cache/recovery/log
E:Can't open /cache/recovery/log
W:failed to mount /dev/block/mmcblk0p23 (Block device required)
E:Can't mount /cache/recovery/last_log
E:Can't open /cache/recovery/last_log
W:failed to mount /dev/block/mmcblk0p23 (Block device required)
W:Can't unlink /cache/recovery/command
Formatting /data...
warning: get_file_size: Computed filesystem size less than 0
Need size of filesystem
E:format_volume: make_extf4fs failed on /dev/block/mmcblk0p25
Error formatting /data!
W:failed to mount /dev/block/mmcblk0p23 (Block device required)
E:Can't mount /cache/recovery/log
E:Can't open /cache/recovery/log
As you can see, there is no partitions for /system, /cache and other stuff, that should be there. (but /system, and /cache folders are present in dir listing)

I really did everything I could. I tried: restore from backup (I have one, made with recovery tool), install new ROM (With recovery tool), install stock firmware and stock kernel in ODIN mode. I even tried some PIT file: nothing did absolutely nothing to my status.

Frankly I miss some important part in understanding of filesystem, partitions, images, what is ROM, what is stock kernel, how does those 22, 23 25 partitions are created etc ...

What should I do?

UPDATE!

Oh, looks like I have everything in console buffer (full history of distraction actions)

In the beginning I had this:

cat /proc/partitions
major minor  #blocks  name

   7        0       2111 loop0
 179        0    7634944 mmcblk0
 179        1        128 mmcblk0p1
 179        2        384 mmcblk0p2
 179        3       1024 mmcblk0p3
 179        4       1024 mmcblk0p4
 179        5        512 mmcblk0p5
 179        6        512 mmcblk0p6
 179        7        512 mmcblk0p7
 179        8        512 mmcblk0p8
 179        9       1024 mmcblk0p9
 179       10       1024 mmcblk0p10
 179       11      16384 mmcblk0p11
 179       12      16384 mmcblk0p12
 179       13      16384 mmcblk0p13
 179       14      51200 mmcblk0p14
 179       15         64 mmcblk0p15
 179       16      14336 mmcblk0p16
 179       17       2048 mmcblk0p17
 179       18       2048 mmcblk0p18
 179       19      16384 mmcblk0p19
 179       20      16384 mmcblk0p20
 179       21      16384 mmcblk0p21
 179       22    1228800 mmcblk0p22
 179       23     860160 mmcblk0p23
 179       24     327680 mmcblk0p24
 179       25    4945920 mmcblk0p25
 179       64       2048 mmcblk0boot1
 179       32       2048 mmcblk0boot0
 179       96    3872256 mmcblk1
 179       97    3868160 mmcblk1p1
 254        0       2110 dm-0
/ $ df
Filesystem               Size     Used     Free   Blksize
/dev                   402.1M    84K   402M   4096
/mnt/asec              402.1M     0K   402.1M   4096
/mnt/obb               402.1M     0K   402.1M   4096
/dev/shm               402.1M     0K   402.1M   4096
/system                  1.2G   414.5M   766.6M   4096
/modemfs                15.7M     4.3M    11.4M   4096
/cache                 826.8M    84.8M   742M   4096
/efs                    15.7M     4.5M    11.2M   4096
/preload               315M    64.2M   250.8M   4096
/data                    4.6G     4G   699.2M   4096
/mnt/.lfs: Function not implemented
/storage/sdcard0         4.6G     4G   699.2M   4096
/mnt/asec/com.spruds.transport.pro.tallin-1     2M   888K     1.1M   4096
/storage/sdcard1         3.7G   905.7M     2.8G   32768

Even before everything went wrong I tried to use parted command and get an error

~ # parted /dev/block/mmcblk0
GNU Parted 1.8.8.1.179-aef3
Using /dev/block/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) list
list
  check NUMBER                             do a simple check on the file system
  cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER   copy file system to another partition
.....
.....
        copyright information of GNU Parted
(parted) print
print
Error: Unable to satisfy all constraints on the partition.

This is fdisk print before disaster

~ # fdisk /dev/block/mmcblk0

The number of cylinders for this disk is set to 954368.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/block/mmcblk0: 7818 MB, 7818182656 bytes
1 heads, 16 sectors/track, 954368 cylinders
Units = cylinders of 16 * 512 = 8192 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/block/mmcblk0p1               1      954368     7634943+ ee EFI GPT
Partition 1 does not end on cylinder boundary

And then I deleted it

~ # fdisk /dev/block/mmcblk0

The number of cylinders for this disk is set to 954368.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/block/mmcblk0: 7818 MB, 7818182656 bytes
1 heads, 16 sectors/track, 954368 cylinders
Units = cylinders of 16 * 512 = 8192 bytes

              Device Boot      Start         End      Blocks  Id System
/dev/block/mmcblk0p1               1      954368     7634943+ ee EFI GPT
Partition 1 does not end on cylinder boundary

Command (m for help): d
Selected partition 1

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table
fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy

UPDATE 2

I can see difference from initial state. Now I have 4 heads instead of 1 and so 238592 cylinders instead of 954368. How do I change number of heads?

1
  • Have not used fdisk on android and would not touch it with a bargepole either! The internal NAND partitions are set by the factory, either fdisk is mis-reporting number of heads/cylinders on a internal partition...its a NAND chip after all...
    – t0mm13b
    Commented Jul 4, 2013 at 14:42

2 Answers 2

6

I found it!

The answer was in PIT file, because as it says here:

you will only need to use this if a firmware update needs to change your partition layout (very very unlikely) or if you mess up you partition table (you don’t want to do this)

Which is definitely my case.

So, I tried that GT-I8190N and GT-I8190 should be used with different PIT files (I tried to use for GT-I8190 one). So I found long list of PIT files here.

1
  • 1
    How did you apply the PIT file to your device? Same here, tried with odin and getting re-partition failed error constantly. I also tried to repartition with and without a firmware, CDS file and PIT file alone. Nothing changed.
    – edigu
    Commented Aug 19, 2016 at 13:08
2

RECOVERING AN ANDROID DEVICE WITH BOOTLOOP OR STUCKED IN LOGO

Compilation by: Julian Lopez 2017-05(May)-08

I had similar problems, but the internal memory in my phone GT-i9003 is defective. I've used all pits without success. Maybe this procedure helps you, some of them are complex but safe:

Requirements:

  • An android device stucked in the logo (but with fully OS started), to work with ADB and CWM-Recovery, better if had the android developer options active and usb conection in comunication mode (also known as kies, MTP, debug, etc) not in usb-data mode
  • Data Cable USB Pc with highspeed USB port available
  • Updated Device Drivers
  • ADB and fastboot platform tools(windows) for manual backup and restore... ADBD info sources: thanks for sharing the knowledge to Rotohammer [ADB Roto backup - manual backup] and Amalautpavathas [ADB android tips]
  • Another operative and identical device (very convenient)
  • A Good+original 16GB and above Class10 (forget about class4) MicroSDCard (I've had some problems with generic 32GB and bigger), prepared with a standard-fat32 partition which is limited to a maximum of 4gb for each files, but it works to backup. It's very important, to create in the root of the microSDcard a empty text file called DO-NOT-INSTALL-THIS.zip just for reference and identificacion from inside Recovery). The usb ota usually is not recognized and we require permanent USB conection with PC.

Extract :

If the device is in bootloop or stucked in logo but active by ADB, after the logical and basic options follow this procedure to clone and restore manually (via command dd) the defective partition:

Warnings

  • Discard of all responsabilities about the use and abuse of this information
  • Please read the tutorials about ADB and android
  • Don't wipe with the MicroSDcard in, you can lost all data in without notice, every reboot/odin change/CMW mount and storage action, can change the mount point of the sdcard
  • When working on ADB; exit of the shell and use remount frequently.
  • When you can't access files get root access (CMW - root/unroot option).
  • Keep a list of files and mount points before proceeding, after every copy keep an eye on available capacity with df -k command in Kbytes and df command in blocks, with ls -al command you have a record of permisions in format xrwxrwxrw (an initial cap or - for type, x execute, r read, w write, in 3 tiers -user-group-others. Use chmod to change command) and owners of files . This tip avoid 50% of the errors using file copy, or changing files in the device. Take full information about the device (imei, macs, software versions, fw, updates, special app, register full versions and date of installation, specially backup software)

Actions

1.-With no external memory (MicroSDcard out, because some kernels and tools exchange the external memory with internal without advice) save a layout of the partitions. Important info is; start block, end block, filesystem type, block device name, order and mount point(path). Yes using ADB fdisk but without change anything.

2.- To take a manual backup of every partition (and specially, individual backup of the folder /efs, where is the imei and mac addresses for wifi, BT, etc) in the defective device with ADB and "dd" command (be careful with the available space after every backup), Repeat the same procedure in a good identical-device. transfer this backup to your PC and to a microSDcard (yes both)... Don't insert into the device. It requires:

  • Folder in windows explorer with \ADB and FastBoot-platform-tools-latest-windows\platform-tools, (no installation required)

  • The device must be conected to the PC via usb cable and detected with the right drivers )

  • We must to write (yeah i heard you, with the keyboard) in a CLI (Command Line Interface) known in Microsoft as CMD (Command line); go to Windows Explorer, open the black box by selecting CMD option with a simultanoeus combination of keyboard left [SHIFT] key and mouse's right click on a empty space inside the folder. In order to get the option CMD in the menu, avoid selecting or marking anything inside de windows explorer. Use this manual till Roto restore Section, Rotohammer ADB Roto backup - manual backup

3.- To create with (ADB) fdisk the missing partition(s) matching all the original characteristics (start block, end block, block numbers-size, fs type).

4.- With the device turned off (battery out), insert MicroSDcard

5.- Start your device in Recovery mode (CWM), go to Install ZIP from SDCARD if you can see the text file with extention .ZIP prepared in last point of requirementes (DO-NOT-INSTALL-THIS.zip), you can restart the device. In any other way go to -- mount and storage -- dismount everything and mount the prepared MicroSDcard, repeat with internal Sdcard, emmc, usb till you can see the zip file. Restart the device in normal mode (maybe only logo is visible).

6.- Connect the device to the pc, via usb and activate CMD from ADB to copy the partition-backup to one internal device's filesystem out of the MicroSDCard. turn the device off, extract battery, extract the microSDcard, and turn the device on. Proceed with one of this alternatives to Restore

6a.- The easier way, warranty proof use the original brand's emergency software restore, KIES's and ODIN for samsung, MTP for chineses brand, etc.

6b.- The easy way, if you only have a bootloop, start device with another tested good MicroSDcard, failures on external memory happens and app crash if they were moved to bad microSDcard. If this Doesn't work, start with no MicroSDcard in recovery mode, Wipe data/factory reset and wipe cache. Still on failure?, move on with the guide..

6c.- Because this method works with an image of partition on any android, any devices and brand, this make it independent of configurations (special filesystem types and assignations, mount point, vold.fstab, fota.rc, init.goldfish.rc, init.d's files, corruption of internal memory, failures in apps like link2SD and viruses). Start making an image of defective partition (via ADB + command dd) and all of them for congruency, make another from the image of a good device, and if the affected partition es /system or /, take a copy of the original /efs folder (this could be important later in case of the imei and MAC don't match with the hardware, consult your brand for imei location). Solution By: Rotohammer (same link), etc... Save it into the PC, in the MicroSDcard and the cloud.

6d.- Is your device still in warranty by the provider or by the CreditCard? (an available warranty, not the type Pluto during an eclipse's warranty), don't hesitate, go for it... The backup will keep safe your data and you can send it to RMA after a deep wipe and clean...

6e.-For Easy solution [Flashable Filesystem Check and Repair Tool | HTC Desire - XDA][3] ... With ADB you can install and run APK, or run /sbin/fsck, /sbin/fsck, /sbin/fsck.ext4. Note: some root filesystems keep older type (raiser, ext2, etc)

6f.- Restore from CWM backup or your favorite app

6g.- Use your original emergency restore software, Kies, mtp, etc.

7.- Restart, first time waiting for the autocheck of the filesystem and second time to verify the operation.

8.- In case of boot errors, boot in download mode, use the right versions of firmware update program (like Samsung's ODIN and MTP) to apply the right PIT (partition information table) with repartition checked. If the failure persists, apply the full original STOCK ROM to verify.

9.- In case of IMEI errors, proceed with solutions: ( forum.samdroid.ne t /attachments/f28/2082d1281453181-complete-imei-restore-how-bml10.img.zip)

10.- for internal memory errors check this [2]: http://amalautpavathas.blogspot.com/2013/08/

Disclaimer

This is an individual and personal compilation so, i sincerely hope this extract help someone, sometime, somewhere, but... Myself nor anybody will take responsibility for any actions you take using these instructions or applications. ROM flashing can void your warranty and should be the last option. Please proceed with caution and at your own accord and risk. Flashing will completely erase your device's memory. Make a backup of everything you need, for this objective i present more than 3 backup options, please use it all of them. If you want to flash a cooked ROM you need a patched SPL. How to do that is described in forum.xda-developers main page You also can flash the ROM directly from the microSD-card! The guide is found here forum.xda-developers

SPECIAL THANKS TO THE KNOWLEDGE´S PEOPLE

This is my very first post, so i have not permitted to include more people and sources, please excuse me, my invisibles partners not included at this list:

(forum.xda-developers (amalautpavathas) (samdroid)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .