[Galaxy S I9000 General] Wendigogo:
Here we go ! :D

Starting point is from CyanogenMod Captivate forum and some improvement were added here and there. Credits are recalled and came from this thread : [SCRIPT][CM7/9] /datadata/ low storage notification lagless fix - init.d script.

Background :

CyanogenMod (CM) based roms on our I9000 (and brothers) uses a small and fast flash chip to store application datas. This make the rom smooth and sweet ... This chip is mounted as /datadata and is about 170Mo.

With a lot of apps (or apps storing lots of stuff there) we faced a "Low storage" notification and our phone becomes laggy.

The first idea was to move this /datadata to /data (about 2Go) whose have a lot of free space. This works but the phone became laggy.

Then some others devs think about moving back to /datadata frequently accessed files (sqlite database and xml preferences files). First as scripts part then as flashed zip file. The phone becames smoother but not like a "vanilla" CM rom. This is the 1103 datafix in thread linked previously.

An xda user suggested to let on /data only library files and move back all other stuff to /datadata. These lib files are only accessed (when used by users) in read mode so the ext4 /data partition is efficient in this way and phone becomes smoother as "vanilla" CM roms. This is the 2903 datafix I made and post in previously linked xda thread.

But with this latest datafix, applications cache are stored in /datadata and recent Google apps (like Chrome) fulfilled it quickly : the "Low storage" notification is back ! :mad:

Next solution :

Like 2903 datafix, only libraries ("lib" and "libs" subdirectories) stay on /data by default.

BUT unlike it

you could choose which apps will also store their cache in /data

. And this is REVERSIBLE : if one of selected app becomes laggy you could move back its cache onto /datadata

How to use it :

Make a nandroid backup

Just grab the zip file and flash it in recovery

At reboot, it will revert previous datafix (if there is one) and apply this one. So first boot could take more time (5 minutes max) than "normal" boot.

It also creates a "datafix" directory in /data/local with two files : "move_cache.txt" and "skip_apps.txt".

Just edit the first file (root needed) to add apps whose cache will go back to /data at next boot :

com.android.chrome
org.mozilla.firefox_beta

will put Google Chrome and Firefox Beta cache on /data. All others apps cache will go to /datadata.

If you want Firefox cache to go back on /datadata, just remove its line in the file and reboot.

In the "skip_apps.txt" file, just put apps you want to fully stay on /data/data. If apps was previously moved to /datadata by the datafix it won't apply; you have to add its name in "skip_apps.txt" file after installing it and before rebooting the phone. On the other hand, if you remove the apps name from "skip_apps.txt" file all but libraries will be moved to /datadata at next reboot.

Requirements :

Samsung Galaxy S based phone (GT-I9000, Vibrant, Fascinate, Captivate, etc.)

CM based rom (including CM7/9, MIUI and maybe ao(k)sp etc.)

Kernel that supports init.d scripts (latest CM9 nightly support it)

Busybox installed

A fresh nandroid backup

FAQ :

Q : There is 2 zip files, who's the good one ?

A : It depends of your kernel. With stock CM9 kernel use the Datafix20120521. With others like Devil etc., use the SDatafi20120521. The only difference is between the script name : 30datafix or S30datafix. Some recent kernels add a "S" before the init.d script name. Why ? No idea !!!

Q : Will this wipe my phone ?

A : No, it should not delete any data on your phone. But as it's not tested with every phone xda user have it's a good idea to have a fresh nandroid backup

Q : Do I need to reflash the zip file ? When ?

A : The datafix will be erased each time you upgrade/change your rom (including Nightly Builds) or your kernel (many of them "clean" the init.d directory). But if you don't install lots of apps after upgrading you don't really need to install the datafix again : without full wipe, a nandroid restore or an Odin full installation te datafix will stay on.

Q : Is there something to do when backuping my apps ?

A : Nandroid should work without specific option;

Titanium Backup

users should tick the Preferences > Troubleshooting settings > Follow all symbolic links option. I don't use other backup apps ...

Q : Can I use this on Samsung based rom ?

A : No ! And it's irrelevant cause Samsung roms don't have the "Low storage" issue !

Q : I'm using Slim ICS rom, do I need some busybox fixer etc. ?

A : I don't use SlimICS but all commands in my script call busybox directly so it should work. Let me know if there is still a problem with this !

Q : Why do you change naming of the zip file ?

A : Cause I want ! And it's listed directly in chronological order in terminal (or recovery) in this way.

Q : How can I know which apps use most space on /datadata :

A : Just run as root (in adb or terminal) :

du -s /datadata/*|sort -n

Downloads :

Box : https://www.box.com/s/6783d86f3840c02db911

Dropbox : https://www.dropbox.com/sh/rwibb0r0fhhyvh6/KaoBoC1BtB

Please don't mirror this.

I put the shell script in attachement here. Just grab it on your sdcard, remove the ".txt" extension and you could run it using Scripter or equivalent (root needed). Please post here if something gone wrong when using it.

Donations :

As I spent some time (and coffee) for this (and april datafix for those following previous xda thread) I think about a donation button. Give me your advise on that please ...

Link for donations ;)

But just a little "Thanks, it works great !" would be great ! :D