Moving dalvik-cache from /data to free up some space topic


Hi guys !

I wanted to share some thoughts on more efficient dalvik-cache placement.

There are two paths we can take here:
- move some or all of dalvik-cache to /cache partition,
- increase size of cache partition using other, unused parts of or flash.

I'll write all the stuff in order from the easiest to most complicated.

1A. Moving some dex files to /cache

Open your /system/build.prop and make sure that parameter dalvik.vm.dexopt-data-only is set to zero - either change it or explicitly set it, if is not there. This will cause dex files for all apks from /system partition to go to /cache - for Vanir it's about 65M. Good start ;)

In theory you could move an apk from /data/app to /system/app and after reboot the dex file would move to /cache, but this creates two kinds of problems:
- after an update the app is on /data again and the dex file also,
- if you flash another rom, you'll most likely loose those apps, which isn't always desired, but this has a solution I'll give later.

1B. Moving entire dalvik-cache to /cache partition

If your dalvik-cache is smaller than /cache partition you might as well move it there entirely. There are few ways to do it, I'll show one of them.

Copy /fstab.samsungjanice somewhere (like /data/local/tmp/) and append (at the end!) the following line


Code:


/cache/dalvik-cache /data/dalvik-cache        none          bind              defaults

Reboot into recovery and ensure that /data and /cache are mounted. Connect with adb and then run those:


Code:


mkdir -p /cache/dalvik-cache
chown system.system /cache/dalvik-cache
chmod 771 /cache/dalvik-cache
cp -a /data/dalvik-cache/* /cache/dalvik-cache
rm -f /data/dalvik-cache/*


Now move the modified fstab.samsungjanice to /efs/common/overlay/fstab.samsungjanice and reboot.
If everything went fine, you've just earned up to 300M more on /data ;)

BEWARE that those two solutions are exclusive - either one, or the other. I don't know what happens if you use both - either nothing or it won't boot. You can of course switch between them - just don't enable both at the same time.

But... what if 300M is not enough? Then you can either stay with solution 1A or:

2. Enlarge /cache partition

Since preload, fota and kernel2 partitions aren't used (usually), we can extend /cache with them. This can be achieved either with repartitioning the flash or using lvm. I suggest the latter.

https://github.com/mkaluza/Samsung_S...Preload-to-LVM

This way you can have over 600M of /cache, and if you throw in fota and kernel2, even around 670M.

Having done that you can use either 1A or 1B depending on what you want. If you don't intend to switch to ART, you can safely assume 600M is more than enough - use 1B. If however you want to give ART a try, I suggest trying 1A first - after switch to ART /cache usage increased from 65M to 195M and total dalvik-cache size went from 285M to 780M!!!

That's it for now - I'll extend this tut later.

Now the homework;) I gave you the ideas, now if someone could create recovery scripts that do this automatically, many more people could use them :) Any volunteers? It's not difficult - of course I'll help (as in check them and do minor corrections, not as in doing it all). If nobody does it, I'll probably do it... eventually... I'm kind of lazy ;P

I'm thinking about creating a repository of scripts/plugins for mk kernel on github - those will be a good addition.

Now tell me how many people are interested in using this - hit 'thanks' on this post since that's the easiest - by all means DON'T write posts "I'm interested" etc ;)
@ChronoMonochrome, @ace2nutzer - it might be useful on codina as well.

P.S.
ART is awesome (using with my Vanir build which I'll make available soon)!!! Now Janice is even faster ;D




2 commentaires:

  1. Genuinely no matter if someone doesn't be aware of afterward its
    up to other users that they will help, so here it takes place.

    RépondreSupprimer
  2. This is really attention-grabbing, You're an excessively skilled blogger.
    I have joined your rss feed and stay up for searching for more of your
    excellent post. Additionally, I've shared your web site in my social networks

    RépondreSupprimer

Remarque : Seul un membre de ce blog est autorisé à enregistrer un commentaire.