[SCRIPT] No-lag solution to CM7/9 "low memory" notifications (STEP BY STEP,FIXED TB)

Search This thread

revthanki

Senior Member
Apr 9, 2010
284
170
[SCRIPT] No-lag solution to CM7/9 "low memory" notifications (STEP BY STEP,FIXED TB)

23/01/12 - Now with Titanium Backup support!
The Titanium Backup team is awesome. I contacted them and within 3 days they had a working fix. To make sure that titanium backup works properly all you need to do is download the latest version from the market, go into 'preferences' and select 'follow all symbolic links' in the 'Troubleshooting' section at the bottom. That's it. Now you'll be able to backup normally and then restore your apps in any other rom. Neat!


Okay, I've found a rather excellent solution to the low storage problem that plagues the CM7 and CM9 roms - without causing the lagginess of the ".nodatadata" approach. It's not my work but was posted by drefnel on the Cyanogenmod forum. It's very smart: instead of moving the whole of /datadata (fast yaffs2) to /data (slower ext4) and so introducing lag it keeps most apps' non-performance critical data on /data and moves performance critical sqlite databases and xml preference files to the fast /datadata.

Installing this fix is a two step process:
  • Phase 1 - some prep, takes around 10 minutes to complete. Only has to be done once.
  • Phase 2 - running the script whenever you've installed new apps and used them once or twice. this just involves hitting a shortcut on your home screen. boom!

The original guide can be found here we need to make a few alterations and I've done a step-by-step below:



Step by step guide

  • I take no responsibility if using these instructions messes up your phone. They worked for me and you should always be able to restore using the clockworkmod backup. But you can't say you haven't been warned.
  • Make sure you're running CM7 or TeamHacksung's CM9 or Onecosmic ICS.
  • This will NOT work on encrypted phones.
  • DO A NANDROID BACKUP BEFORE YOU BEGIN.

