[Sony Xperia P, U, Sola, Go] Ryccardo:
Thanks to [MENTION=4120742]munjeni[/MENTION] for tipping me off in the right direction :) and to [MENTION=3841151]judas1977[/MENTION] + [MENTION=5464206]Tesla-MADAL93[/MENTION] for having done this on the Ace 2 I come from ~~

Everything else in this post applies to Gingerbread, scroll down to the 5th message for a more clear guide centered around a 4.1.2 ROM.

This is my annotated diary about the last 2 hours, I'm sorry if the story feels a little bit Dadaist :p but I don't want to encourage people who don't feel ready to try it, so please read all of it first and if anything is unclear ask instead of doing!!

I installed Busybox 1.22.1 (iirc) and replaced the default shell with bash (install Bash-X from market, copy /S/xbin/bash over /S/bin/sh, remove app if you like to). All of this was done with Gingerbread .188 and CWM 5.5.0.4 from Supercharged kernel.

Original partition table, with names added:

riki@Shigeki:~$ adb shell

sh-4.2# fdisk -u -l /dev/block/mmcblk0

Disk /dev/block/mmcblk0: 7944 MB, 7944011776 bytes
4 heads, 16 sectors/track, 242432 cylinders, total 15515648 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 2047 1023+ 0 Empty #### TA ("Trim Area") IMEI, BL UNLOCK, SIMLOCK ETC -- DO NOT TOUCH
Partition 1 does not end on cylinder boundary
/dev/block/mmcblk0p2 2304 3327 512 f0 Linux/PA-RISC boot #### SBL? Mem-init? Power management? PARAM?
Partition 2 does not end on cylinder boundary
/dev/block/mmcblk0p3 2048 2303 128 f0 Linux/PA-RISC boot #### unknown, as above
Partition 3 does not end on cylinder boundary
/dev/block/mmcblk0p4 3328 15269887 7633280 5 Extended #### GROUPS ALL FOLLOWING PARTITIONS FOR THEM TO FIT INTO THE 4-PARTS MBR SCHEME
Partition 4 does not end on cylinder boundary
/dev/block/mmcblk0p5 4096 20479 8192 4a Unknown #### another of the 4 unclear partitions
/dev/block/mmcblk0p6 20480 26623 3072 83 Linux #### MODEMFS (Samsung's "EFS") RADIO CALIBRATION
/dev/block/mmcblk0p7 26624 36863 5120 70 Unknown #### no idea either
/dev/block/mmcblk0p8 36864 53247 8192 83 Linux #### IDD (apparently related to usage stats reporting)
/dev/block/mmcblk0p9 53248 86015 16384 48 Unknown #### KERNEL
/dev/block/mmcblk0p10 118784 2215935 1048576 83 Linux #### SYSTEM
/dev/block/mmcblk0p11 2727936 6922239 2097152 83 Linux #### DATAFS
/dev/block/mmcblk0p12 2215936 2727935 256000 83 Linux #### CACHEFS
/dev/block/mmcblk0p13 86016 118783 16384 48 Unknown #### FOTAKERNEL?
/dev/block/mmcblk0p14 6922240 15269887 4173824 c Win95 FAT32 (LBA) #### SDCARD/EMMC/UMS
Partition table entries are not in disk order

so let's rearrange this list for easier thinking & reading

/dev/block/mmcblk0p1 1 2047 1023+ TA
/dev/block/mmcblk0p3 2048 2303 128 ?
/dev/block/mmcblk0p2 2304 3327 512 ?
/dev/block/mmcblk0p5 4096 20479 8192 ?
/dev/block/mmcblk0p6 20480 26623 3072 MODEMFS
/dev/block/mmcblk0p7 26624 36863 5120 ?
/dev/block/mmcblk0p8 36864 53247 8192 IDD
/dev/block/mmcblk0p9 53248 86015 16384 KERNEL
/dev/block/mmcblk0p13 86016 118783 16384 FOTAKERNEL?
/dev/block/mmcblk0p10 118784 2215935 1048576 SYSTEM
/dev/block/mmcblk0p12 2215936 2727935 256000 CACHEFS
/dev/block/mmcblk0p11 2727936 6922239 2097152 DATAFS
/dev/block/mmcblk0p14 6922240 15269887 4173824 SDCARD

great, the important (for us) stuff is contiguous so we can delete those partitions and recreate them

(if fdisk works like parted we must do that in numerical order, so system>data>cache>ums)

we must delete and recreate partition 13 with the same sizes

OTOH fdisk lets us experiment without saving in real time (!!!) but let's do this in recovery mode

Let's research the sizes we want first -- I find Link2SD's graphical df the best way to do this (see photo 1)

Launching fdisk:

#### SONY

#### SONY (red green blue lightbar)

#### + button

#### CWM-based recovery v5.5.0.4

riki@Shigeki:~$ adb shell

- exec '/system/bin/sh' failed: No such file or directory (2) -

#### No shell in ramdisk? Very lame...

#### [Mounts and storage]

#### [Mount /system, unmount everything else]

riki@Shigeki:~$ adb shell

sh-4.2# fdisk -u /dev/block/mmcblk0

Command (m for help):

What I did in fdisk:

u #### change units to sectors

d #### delete

14

d

13

d

12

d

11

c #### disable cylinder rounding

n #### new

l #### logical partition

First sector (3334-15269887, default 3334): 2215936

Sector 2215936 is already allocated #### Apparently this version of fdisk makes you waste a sector...

First sector (2215937-15269887, default 2215937): Using default value 2215937

Last sector or +size or +sizeM or +sizeK (2215937-15269887, default 15269887): +1600M

#### CACHEFS:

n

l

First sector (3334-15269887, default 3334): 5340938

Sector 5340938 is already allocated

First sector (5340939-15269887, default 5340939): Using default value 5340939

Last sector or +size or +sizeM or +sizeK (5340939-15269887, default 15269887): +8M

#### FOTAKERNEL

n

l

First sector (3334-15269887, default 3334): 86016

Sector 86016 is already allocated

First sector (86017-15269887, default 86017): Using default value 86017

Last sector or +size or +sizeM or +sizeK (86017-118783, default 118783): Using default value 118783

t

Partition number (1-14): 13

Hex code (type L to list codes): 48

Changed system type of partition 13 to 48 (Unknown)

#### USB STORAGE

n

l

First sector (3334-15269887, default 3334): 5356564

Sector 5356564 is already allocated

First sector (5356566-15269887, default 5356566): Using default value 5356566

Last sector or +size or +sizeM or +sizeK (5356566-15269887, default 15269887): Using default value 15269887

c

Partition number (1-14): 14

Hex code (type L to list codes): c

Changed system type of partition 14 to c (W95 FAT32 LBA)

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

sh-4.2# reboot

Now enter CWM again and factory reset -- you'll get an error as it can't delete /sdcard/.android_secure as it's unformatted

(and for that matter this CWM can't format /sdcard either...)

No problem apart from skipped heartbeats, boot into Android and format it from the settings! (see photo 2)

Well, the last screenshot speaks for itself... but I'll repeat, don't try this at home! (Have a friend try it so you'll have someone to blame if it gets bricked)