[SCRIPT][CM7/9] /datadata/ low storage notification lagless fix - init.d script

Search This thread

naTrium

Member
Feb 17, 2007
9
139
Hello fellow I9000 users.

tl;dr - This fixes your low storage notification problems just by flashing it on CWM.

Disclaimer
First of all, I'd like to inform you that this post is a compilation of the work done by drafnel on the CyanogenMod forums, revthanki on the XDA-Developers forum, and as such I take little to no credit in it, as all I've done was ask for drafnel to help me in the cleanup code for me to put it in a flashable zip.

Sources:
http://forum.cyanogenmod.com/topic/39718-workaround-for-small-datadata-partition/
http://xdaforums.com/showthread.php?t=1444333

Also, as you should know, you take full responsability should data loss or other kinds of damage occur.

Introduction
Lot's of people have encountered the problem where their /datadata partition fills up and then apps begin force closing. This is often confusing since there is usually a lot of space available on the internal 2GB storage partition. But these are two different partitions on cyanogenmod. The created the datadata partition on the fast internal memory so that apps would start up and run faster (i.e. less lag), but it is only about 170MB (which can't be helped).

One thing that can be done is to move the contents of /datadata onto the 2GB /data partition. That will solve the space problem, but then you have the lag problem. So, what we need is for the files that take up a lot of space to reside on the 2GB partition and the files that are accessed frequently by an app to reside an the fast 170MB partition. The files that are accessed often, or that affect app startup speed are the sqlite database files and the xml preferences files. These reside in the databases and shared_prefs sub-directories in each app directory. Drafnel has written a script to perform these operations.

Requirements
  • Samsung Galaxy S based phone (GT-I9000, Vibrant, Fascinate, Captivate, etc.)
  • Kernel that supports init.d scripts

How to use it?
As you would flash a ROM update or a Kernel:
  1. Download the file to your sdcard.
  2. Reboot your phone into CWM.
  3. Choose 'install zip from sdcard', and choose the script from there.
It will run on boot everytime. It's pretty light so your total boot time shouldn't suffer. It will only do the operations if they are needed, and it will clean up after itself. No need to worry about broken links or stale resources.


What it actually does?
On every boot:
  1. Runs a check to see if /data/data is still symlinked to /datadata/
  2. Moves everything that isn't performance critical from /datadata/ to unlinked /data/data/
  3. Cleans up old databases from uninstalled apps

Other stuff to watch out for
  • Titanium Backup users should tick the Preferences > Troubleshooting settings > Follow all symbolic links option
  • SlimICS users should follow this procedure

Changelog
11032012 - First working release.
 

Attachments

  • DataFix_11032012.zip
    195.4 KB · Views: 30,071
Last edited:

sthomas38

Senior Member
Feb 9, 2012
695
524
OMG yeah! Was waiting for something like that :D. Will give it a try next time I'll encounter this problem :).

Thanks mate.
 

Njcki

Senior Member
Jun 28, 2010
143
43
I had HUGE problems with Titanium Backup.
I lose all by backups some weeks ago because symlinked were corrupted after restore!
 

stfudude

Senior Member
Aug 17, 2010
1,053
308
Egypt
what if i already moved all my apps data to sdcard? do i move it back to internal memory then flash the script, or just flash the script then move the data to internal memory? which is the correct way?
 

naTrium

Member
Feb 17, 2007
9
139
AFAIK, if you have moved your apps to the SD card using the regular method (Apps2SD), the script will still work. This is because there's always leftover data on the phone, which then points to /.android_secure/ on the sdcard.

This script only changes the location of some data, but it's transparent to the phone.

If you don't feel safe about it, a full nandroid backup will restore the system to whatever setup you have now. (it also backs up what's mounted on the sdcard)
 

revthanki

Senior Member
Apr 9, 2010
284
170
Well done! I knew I was never going to get round to this :D I'll close my old thread and redirect people here. Before I do so:

1) does the stock CM9 kernel support init.d scripts? If not stock kernel users will have to follow the manual method.

2) maybe it's worth putting a capitalised warning in your post to get people to set the option in Titanium Backup to follow all symbolic links
 
Last edited:
  • Like
Reactions: naTrium

stfudude

Senior Member
Aug 17, 2010
1,053
308
Egypt
I flashed this script already but the low on space notification is still shown. It's definitely not working.
Do I have to create .nodatadata file inside /datadata and reboot now?
Sent from Ice-Cream flavored SGS GT-I9000 using Tapatalk
 

fahad123

Senior Member
Jun 27, 2010
330
49
33
Lahore
Free space in datadata folder,
Before flashing the script = 25mb
After flashing the script = 146mb
Definitely works without any lags.. one might experience lags on the first boot but after another reboot all gonna be super smooth like before!
Thanks a lot!! :)
 

Sepharite

Senior Member
Oct 12, 2011
672
31
It deleted some of my apps like Dolphin HD. I'm running CM9, with IcyGlitch Kernel. :( Oh well, restored.
 

