• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [Avail] Relocating Dalvik cache to free up space

Motorhead1991

Android Expert
Mar 7, 2012
831
134
Pasco, WA
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.
 
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.

Motorhead1991,

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!
 
Upvote 0
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)
 
Upvote 0
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)

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

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

Cheers!

BTW, I've been to Pasco a few years back--my father lives just down the road from you in Hermiston :).
 
Upvote 0
Alright, for all of you Avail users, here's how I did this:

Code:
# !/system/bin/sh
#
# Author: zach.xtr Jan 2011

# Moves the /data/dalvik-cache files to largely unused /dev/dalvik-cache location and symlinks

log -p i -t cache2cache "Running cache2cache to move data/dalvik-cache to /dev/dalvik-cache..."

 /system/bin/busybox mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system 

# Make sure final /dev/ location is setup correctly
if [ ! -d /dev/dalvik-cache ];
then
log -p i -t cache2cache "/cache/dalvik-cache directory not found, creating and adding pe

/system/xbin/busybox mkdir /dev/dalvik-cache;

/system/xbin/busybox chown 1000:1000 /dev/dalvik-cache;

/system/xbin/busybox chmod 777 /dev/dalvik-cache
fi;

if [ -d /data/dalvik-cache ] && [ ! -h /data/dalvik-cache ];
then

log -p i -t cache2cache "Moving files from /data/dalvik-cache to /dev/dalvik-cache";

/system/xbin/busybox cp -fp /data/dalvik-cache/* /dev/dalvik-cache;

/system/xbin/busybox rm -r /data/dalvik-cache;

log -p i -t cache2cache "Creating Symbolic Link of /dev/dalvik-cache as /data/dalvik-c

/system/xbin/busybox ln -s /dev/dalvik-cache /data/dalvik-cache;

/system/xbin/busybox chown 1000:1000 /data/dalvik-cache

/system/xbin/busybox chmod 0771 /data/dalvik-cache
fi;

# Clean up
/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

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


CAP201205011634.png


CAP2012050116221.png


CAP201205011656.png
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
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.

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.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones