[Script]New "Low Storage" Notification fix

Search This thread

Wendigogo

Senior Member
Jun 14, 2010
614
327
Lyon
Samsung Galaxy Note 20 Ultra
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 :
Code:
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) :
Code:
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
 
Last edited:

sandeshnl

Senior Member
Dec 28, 2010
138
30
Kampen
Thanks for this. I kept wondering why I would run out of storage all the time. Well, now I know and you fixed it!

Sent from my GT-P7510 using XDA Premium HD app
 

TheeWolf

Senior Member
Oct 8, 2011
900
193
Hi,

Nice work.
Something I don't understand - how should I choose which apps I have their cache go to the /data partition? Apps that I frequently access? Apps that take a lot of space?
 

BradleyR2010

Senior Member
Jul 30, 2010
381
374
GT
Wendigogo I've previously had an old datafix posted that moved all the files to /data/data and I've only had issues when Chrome filled the cache so Ive ran your script but now /datadata is filled and everything is FC Chrome's cache seems to be in /data/data though

any ideas?
 
Last edited:

ImraanK

Senior Member
Oct 7, 2010
457
30
Durban
Er.. is my datadata folder meant to be empty after applying this patch ? Phone is definitely slower.. forgot to do a nandroid too argh.

As per the other fixes.. doubt this is reversible ?

Sent from my GT-I9000 using Tapatalk 2
 

Vertron

Senior Member
Jul 30, 2010
688
96
Very good script. Whats your future plans for this?

It would be really good if this was made into an app that let u select the apps cache you want on /data or /datadata rather than having to edit a text document.

Sent from my GT-I9000 using XDA
 

Bejda

Senior Member
Feb 12, 2011
2,869
1,946
Something went wrong for me too :eek:
I wasn't previously using datafix,flashed it and checked my /datadata a very little time after reboot that was 128Mb free.Seemed a lot of free space comparing to the only-libs 2903 version.For the same initial configuration/apps installed i usually get about 88Mb of free space after flashing 2903.
Just a little while later i noticed a datadata folder in /datadata and free space was now 66Mb...I reboot and /datadata ended full.

Note:Users of Devil or MnIcs get after each boot a user.log (+ a .bak of the previous boot) that describe among others things init.d process,it could help to paste it here :)
 

upichie

Senior Member
Nov 15, 2010
1,354
287
Hi,

Nice work.
Something I don't understand - how should I choose which apps I have their cache go to the /data partition? Apps that I frequently access? Apps that take a lot of space?

None would be the best choice.

Moving their cache out of /datadata can potentially make them laggy. However, some apps have massive caches (Flipboard, Chrome, Google Music, etc.); as such, these apps are unusable unless you do move their cache (or unless you have very few apps installed).
 

upichie

Senior Member
Nov 15, 2010
1,354
287
I wonder why so many people are having troubles. I'll give the script a try soon. It looks good! Thanks for your monumental contribution, Wendigogo. :)
 
Last edited:

basily

Senior Member
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 ...
But just a little "Thanks, it works great !" would be great ! :D

My vote is that you SHOULD put up a donation button, I am happy to contribute to your coffee fund (so long as you don't drink Starbuck's ;-) But since you're French, you surely have better taste than that!)
 

dongfangri

Senior Member
Mar 23, 2011
323
90
After upgrade to ver.0521 from 0329, I have the following problems:

1. There is a data.new folder, I wonder if it can be removed.
2. new installed apps haven't been moved to datadata
3. removed apps haven't been removed from datadata

I'm on cm9 0520 with devil 0.56 kernel, busybox updated to 1.20.

By the way, the scripts run well under scripts manager.
 
Last edited:

acras

Senior Member
Sep 29, 2008
116
25
Odessa
Seems to work for me... but can someone tell me what the following folders are for and if I need them or if they're remnants of some past datafix?

/data/data.new
/data/data2

Thanks.

+1. Why do we need those folders to be kept in data? But when I tried to delete data.new I got FC's for all of my apps. Seems that data.new has replaced data/data folder.

And one more. I wanted to move com.android.email to data/data completely and edited skip_apps.txt. But when I check datadata folder with Disk Usage app - com.android.email still remains there.
What have I done wrong?

