[Sony Ericsson Xperia Mini, Mini Pro, Xperia Pro, A] mikewse:
ABOUT

This is a solution for the dreaded warning about running low on internal memory on 2011 Xperia phones. My own Xperia Mini Pro has only 420MB of internal storage and this fills up quickly when installing apps. In this post I provide instructions and scripts to use the external SD card to extend the available internal storage, a so called “int2ext” solution which there are many flavours of.

The goal has been to solve the storage problem while at the same doing as small changes as possible to the system as possible (not unlocking bootloader, not installing custom recovery, etc).

Note that when the SD card is used to extend internal storage you should never power on the phone without the SD card inserted. Failing that you will probably need to factory reset and start over with the installation.

The whole 2011 Xperia range should be compatible, maybe other devices too.

BACKGROUND

After trying (and failing) with a number of the other solutions for enlarging internal storage with the external SD card, I've made my own solution that works on the Xperia Mini Pro (XMP) stock ICS ROM. In the second post I describe some properties of my implementation that may count as advantages for some, YMMV though.

COMPARED TO OTHER SOLUTIONS

See second post for technical description.

PREREQUISITES

Sony-Ericsson stock ICS ROM installed on your phone (you don’t need unlocked bootloader, recovery or any other mods)

Remove any other similar apps or tweaks (Link2SD, Apps2SD, INT2EXT etc) as they may interfere with this implementation. The installation script will abort if any of these are found.

USB Debugging enabled in your phone’s Developer settings.

Micro-SD card to install in the phone’s SD slot.

Cydia Impactor (optional)

Download from http://www.cydiaimpactor.com/.

Flashtool (optional)

Download from http://www.flashtool.net/. I have used version 0.9.18.6 which worked fine for the XMP while 0.9.20.0 had some problems. I have been told this has been fixed in 0.9.21.0 but have not verified it myself.

DOWNLOAD SCRIPTS

You find zip files as attachments at the bottom of this post.

INSTALLING

Check current firmware CDA (optional)

It is good to have a record of the exact firmware variant and version currently installed in case you need to flash back the stock ROM.

Go to the right place in the phone’s service menu:

open Phone Dialer

