Quick Hack: Save Tons of Space
So I was looking at my phone, and under 1.5 my dalvik cache was 31 megs (!!!). Rather than move apps to SD (I use my sd card for other stuff, and my apps are only 15 megs anyway) I began thinking.. what else could I move? Aha!
Here are the directions for moving dalvik-cache to /cache, which is unused on these images anyway (it is only for OTA updates.)
There is no fancy installer or much support, and there may be bugs (I only just did this today.)
Its pretty easy. And, so far, works well for me :) This walkthrough isn’t going to be particularly handholding, but if you need more help try the comments.
Just boot up a capable recovery image (such as JF’s) and mount up /cache and /data.
# cd /cache # mkdir dalvik-cache # chown 1000 dalvik-cache # chgrp 1000 dalvik-cache # chmod 771 dalvik-cache # cd /data # mv dalvik-cache dalvik-cache-orig # ln -s /cache/dalvik-cache dalvik-cache
The other thing you need is a new boot.img. This one is tuned for JF’s 1.5 adp1 image, and it may or may not work with anything else. Boot Image Cache to Cache JF1.5-ADP1 (523)
(All it does is create the /cache/dalvik-cache dir if it is missing and make sure the perms on /cache are 771 instead of 770.)
Tadah! If everything works, you can remove dalvik-cache-orig. If not, just flash the backup (you did take a backup, right?)
Enjoy!
(Big thanks to JF for helping with the boot image since I have no dev tools right now, and for testing it out for me too.)
on May 8th, 2009 at 3:05 pm
Very smart… I’ll definitely try this.
Reply
on May 8th, 2009 at 9:09 pm
So far so good, done a bunch of reboots, installed new apps, etc. (Also, test post cuz nobody is posting, and its weird.)
Reply
on May 11th, 2009 at 9:27 am
the download link for the boot image is broken. could you take a look at it? i would really want to try this out. thanks!
Reply
Disconnect Reply:
May 11th, 2009 at 9:41 am
It works for me..
Reply
on May 12th, 2009 at 12:42 pm
If I’m running on a sub-standard SD card (like a 2 or a 4 I guess) I probably don’t want to do this right? I’ve heard people having performance issues with apps2sd for the same reasons. please @j_norton me, I might not check back here, thx
Reply
burger Reply:
May 13th, 2009 at 4:33 pm
This should work without a SDCARD. So this /cache folder is only used for OTA updates???? Wow..
Reply
on May 16th, 2009 at 3:15 am
:| Wow….from 10mb free space to 40…..This really helped me with app space.
Reply
Disconnect Reply:
May 16th, 2009 at 9:02 am
so far I’m still really happy with it. and I haven’t gotten a single low-space warning :) haven’t had any issues, either – seems like everything is working smoothly. (I have only wiped cache for testing – it hasn’t happened ‘in the wild’ yet. but it just takes a little longer to boot once, then its fine again.)
Reply
on May 16th, 2009 at 5:46 pm
I did this before.. but I started running into performance issues and crashes, so I decided against it. i just do apps, apps-private and data.
Reply
Disconnect Reply:
May 16th, 2009 at 8:13 pm
sounds like you did something wrong. performance is identical (the flash is the same speed from end to end..) and crashes are a sign it couldn’t find the files. (hmm… betcha permissions, actually.)
Reply
on May 25th, 2009 at 8:40 am
When I try this, I get an error: no such user ‘1000′. I was able to chgrp with no problems. Does anyone have any thoughts? I’m running JF1.5
Reply
James N Reply:
May 25th, 2009 at 2:11 pm
There are a couple of things you can try:
“system” instead of “1000″
“/system/xbin/bb/chmod” instead of “chmod”
The issue is that there are two versions of chmod present on JF’s images. One is the toolbox version, which comes with all G1s. It understands usernames and not UID numbers. The busybox version, which JF installed, has more features but doesn’t know how to find Android usernames.
Reply
atalas Reply:
May 26th, 2009 at 1:11 pm
Yes. That was the missing link. Thanks muchly.
Reply
on May 28th, 2009 at 8:21 am
Hi,
Is there actually an updated boot-image for Android 1.51 for the dalvik cache hack?
Cheers,
–Tim
Reply
Disconnect Reply:
May 28th, 2009 at 4:49 pm
None needed, the boot image didn’t change between 1.5 and 1.51 so you can just use the old one.
Reply
Tim van der Leeuw Reply:
May 29th, 2009 at 7:15 am
OK, great, thanks! :-) Now however, a stupid question to which I couldn’t find the answer on Google: How do I install this custom boot.img file? :-(
I can use adb, but for some reason I have never managed to get fastboot working on my machine so I hope the answer doesn’t involve that.
Cheers and thanks in advance for an answer,
–Tim
Reply
Disconnect Reply:
May 29th, 2009 at 7:26 am
The easiest way is fastboot. Barring that, you can use flash_image. Copy it to the device (sdcard or flash) and run – as root:[code language=bash]$ flash_image boot.img[/code] and you should be good to go.
Tim van der Leeuw Reply:
June 2nd, 2009 at 1:45 pm
Well, that did sound easy enough, but flash_image actually wants to know a partition to which to flash too. I didn’t manage to find online which partition that would be, so I’d be grateful if someone could enlighten me…
Sorry for all the simple questions!!
–Tim
Disconnect Reply:
June 2nd, 2009 at 3:46 pm
Well, since its a boot image, maybe “boot”..?
Tim van der Leeuw Reply:
June 3rd, 2009 at 2:32 am
Hm, yeah, that _was_ a stupid question. I tried first ‘kernel’ which is what I saw in some pages about fastboot. That didn’t work. Later, after already posting, I tried ‘boot’ and yeah it worked. But then I got too busy with other things and forgot to post the answer to my own question (until now but now you already answered…).
At first the whole thing didn’t work, at all, and my phone was dead (at least, no UI. Only access via ADB shell). After much searching, rebooting, trying to set permissions again and again and phone not booting, I finally realized that I miss-spelled a directory name somewhere. Then it finally worked like it’s supposed to! ;-)
–Tim
Disconnect Reply:
June 3rd, 2009 at 6:31 am
Good deal. (FYI the definitive fastboot guide is up above still :) ..)