Sent from my SGH-I897 using xda premium
 
Last edited:

dongfangri

Senior Member
Mar 23, 2011
323
90
I find that 0521 version uses busybox for copy /move /mkdir operation, which is different from old versions.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 124
    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 :
    Code:
    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) :
    Code:
    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
    8
    Took me time to realise, was seeing my datadata about 15mb left then thought "hmm, don't forget your datafix" but kept forgetting and finally see that every time chrome gav me that cache reading error datadata got more space left.
    Kept wondering about this and finally saw someone saying Pawitp talked about this.
    I didn't found Pawitp's words or changelog stating it but that's it.
    It's about a week that i flash cm9 based rom with no wipe and still i have approximately between 15 to 25mb left even opening new apps.
    That's a good news but if I understand correctly, it "only" flush the apps'cache if space left on /datadata is under 10%.
    But what's happen when installing many apps with big libs (like Dice Player or so) ? I mean if no more cache is present and low free space left ?
    I think CM dev thought about this but I'm curious. If someone could point to the appropriate bug it should be great ! :laugh:

    Will there be any further development to the datafix script in the future? If not I recommend updating the original post with the latest test version.

    I don't think the script needs any more work doing to it myself. Only thing I can think of is a user interface to make moving cache & apps to /data/data easier.
    There is developpement of the test version (as I've got a lot of personnal work not really fast :angel: ). And there's (at least) 2 bugs in test version : first if installing with previous datafix and second if space separated directories exists ...
    Both corrected in current version. I think upload a new zip tomorrow including these fixes (and creation of default txt files in /data/local/datafix directory).

    Plus Zatta and I are working on big improvements. Stay tuned ! ;)
    6
    The execution window opens and states that permission is denied
    Do I have to set something else before running this script through Script Manager? :confused:
    I suppose you have to run it as root ...




    As promised a new test version attached here, only two fixes here :
    • Solved a problem that can occurs if coming from another datafix version
    • Improve installation script in zip file :
      -creation of default txt files
      -adding gmail and market cache in move_cache.txt if not present
    • Fix issue with space separated directories in datafix script

    Some others things to include/improve and the undo_datafix to finish.

    Have a nice (end of) day ! :D
    5
    now i cannot download from play store,first i had the low storage notification,i flashed the datafix..it was good after the flash,no lag n no problem...but from today i cannot download from play store,i checked datadata by root explorer,there were just 166KB of space left..then i flashed the datafix again,now i have 9MB of space left but still cannot download from play store...any clue what to do?
    This is a problem I see before. You need to add "com.android.providers.downloads" and "com.google.android.gm" in "move_cache.txt" as said before. The first app is for market cache (so if /datadata is full you can't install/upgrade anymore apps) and the second is for Gmail cache.

    For whatever reason I can't clear any app's cache anymore, besides going in and manually deleting files. Apps don't work, doing it via Android's Manage Apps doesn't work—hell, not even Titanium Backup works.

    This is annoying.
    This could be "forced" by an external rooted app I think :)D @Zatta )

    Hey Wendigogo, do you follow the discussion here (plus read some posts back)?

    An uhh, you are okay, aren't you? Sent you a small update per mail, looks like you didn't get it again?
    Thanks for point this. I could use another directory in /data/local. The best way is to use a directory in /sdcard to prevent factory reset removing config files and to permit users editing it kindly.

    I install you update but don't have time to try it for now (no datafix installed as I don't have time to play with my phone now so few apps installed) .

    I'll be busy for about 2 weeks (preparing exams). I'll try to give a shot (and to YPhoto suggestions too) before this.

    Thanks for answering in this thread to people having problems. :cool:
    5
    Ok, it worked!
    For user that cannot get this mod to work:
    -Download Script manager.
    -With root explorer (or any other program) extract the script from the .zip file
    -Open Script Manager and run the script giving it root permissions and allowing it to run on boot.
    And that's it! Now everytime you reboot the phone the script will run.
    I've noticed the difference a lot, now my Galaxy S is a lot faster, and I do not have the low storage bug :cool:
    I will see if I face problems with Google Chrome (although I think the stock browser is a lot better)
    ;)
    EDIT: I'm running cm9 with Semaphore 1.2.0 kernel