dial the secret code appropriate for your phone (for XMP it is *#*#7378423#*#*)

go into Service Info

go into Software Info

Note down the CDA number shown under the Customization Number heading

(see also http://www.hanfei.name/what-is-cust...xperia-device-and-how-to-view-or-find-it.html)

Partition your SD card

Your SD card should be partitioned as an MBR disk with (at least) two primary partitions:

The first partition should be formatted as FAT32 and will become your new (and smaller) SD card storage that you seen when connecting the phone to a computer.

The second partition should be formatted as Linux Ext2 and will become your extended internal storage.

You can have more partitions after these but these scripts will only care about the first two. I use a 16GB SD card and split even with 8GB to each partition.

There are many ways to perform the partitioning; I put the card in the SD slot on my computer and use the Minitool Partition Wizard Free Edition (http://www.minitool.com/partition-manager/partition-wizard-home.html) under Windows. For kicks you can install it using the Chocolatey auto-installer (https://chocolatey.org/packages/partitionwizard) if you like. You have more info about Minitool and other tools here:

http://xdaforums.com/wiki/index.php?title=SD_card_partitioning

Note 1: Remember to set that partitions should be primary as some tools may default to logical and not primary partitions.

Note 2: You probably want to copy all your SD card files to your computer while partitioning and formatting, and copy them back after, as all data will be erased on the SD card.

Prepare your phone

Insert the partitioned SD card.

Enable USB debugging in Developer settings.

Have a USB cable ready for connecting between your phone and computer.

Root

If you have already rooted you can skip this step. All you need is the su binary on the system - you don't need the SuperSU app installed.

I use Cydia Impactor to root:

connect phone

select "# drop SuperSU su to /system/xbin/su"

click Start

(see also http://xdaforums.com/showthread.php?t=2399464)

You can verify that it worked by opening a root shell.

I do this from Cydia Impactor:

menu Device > Open Shell…

type “su” at the prompt

type “id”

“uid=0(root)” should be shown

Update Busybox

The existing Busybox on the XMP is too old and will not support the way directories are mounted here. I have used Busybox 1.22.1 so I highly recommend that you install this version using the procedure below. If you already have this or a higher version installed you can skip this step but please verify that you have all the needed applets in your Busybox binary by checking against all the busybox aliases at the top of my scripts.

I use Flashtool to upgrade Busybox:

connect phone

Device menu > Install busybox

choose version 1.22.1

Install init.d support

The stock ROM does not have init.d support so we need to add it. If you have already added init.d support using some other software then you can skip this step.

Unpack the init.d.mikewse-<nn>.zip file to a directory (f ex init.d.mikewse) on your SD card.

Open a root shell on the phone using Cydia Impactor:

menu Device > Open Shell…

su

Install by running the install script:

sh /sdcard/init.d.mikewse/install.sh

You can verify the installation by checking the existence of the init.d directory:

ls -d /system/etc/init.d

The init.d function will be active after the next reboot and you can see messages from it in the kernel log:

dmesg | grep init.d

Install int2ext support

Unpack the int2ext.mikewse-<nn>.zip file to a directory (f ex int2ext.mikewse) on your SD card.

Open a root shell on the phone using Cydia Impactor:

menu Device > Open Shell…

su

Install by running the install script:

sh /sdcard/int2ext.mikewse/install.sh

You can verify the installation by checking the existence of the int2ext boot file:

ls /system/etc/init.d/40int2ext

The int2ext function will be active after the next reboot and you can see messages from it in the kernel log:

dmesg | grep int2ext

You should also be able to see the new larger size of your storage in the Storage menu of system settings.

Tweak what’s put on the SD card

The default int2ext script is set up with a good compromise between what files are delegated to the SD card vs are kept in the original location in internal storage. Apk files and app data are delegated to the SD card while unpacked app code (dalvik-cache) is kept on internal storage for speed and availability.

If you are installing a large number of apps your dalvik-cache may grow too large for internal storage. You can check how much it has filled up from a root shell:

df /mnt/int-stor

and also see how much of this is due to files in dalvik-cache:

du -s /mnt/int-stor/dalvik-cache

If you are hitting the limit then you can configure delegation of dalvik-cache to the SD card:

open a text editor with the 40int2ext file that you unzipped to the SD card in the int2ext.mikewse directory

edit the line

EXTDIRS="app app-private data"

so it becomes

EXTDIRS="app app-private data dalvik-cache"

then reinstall int2ext by running the install script again

REFLASH STOCK ROM

If you want to start from fresh or need to recover from some failure in the installation then you can flash back the stock ROM using Flashtool.

First let Flashtool download and assemble the appropriate stock ROM for you:

click XperiFirm icon in toolbar (furthest to right)

select your phone model

select the appropriate CDA (collected at the beginning of this post)

click the release info in the right pane to start download

Then flash it to the phone:

click Flash icon in toolbar (furthest to left)

choose Flashmode

follow instructions (for XMP press Volume Down)

If you have any questions or problems regarding Flashtool there are lots of threads on XDA were you can find solutions about drivers etc.

CREDIT / INSPIRATION / OTHER ALTERNATIVES

Extend internal storage

CronMod-INT2EXT http://xdaforums.com/showthread.php?t=1716124

Int2ext fixed for Xperia mini http://xdaforums.com/xperia-mini/development/fix-loosing-network-flashing-int2ext-t3039205

Link2SD http://xdaforums.com/showthread.php?t=919326

Apps2SD http://xdaforums.com/android/apps-games/apps2sd-partition-sd-card-link-apps-to-t3122919

Mounts2SD http://xdaforums.com/showthread.php?t=2432479

init.d support

init.d Terminit http://xdaforums.com/showthread.php?t=1933849

init.d for stock ROM http://xdaforums.com/showthread.php?t=1417375

Bye now and hope it works well for you :)