Phase 1 - (if you've already used the ".nodatadata" method then start at step 4)

1. Download Terminal Emulator

2. Open terminal emulator and then enter each of the following followed by return:

  • su
  • touch /datadata/.nodatadata

3. Reboot (this might take a while as the OS will be making changes to your filesystem).

4. Open terminal emulator and then enter each of the following followed by return:

  • su
  • rm /data/data/.nodatadata

5. Reboot into recovery, go to "mounts & storage" and then select "format datadata". Reboot normally.

6. Go to the market and download GScript Lite. Open it and close it again - this should create a folder called "gscript" in your sdcard. Unzip the file attached in this post and place the script in it in that folder.

7. Open up GScript Lite, press menu and add script. Click load file, select the script file, make sure that "needs SU" is selected and click save.

8. Run the script by tapping it. You should see GScript report its progress and finally the script should finish. Press close and gscript will crash out (can't have it all :D ).

Phase 2

Add a shortcut to this script on your desktop.

  • CM7 - long-press and hold a blank area of your home screen, select 'add shortcut', and then select 'gscript lite'. select the script you've just added.
  • CM9 - go into your app drawer, select the 'widgets' tab, find 'gscript lite', press and hold it and move it onto your home screen. select the script you've just added.

You should use the shortcut after you've installed new apps and used them a few times. There's no harm in not using the script for a while, all that will happen is that app may become a bit laggy until you use the script to move its data to /datadata.


That's it. Congratualtions!


You can flash new CM roms and the script will carry on working fine, but if you wipe data in recovery then you'll have to start from the beginning

You won't be able to easily go back to the original configuration or use the ".nodatadata" method (you'll need to Titanium Backup, wipe everything and then restore), but you'll never miss them.

Good luck

I hope this helps people out. We should find a way of better automating the steps to make it more noob friendly and maybe Team Hacksung and One Cosmic could incorporate it into their ROMs. (Essentially the script needs to be run periodically to make sure that the performance critical /data/data elements of new apps are copied across to /datadata - apart from that it's not too different from the ".nodatadata" approach).
 

Attachments

  • move_data_to_yaffs_NOT_FLASHABLE.zip
    1.7 KB · Views: 1,484
Last edited:

diablosv36

Senior Member
Nov 1, 2010
125
22
Personally using the much simpler .nodatadata approach, i found that after a rom (cm9) install, most lag goes away after using it for a few hours, although I have heard the speed of the flash memory is not equal on all devices... so could be laggy for some regardles of usage.
 

1eoltl

Member
Feb 12, 2011
8
0
Kelowna
Sorry for being a noob.. I am not sure how to apply the script to my Android device... Should I use Terminal Emulator on my Galaxy S and type the script in there? Would you mind to guide me through the process? Thanks a lot :)
 

Zatta

Inactive Recognized Developer / Contributor
Dec 22, 2010
2,177
1,222
Sneek
Wouldn't it be an idea tu use scriptmanager (free or pro) instead of gscript? it can run scripts on boot.
Maybe later, when the standard kernel for cm9 will support init.d, it can be an init.d script?

And oh, I will put a link to this thread in the wiki, you can edit the wiki yourself also if you ask for acces.
 
Last edited:

revthanki

Senior Member
Apr 9, 2010
284
170
Wouldn't it be an idea tu use scriptmanager (free or pro) instead of gscript? it can run scripts on boot.
Maybe later, when the standard kernel for cm9 will support init.d, it can be an init.d script?

And oh, I will put a link to this thread in the wiki, you can edit the wiki yourself also if you ask for acces.


Good points. The reason I chose GScript was its user friendliness and simplicity. There are define advantages in running this script at boot. (I'd much prefer to have things run automatically before the GUI appears (as in init.d) rather than clog up GUI boottime as Script Manager would require.)

The phenomenal uptime I get with Android means that I don't reboot very often. Ideally we'd want something that monitored the data/data folder and ran the script on the appearance of new folders. I'm not sure how you'd automate that without resorting to Tasker. Maybe init.d is the best we can do when it's supported. In the meantime a GScript shortcut on the desktop that I hit once every couple of days feels like the best option so far!

Sent from my GT-I9000 using XDA App
 
Last edited:

Code124Y

Senior Member
Oct 19, 2010
1,167
251
georgetown
seem like there is no one try on OneCosmic, and im going it a shot!
will report later~

Tested on OneCosmic and it working good for all but picture/gallery gone...
what i mean is it scan no photo nor any image on my phone~
using gallery+ giving me the same view(nothing in gallery)
but other then this 2 gallery, im try with quickpic also and yup it show pic~

but i want the original picture gallery from the 4.0.3... any help?
 

Zatta

Inactive Recognized Developer / Contributor
Dec 22, 2010
2,177
1,222
Sneek
There are more advantages in scriptmanager. You are not bound to a specific location on the scared for example, with gscript it has to be in /sdcsrd/gscript folder. And you can make a widget with this script in it, making it a one-click operation but I believe that is a paid feature (and gscript can do something similar, no?)
On the other hand, it is as you say, a bit more complicated.

Also making it a init.d isn't a full solution. Every update from the ROM will wipe the /system/etc/init.d so the script needs to be reinstalled.

Maybe a cwm-flashable would be needed than, everybody here can flash. In that case also the initial commands could be run during flashing.


Taptalked u see
 
Last edited:
  • Like
Reactions: revthanki

revthanki

Senior Member
Apr 9, 2010
284
170
...Maybe a cwm-flashable would be needed than, everybody here can flash. In that case also the initial commands could be run during flash

Yup, a flashable zip which runs initial commands and then appends on an init.d script seems like the way to go. Once the CM9 kernel supports I'll learn how to make these (essentially lazy, me) :D

BTW, making a one click operation from GScript is easy. Just add the GScript shortcut to your home screen and it will prompt you which script you want to run on click (remember that shortcuts are now grouped with widgets in ICS)

Sent by airmail.
 

revthanki

Senior Member
Apr 9, 2010
284
170
Tested on OneCosmic and it working good for all but picture/gallery gone...
what i mean is it scan no photo nor any image on my phone~
using gallery+ giving me the same view(nothing in gallery)
but other then this 2 gallery, im try with quickpic also and yup it show pic~

but i want the original picture gallery from the 4.0.3... any help?

Have you tried clearing the data for the gallery app? Worth a shot.


Sent by airmail.
 

1eoltl

Member
Feb 12, 2011
8
0
Kelowna
I just have a question popped up in my mind, after applying this script,when I update my teamhacksung ROM in the future(i.e the future build15), will it causes any problem / break my phone?
 

revthanki

Senior Member
Apr 9, 2010
284
170
I just have a question popped up in my mind, after applying this script,when I update my teamhacksung ROM in the future(i.e the future build15), will it causes any problem / break my phone?

Absolutely shouldn't, as long as pawitp doesn't ask you to wipe data. If he does then you'll have to start again :D

Flash away!



Sent by airmail.
 

Funnnny

Senior Member
Jan 27, 2011
674
183
Hanoi
nguyenthanhcong.com
Originally Posted by Funnnny<br />
People, beware that this will break your TitaniumBackup, I was tested myself
<br />
<br />
How do you mean? A bit more detail please. It really shouldn't, as Titanium Backup does respect symbolic links...<br />
<br />
<br />
Sent by carrier pigeon.

When I backup, wipe and restore, titaniumbackup just restore the symlink, not the actual data

Sent from my GT-I9000 using Tapatalk
 

Top Liked Posts

  • There are no posts matching your filters.
  • 41
    [SCRIPT] No-lag solution to CM7/9 "low memory" notifications (STEP BY STEP,FIXED TB)

    23/01/12 - Now with Titanium Backup support!
    The Titanium Backup team is awesome. I contacted them and within 3 days they had a working fix. To make sure that titanium backup works properly all you need to do is download the latest version from the market, go into 'preferences' and select 'follow all symbolic links' in the 'Troubleshooting' section at the bottom. That's it. Now you'll be able to backup normally and then restore your apps in any other rom. Neat!


    Okay, I've found a rather excellent solution to the low storage problem that plagues the CM7 and CM9 roms - without causing the lagginess of the ".nodatadata" approach. It's not my work but was posted by drefnel on the Cyanogenmod forum. It's very smart: instead of moving the whole of /datadata (fast yaffs2) to /data (slower ext4) and so introducing lag it keeps most apps' non-performance critical data on /data and moves performance critical sqlite databases and xml preference files to the fast /datadata.

    Installing this fix is a two step process:
    • Phase 1 - some prep, takes around 10 minutes to complete. Only has to be done once.
    • Phase 2 - running the script whenever you've installed new apps and used them once or twice. this just involves hitting a shortcut on your home screen. boom!

    The original guide can be found here we need to make a few alterations and I've done a step-by-step below:



    Step by step guide

    • I take no responsibility if using these instructions messes up your phone. They worked for me and you should always be able to restore using the clockworkmod backup. But you can't say you haven't been warned.
    • Make sure you're running CM7 or TeamHacksung's CM9 or Onecosmic ICS.
    • This will NOT work on encrypted phones.
    • DO A NANDROID BACKUP BEFORE YOU BEGIN.

    Phase 1 - (if you've already used the ".nodatadata" method then start at step 4)

    1. Download Terminal Emulator

    2. Open terminal emulator and then enter each of the following followed by return:

    • su
    • touch /datadata/.nodatadata

    3. Reboot (this might take a while as the OS will be making changes to your filesystem).

    4. Open terminal emulator and then enter each of the following followed by return:

    • su
    • rm /data/data/.nodatadata

    5. Reboot into recovery, go to "mounts & storage" and then select "format datadata". Reboot normally.

    6. Go to the market and download GScript Lite. Open it and close it again - this should create a folder called "gscript" in your sdcard. Unzip the file attached in this post and place the script in it in that folder.

    7. Open up GScript Lite, press menu and add script. Click load file, select the script file, make sure that "needs SU" is selected and click save.

    8. Run the script by tapping it. You should see GScript report its progress and finally the script should finish. Press close and gscript will crash out (can't have it all :D ).

    Phase 2

    Add a shortcut to this script on your desktop.

    • CM7 - long-press and hold a blank area of your home screen, select 'add shortcut', and then select 'gscript lite'. select the script you've just added.
    • CM9 - go into your app drawer, select the 'widgets' tab, find 'gscript lite', press and hold it and move it onto your home screen. select the script you've just added.

    You should use the shortcut after you've installed new apps and used them a few times. There's no harm in not using the script for a while, all that will happen is that app may become a bit laggy until you use the script to move its data to /datadata.


    That's it. Congratualtions!


    You can flash new CM roms and the script will carry on working fine, but if you wipe data in recovery then you'll have to start from the beginning

    You won't be able to easily go back to the original configuration or use the ".nodatadata" method (you'll need to Titanium Backup, wipe everything and then restore), but you'll never miss them.

    Good luck

    I hope this helps people out. We should find a way of better automating the steps to make it more noob friendly and maybe Team Hacksung and One Cosmic could incorporate it into their ROMs. (Essentially the script needs to be run periodically to make sure that the performance critical /data/data elements of new apps are copied across to /datadata - apart from that it's not too different from the ".nodatadata" approach).
    2
    Yup I've tried both and the script approach is definitely much quicker in my case. I'm going to see if I can simplify this procedure somewhat.
    2
    Seems to me that the biggest problem with /datadata are the per-app cache's of webviewCacheChromium class data.

    This is an Android supplied method to provide a WebView, i.e. it's how apps can easily display some web content. So often used e.g. for changelogs, help pages, and anything else the app wants to display from the web without firing up a full browser.

    By default, this seems to cache about 5.6MB per app that uses it. So it doesn't take too many of those to stuff up the 170MB /datadata partition, even without the other cache uses (e.g. database dirs) etc.

    The app can clear the cache itself, but it seems that many do not do this, at least in my experience.

    Settings - Apps - - Clear Cache *does* clear it fortunately, so you can try that, and then as long as the app doesn't do it again, you might keep the space thus recovered. e.g. if it's only used by the app occasionally... worth keeping an eye on, at least.


    Edit: http://xdaforums.com/showthread.php?p=23485715

    I've also got the impression that moving apps to SD doesn't *always* move their associated data/cache from /datadata. I need to re-test this a bit...
    2
    Is that normal to have 2040 points at Quadrant after using this no-lag solution, without overclock. Before that I could only reach 1700 with 130% Live oc.
    I'm using teamhacksung's CM9 ALPHA, BETA 16 with Icy Glitch V14.

    That's normal, with /datadata on /data partition, you will get a big score in database read/write test. This is why quadrant score is useless ;)
    2
    I've tried everything that you've said but it still didn't work.. I still got the same error.. i tried both but nothing worked.. :(

    Than how about:
    rm -rf /datadata/lost+found
    rm -f /datadata/*
    And proceed?

    Edit: do the format trick, more easy (why didn't I come up with that :))
    Taptalked u see