Recovery Samsung S from corrupted internal flash memory

The smartphone begun to stuck, reboot or power off by itself. Boot tooks a lot of time, blinking with logo more times as usual. I've decide to re-flash it. I've did this before to latest "stock firmware". This time I've found Samsung Galaxy S firmware update to Android 4.0 aka Ice Cream Sandwich paper, then follow to this procedure.

I've did backup of user data, removed SIM and external SD card. Then I've entered to week of flashing nightmare, changing different firmwares, MODs and flashing tools.

Hardware abstract

Samsung S memory subsystem includes NAND memory, where flashing procedure creates system file systems, which stay in read only mode at usual use. You can recognise them as "mtd" devices. Here is an output of fdisk -l on recovered phone:

Disk /dev/block/mtdblock0: 7 MB, 7864320 bytes
Disk /dev/block/mtdblock1: 7 MB, 7864320 bytes
Disk /dev/block/mtdblock2: 262 MB, 262144000 bytes
Disk /dev/block/mtdblock3: 18 MB, 18350080 bytes
Disk /dev/block/mtdblock4: 13 MB, 13107200 bytes
Disk /dev/block/mtdblock5: 16 MB, 16777216 bytes
Disk /dev/block/mtdblock6: 180 MB, 180355072 bytes
Disk /dev/block/mtdblock7: 11 MB, 11534336 bytes

Not all of them mounted:

mount | grep mtd
/dev/block/mtdblock2 /system yaffs2 ro,relatime 0 0
/dev/block/mtdblock3 /cache yaffs2 rw,nosuid,nodev,relatime 0 0
/dev/block/mtdblock5 /radio yaffs2 rw,relatime 0 0
/dev/block/mtdblock6 /datadata yaffs2 rw,relatime 0 0
/dev/block/mtdblock4 /efs yaffs2 rw,relatime 0 0

The custom data, including user data, and default place for application's installation, resides on flash memory chip solded on board, but recognized as USB connected SD card. It calls _internal_ SD card.

My phone was a subject of war with childrens, installing everythings. A year and half was enoght for this memory stop working. This was the main reason for glitches mentioned at beginning of this article.

When reflashing with any firmware, or "wiping user data" from boot loader, I got similar errors (exact content vary on firmware version):

E:format_volume: make_extf4fs failed on /dev/block/mmcblk0p2

The error was independent of firmware and always about user data area.

Recovering

It happens occasionally, but reproducable, therefore I think that this can help to many users keep using their smartphones with this kind of mallfunction.

The main idea is using external SD card instead of internal. Mine was 8g. But am not happy with it's speed. Check for really fast SD card and purchase it.

Refer to Upgrade to 4.0 instructions mentioned above. Do the following:

  1. Flush XXJVU firmware
  2. Install root for XXJVU
  3. Create relatively small FAT32 partition on SD card (2g) and copy ICS_4.0.3_MR1-RC4.2_I9000.zip to it. (Refer to 6.)
  4. Do steps 8. 10. 11. following referral document.
  5. DO NOT REMOVE SD CARD !! User data will be installed on second partition of SD card.

Now you have a half working phone. Any applications, like camera, internet downloads, etc. will fail claiming that you have no SD card.

Software abstract

/etc is link to /system/etc. This directory has vold.fstab file which describe devices to be mounted. This partition is mounted read only, therefore it have to be remounted in read-write mode. Install "ROM Toolbox Lite" (you have rooted device already). This will help you remounting and even connect to "adb shell" over WiFi.

The original vold.fstab looks like:

## Vold 2.0 Generic fstab
## - San Mehat (san@android.com)
## 

#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label        - Label for the volume
## mount_point  - Where the volume will be mounted
## part         - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################

# internal sdcard
dev_mount sdcard /mnt/sdcard 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0

# external sdcard
dev_mount emmc /mnt/emmc auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2

Replace it with this one:

## Vold 2.0 Generic fstab
## - San Mehat (san@android.com)
## 

#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...> 
## label        - Label for the volume
## mount_point  - Where the volume will be mounted
## part         - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
#####################

# internal sdcard
dev_mount emmc /mnt/emmc 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0

# external sdcard
dev_mount sdcard /mnt/sdcard auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2

It is yaffs2 filesystem type, try to leave file size exactly as it was before:

-rw-r--r--. 1 oleg oleg      617 Nov 26 21:44 vold.fstab
-rw-r--r--. 1 oleg oleg      617 Nov 26 21:42 vold.fstab-ORIG

Remove/add hashes from file to fit size. Transfer file to place, remount system read-only back.

You have a working phone now.

Reading dmesg prove that internal memory becomes broken:

<3>[19408.797570] mmc0: error -110 whilst initialising MMC card

Some benefits

I've configured phone, restored everything, and installed favorites applications, then I've turned off the phone, pull out SD card and inserted it im my Linux box. Then I took backup of FAT32 first partition and ext4 second partition. Then I've repartitioned it as I want, and restored data.


Updated on Wed Jan 2 19:45:52 IST 2013 More documentations here