1. Are you ready for the Galaxy S20? Here is everything we know so far!

[Avail] Relocating Dalvik cache to free up space

Discussion in 'Android Devices' started by Motorhead1991, Apr 29, 2012.

  1. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    While looking through the system boot scripts, I came across something of interest in the "init.rc" script:
    # create dalvik-cache and double-check the perms
    mkdir /data/dalvik-cache 0771 system system
    chown system system /data/dalvik-cache
    chmod 0771 /data/dalvik-cache

    If you change "mkdir /data/dalvik-cache" to "mkdir /dev/dalvik cache", would it move the dalvik cache to the 211mb "dev" partition and still retain functionallity, or would it cause issues?

    I've been playing with script writing and busybox commands trying to make this work with no success.

  2. scary alien

    scary alien not really so scary


    I think you're looking for something along the lines of the old (to me, at least ;) :)) "cache2cache" method of relocating the Dalvik cache to another area.

    For the Eris, this was done by moving the Dalvik cache to the /cache partition (vs. the /dev partition that are mentioned).

    Anyway, check out this thread over on XDA:

    [SCRIPT][1/22/2011] A Simple Cache2Cache for CM 6.x and 7.x ROMs - xda-developers

    for some interesting ideas and background about how this was done for the Eris (on admittedly older versions of Android). I don't know anything about your particular device or if this is even helpful, but it seems related.

    I'd caution you to take your requisite Nandroid backups and also due precautions.

    Good luck and cheers!
  3. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    The cache partition is 57mb on this device, and the dalvik itself is near 100mb. If I could alter the partitions themselves this would be irrelevant since "dev" is wasted space, having only 32kb taken out of 211mb...

    Partitions that I know:
    system - 210mb (47 available, mainly apps)
    data - 162mb (17 available)
    cache - 57mb (56 available)
    dev - 211mb (36kb used)
  4. scary alien

    scary alien not really so scary

    Yeah, the /cache partition for the Eris was our partition of choice :).

    Good luck and I hope the thread and XDA was useful.


    BTW, I've been to Pasco a few years back--my father lives just down the road from you in Hermiston :).
  5. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    I'm working on altering the XDA script to get this figured out. Moving 100mb to empty space will leave that much more for app data...
  6. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    Update: After running each command seperately, I managed to complete my goal. Now lets see if it can survive a reboot... :D
  7. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    Alright, for all of you Avail users, here's how I did this:

    Code (Text):
    1. # !/system/bin/sh
    2. #
    3. # Author: zach.xtr Jan 2011
    5. # Moves the /data/dalvik-cache files to largely unused /dev/dalvik-cache location and symlinks
    7. log -p i -t cache2cache "Running cache2cache to move data/dalvik-cache to /dev/dalvik-cache..."
    9.  /system/bin/busybox mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
    11. # Make sure final /dev/ location is setup correctly
    12. if [ ! -d /dev/dalvik-cache ];
    13. then
    14. log -p i -t cache2cache "/cache/dalvik-cache directory not found, creating and adding pe
    16. /system/xbin/busybox mkdir /dev/dalvik-cache;
    18. /system/xbin/busybox chown 1000:1000 /dev/dalvik-cache;
    20. /system/xbin/busybox chmod 777 /dev/dalvik-cache
    21. fi;
    23. if [ -d /data/dalvik-cache ] && [ ! -h /data/dalvik-cache ];
    24. then
    26. log -p i -t cache2cache "Moving files from /data/dalvik-cache to /dev/dalvik-cache";
    28. /system/xbin/busybox cp -fp /data/dalvik-cache/* /dev/dalvik-cache;
    30. /system/xbin/busybox rm -r /data/dalvik-cache;
    32. log -p i -t cache2cache "Creating Symbolic Link of /dev/dalvik-cache as /data/dalvik-c
    34. /system/xbin/busybox ln -s /dev/dalvik-cache /data/dalvik-cache;
    36. /system/xbin/busybox chown 1000:1000 /data/dalvik-cache
    38. /system/xbin/busybox chmod 0771 /data/dalvik-cache
    39. fi;
    41. # Clean up
    42. /system/bin/busybox mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
    In Terminal Emulator, I ran the system commands only, instead of doing the logs included. This doesn't seem to affect anything, so I see no point in logging the information. Note that I did not develop this, it is mearly an alteration of someone elses work. I owe this to zach.xtr of XDA for developing the original script. Enjoy the free space :D

    Picture proof that this works (I'd take a pic from a file viewer, but they don't want to cooperate:



  8. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    I'm working on creating an update package for this, stay tuned for that post. :D
    chrismbrunner likes this.
  9. wyldesolos

    wyldesolos Newbie

    only tried it once but couldnt get it work. i think it actually did move the partition because it basically reset the phone and my apps and info didnt show up anywhere afterwards. dont know what i did wrong but ill probably wait for your package and give it a try then.
  10. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    The only problem I've found with this is that ypu need to wipe the dalvik before you reboot the phone. It'll hang on startup if you don't
  11. SquidlyMcNerd

    SquidlyMcNerd Member

    Still working on this.....I'd like to try it out.
  12. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    It's pre-packed into my ROMs ;).
  13. SquidlyMcNerd

    SquidlyMcNerd Member

    Does MH 1 work now or is it up to 1.1 yet? Last time I tried it it didn't work. Will your ROM work with CWM?

    I softbricked my Merit and consequently had to buy another one. For that reason, I'm not in a hurry to flash too much of anything at the moment. I have CWM flashed and an original nandroid backup made "just in case".

    I screwed myself sorta when I replaced the 'CWM recovery' with a different 'recovery'. Not doing that any more. My old Merit defaults to "Android System Recovery".

    If you can help me with an update.zip and rescue the old phone.....I'd be glad to put it into service as a test device for your ROMs.....heh heh.

    The biggest problem I have with one.three and the like is the Go launcher. I hate that crap and don't want it. I would rather run a bone stock Merit than to have 'Go' anything on it.

    Here's a thread I started if you have the time. If not, that's cool. Time is something that none of us seem to have enough of.

    What exactly does update.zip consist of? ZTE MErit boot-looped at Android System Recovery
  14. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    My ROMs have Golauncher too. And it's weird that you say it didn't work, cuz it did the last time I tried it.
  15. SquidlyMcNerd

    SquidlyMcNerd Member

    Aren't you on an Avail? Do you know anybody with a Merit that has used it?

    I'm not going to be doing any ROM swapping with ROM's that have GO stuff, at least not on my main phone. It killed me to go a week without a phone. You don't realize how much you rely on one until you don't have it anymore. Don't have a problem with trying out any kind of ROM's on my secondary Merit once I get it back up.

    It's a shame creating ROM's isn't quite to the level of a GUI point-n-click yet. There could be all kinds of cool ROM's floating around if they're weren't so freakin' "rocket science" to create.
  16. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    The Avail and Merit are the same hardware. I'm actually tinkering with a Merit ROM right now...
  17. SquidlyMcNerd

    SquidlyMcNerd Member

    Does your ROM have a way for me to export or save the Dalvik script to SDcard to apply as a standalone?......not that I know how to do all that at this point. I think I might be able to pull it off.....but like I said, not in hurry to experiment with my main phone.

    If MH1 is CWM then I wouldn't have a problem with trying it out.
  18. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    It is CWM flashable, it's the only way I work :D. And no, it desn't have that option, yet. I'm still learning quite a bit about this sort of stuff, so I'll figure tgat out eventually.
  19. SquidlyMcNerd

    SquidlyMcNerd Member

    I'm too lazy to look around. Got a link to MH1?...heh heh. I want to make sure it's the newest version.
  20. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    I hacen't updated it since May, porting ICS has kept me busy.MH-1.0
  21. SquidlyMcNerd

    SquidlyMcNerd Member

    Faults out at:

    Checking MD5 sums...
    MD5 mismatch!
  22. Motorhead1991

    Motorhead1991 Android Expert
    Thread Starter

    Weird... I'll flash it on my other phone and see what comes up.
  23. neutrontech

    neutrontech Member

    I put the rom on my merit and it works great. No problems with Go products at all. The Go launcher works great. I even replaced the SMS and dialer apps with the Go versions. Makes for a much nicer overall experience.
  24. SquidlyMcNerd

    SquidlyMcNerd Member

    I never said there were any problems with Go products nor have I ever experienced problems with Go products. I just don't like them.

    I'm not sure MH how to go about making sure the checksums are OK on my end because in your MH1 rom, I can't find any MD5 file, nor any typical "cache.yaffs2.img" files where I would calculate checksums. Not sure how to calculate checksums on your rom on my computer.

    I had a nandroid backup on my phone that also gave me a MD5 mismatch error. The other nandroid backups worked fine.

    I downloaded Hashdroid from the market, rehashed all the cache.yaffs2.img and such files, transferred the new hash strings to the corresponding file in the MD5 and bingo! The backup worked fine after that.

    I wouldn't think because I'm working on a Mac would have anything to do with it but that may be the problem. Having a space added or taken away in the MD5 file during copying/pasting/etc.

    I'm not sure how the one.three-based roms work with CWM being they're not in the exact same "yaffs2" format as a nandroid backup.

    EDIT: DOH! Apparently it's my turn to be an idiot. I forgot that MH1 had to be installed as a zip. I was unzipping, and that's what generated the MD5 error. I have it installed now and am in the process of installing my own apps in order to check out the magic Dalvik operation.
  25. neutrontech

    neutrontech Member

    Oh, my bad. I misunderstood and thought you had issues with go launcher and was wondering if we got it working on the merit good. I liked the stock launcher but found it a bit too limiting, however go launcher has a ton if features i dont use. Still runs smooth though. The dialer lags a bit sometimes, but its worth it for the t9. The go SMS app is fantastic. I'm still looking for a faster dialer, but the ones I've tried don't look as nice as go's.

    Still looking for the stock web browser though.

ZTE Merit Forum

Features and specs are not yet known.

Release Date

Share This Page