[Sony Xperia L] Kahana82:
[Guide][XL][ADVANCED] Repartition internal memory (Data+SDCard0)→more space for apps

A lot of people are trying to extend the internal memory to install more apps after flashing Lollipop.

ART is using up more space and the /data partiton is clearly too small on our Xperia L...

It is possible to resize the /data/ partition by taking space allocated to the internal memory /SDCard0/ partition.

This guide will explain you how (for any phone)

Please read this through, so you know how to work with the commands below I used on the Xperia L.

Also read the disclaimers and precautions (backups etc) carefully before you start.

use at your own risk, I will not be held personnaly responsible for bricked phones, but will help as much as possible.

This thread has lots of information on backup/restore partitions and memblocks.

It seems flashing an official stock rom (.FTF) does not succeed in restoring the original partition table in case of problems

IT WILL MOST LIKELY BRICK YOUR DEVICE ... please stay on custom rom after this mod

Read post n°80 in this thread on how to possibly restore your phone memory (not reported as successful)

I have done this successfully by leaving only 2GB for the internal SD card partition, adding a little more than 2GB to the /data/ partition.

Feel free to adjust the partition sizes to suit your needs, just don't delete the internal SDCard partition or make it 0 in size.

After that, no more messing around with Link2SD or other methods, you can just install about anything you need normally...

The steps below were originaly posted in this thread

So, here is how it goes for our Xperia L:

Open a command window: CMD, then get into shell:

adb shell

Once in shell, type:

umount /storage

parted /dev/block/mmcblk0

print

This prints out the partition information of your phone's memory chip

You will see the partition numbers in the first column, partition names in the last one,

in between you have the start/end memory index and the partition size

------start---end---size

...

31---1795---3506---1711---userdata

32---3506---7818---4312---sdcard​

In the above output, consider the values indicated in italic as not to be changed !

Now calculate (open a spreadsheed if you like) the new value for the end of the userdata partition,

and use the same value for the start of the sdcard partition

On your sheet it should look something like this if you added 2048 to the userdata size

------start---end---size

31---1795---5554---3759---userdata

32---5554---7818---2264---sdcard​

Remove userdata and sdcard partitions:

rm 31

rm 32

Create the new userdata and sdcard partitions:

mkpartfs logical ext2 1795 5554

name 31 userdata

mkpartfs logical fat32 5554 7818

name 32 sdcard

Exit parted to go to the adb shell again:

quit

userdata partition (31) needs to have ext4 file system

The following will do the ext2->ext4 conversion:

cd /storage/sdcard1/fs-utils

tune2fs -j /dev/block/mmcblk0p31

tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p31

e2fsck -fpDC0 /dev/block/mmcblk0p31

Now you can go to recovery and format the sdcard partition (default)

Then you can restore the backup you made before all this or do a clean install

Enjoy installing your apps :)