Christophe86

Senior Member
Feb 19, 2011
131
43
Ghent
aha! :D that's the reason why all my apps suddenly began to lag like hell and some time after that force close. had only 1MB free space on /datadata partition lol. script works like a charm! thx ;)

Sent from my GT-i9000 using xda premium
 

naTrium

Member
Feb 17, 2007
9
139
I flashed this script already but the low on space notification is still shown. It's definitely not working.
Do I have to create .nodatadata file inside /datadata and reboot now?
Sent from Ice-Cream flavored SGS GT-I9000 using Tapatalk

I heard some kernels don't load init.d scripts on ICS, might be related to that.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 137
    Hello fellow I9000 users.

    tl;dr - This fixes your low storage notification problems just by flashing it on CWM.

    Disclaimer
    First of all, I'd like to inform you that this post is a compilation of the work done by drafnel on the CyanogenMod forums, revthanki on the XDA-Developers forum, and as such I take little to no credit in it, as all I've done was ask for drafnel to help me in the cleanup code for me to put it in a flashable zip.

    Sources:
    http://forum.cyanogenmod.com/topic/39718-workaround-for-small-datadata-partition/
    http://xdaforums.com/showthread.php?t=1444333

    Also, as you should know, you take full responsability should data loss or other kinds of damage occur.

    Introduction
    Lot's of people have encountered the problem where their /datadata partition fills up and then apps begin force closing. This is often confusing since there is usually a lot of space available on the internal 2GB storage partition. But these are two different partitions on cyanogenmod. The created the datadata partition on the fast internal memory so that apps would start up and run faster (i.e. less lag), but it is only about 170MB (which can't be helped).

    One thing that can be done is to move the contents of /datadata onto the 2GB /data partition. That will solve the space problem, but then you have the lag problem. So, what we need is for the files that take up a lot of space to reside on the 2GB partition and the files that are accessed frequently by an app to reside an the fast 170MB partition. The files that are accessed often, or that affect app startup speed are the sqlite database files and the xml preferences files. These reside in the databases and shared_prefs sub-directories in each app directory. Drafnel has written a script to perform these operations.

    Requirements
    • Samsung Galaxy S based phone (GT-I9000, Vibrant, Fascinate, Captivate, etc.)
    • Kernel that supports init.d scripts

    How to use it?
    As you would flash a ROM update or a Kernel:
    1. Download the file to your sdcard.
    2. Reboot your phone into CWM.
    3. Choose 'install zip from sdcard', and choose the script from there.
    It will run on boot everytime. It's pretty light so your total boot time shouldn't suffer. It will only do the operations if they are needed, and it will clean up after itself. No need to worry about broken links or stale resources.


    What it actually does?
    On every boot:
    1. Runs a check to see if /data/data is still symlinked to /datadata/
    2. Moves everything that isn't performance critical from /datadata/ to unlinked /data/data/
    3. Cleans up old databases from uninstalled apps

    Other stuff to watch out for
    • Titanium Backup users should tick the Preferences > Troubleshooting settings > Follow all symbolic links option
    • SlimICS users should follow this procedure

    Changelog
    11032012 - First working release.
    11
    For those of you who are having trouble getting the script to run, I have created a small flashable zip that will ensure that the missing busybox applets are symlinked. For whatever reason SlimICS doesn't have busybox linked properly.

    TL;DR - Flash if on SlimICS
    9
    I get rm failed for -rf when I manually run the script. Any ideas? I'm on a Samsung captivate and cm9.
    Just remove the "f" from each "rm" command.
    But it seems you're using the April script which is not recommended and buggy.

    I'm working on a "next generation" script running flawlessly since 3 days. Like the 2903 datafix libs are on /data and everything else is on /datadata. But now, you could move selected applications cache (like Chrome or so) to /data. And this could be reverted ;-)
    I have to test this when updating rom then create a new topic here. :p.

    Sent from my GT-I9000 using XDA
    6
    Please help me working datafix for slim ics 3.4 with devil kernel 2_0.74 thanks....
    Has anyone got this to work on AOKP build 33 yet? And if so, which kernel are you on, which version of this script did you use and exactly how did you install it?
    Actually, make that build 34 since I'm currently looking at the bug fixes that one introduces and I'm probably going to update now...
    Did you try to rename the /system/etc/init.d/30datafix to /system/etc/init.d/S30datafix ????

    I think I should make another zip file with this mod ...


    EDIT : done DataFix_29032012v2.zip
    6
    Does this script move the cache to /data/data aswell, or does it stay in /datadata?

    I hope it does as it's annoying having to delete the cache all the time.
    As some apps lag if their cache wasn't on /datadata you could choose (by editing a text file) which apps store their cache on /data. This could be reverted if app becomes laggy ...

    EDIT : Here is my new datafix : http://xdaforums.com/showthread.php?t=1665742