[Sony Xperia L] Option58:
When I installed Android 5.0 and later 6.0 ROM on our Xperia L experience was much better than stock. These ROM's are simply fantastic! However, we have memory issues. Yeah we can use apps like Link2SD or foldermount, but that's too much of a hassle. Thet's not really a long-term solution.

The main problem is that /data partition is too small to handle modern app file sizes. It's only 1GB.

And /sdcard partition also exists (which is seperate from data) and represents internal memory - that's 4GB.

On top of that our phone has externalSD slot - /extSD option.

When you install an app it always directly installs to /data. Yeah you can move it. But still 1GB is not enough, somehow I keep getting not enough memory notification.

So the first solution by [MENTION=5316423]Kahana82[/MENTION] was to repartition. That way we could remove 2GB from /sdcard and give it to /data. But the problem is that when we change partitions our phone gets bricked when stock ROM is flashed again.

But I have come across a new idea that could work. Just need community help for that as I am not that experienced.

So instead of repartitioning we could simply mount /SDCard as /data (just rename it!) and mount /data as /SDCard. That way we could increase /data from 1GB to 4GB and I think it is enough for basic app needs. And therefore flashing stock ROM should work as it is just change in kernel or system. Only 1GB internal memory wouldn't be a problem since Android 6.0 allows us to mount externalSD as internal memory.

Now how to do it. I have taken a look at this thread for 2011 Xperia Arc. Looks like ramdisk could be modified to do so as I see that mountpoint is there.

EDIT: OK, I've managed to unpack boot.img and ramdisk. Here's what I get:

fstab.qcom file

# Android fstab file.
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

#TODO: Add 'check' as fs_mgr_flags with data partition.
# Currently we dont have e2fsck compiled. So fs check would failed.

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults recoveryonly
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=/persist/footer
/dev/block/platform/msm_sdcc.1/by-name/userdata /data f2fs rw,nosuid,nodev,noatime,nodiratime,inline_xattr wait,formattable,check,encryptable=/persist/footer
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,noauto_da_alloc,journal_async_commit,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/cache /cache f2fs rw,nosuid,nodev,noatime,nodiratime,inline_xattr wait,check
/dev/block/platform/msm_sdcc.1/by-name/FOTAKernel /recovery emmc defaults defaults

/devices/platform/msm_sdcc.1/mmc_host/mmc0* auto auto defaults voldmanaged=sdcard0:32,nonremovable,noemulatedsd
/devices/platform/msm_sdcc.3/mmc_host* auto auto nosuid,nodev voldmanaged=sdcard1:auto,encryptable=userdata