• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Moving Dalvik-cache to cache partition

Search This thread

turboyo

Senior Member
Jun 23, 2009
592
2
Miami
I dont want to use app2sd as I feel it a bit unnecessary and I really don't need too much more space. I saw WES incorporated moving dalvik cache to the cache partition (cache part is 80 megs that will never get fully used on the slide). I asked in his thread twice but it seems it'll never be seen. Any way, I did some searching and found a script that does exactly what I want. This would also be useful for those like me that just want a few more mb's of internal storage and dont want to use apps2sd. I'm not a developer so I just want to put this here for our devs to mod or give the okay on if this will work on the slide.

I got the script attached from this thread. You can also read in more detail on what exactly it is I'm wanting to do here http://forum.samdroid.net/f9/relocate-dalvik-cache-free-up-space-1117/

I just want to know what has to be done if anything to get this working on the Slide. Thanks
 

Attachments

  • dalvik-cache.zip
    1.2 KB · Views: 1,739
I was able to get dalvik-cache to /cache by going into clockworkmod recovery and accessing from adb:

mv /data/dalvik-cache /cache/dc
ln -s /cache/dc /data/dalvik-cache

After the files are moved and the symlink is created, you should have no problems when rebooting.

However, I came across a problem when I flashed the radio, since it wiped the cache partition. If you are missing all your installed apps in android, it might be that the cache partition was wiped. You need to recreate the /cache/dc folder and reboot.
 

turboyo

Senior Member
Jun 23, 2009
592
2
Miami
Thanks for the input. finally someone! ..thats good to know Im going to try it now, I didnt think it would be as simple as a move command.. any reason the radio wipes the cache partition? did dalvik recreate itself after the wipe in /data? and were ALL the apps gone or just the few that took up the memory?
 
Thanks for the input. finally someone! ..thats good to know Im going to try it now, I didnt think it would be as simple as a move command.. any reason the radio wipes the cache partition?

I realize I wasn't completely clear. I don't know why the OTA radio update wiped my cache partition. Perhaps someone familiar with the update process (ChiefzReloaded) can explain this.

did dalvik recreate itself after the wipe in /data?

If you wipe only the cache partition, you will need to recreate the dir /cache/dc but not the symlink. If you wipe only the data partition, you will need to recreate the symlink, but not the dir. If you want to clear the dalvik-cache, just delete all the files in /cache/dc (they should be recreated on next boot). If you are accustomed to 'rm -R /data/dalvik-cache' to clear the dalvik-cache, you'll have to re-setup the symlink (and possibly the /cache/dc dir as well).

and were ALL the apps gone or just the few that took up the memory?

None of the apps are 'gone' per se, but since the /data/dalvik-cache dir is just a symlink to a non-existant dir (/cache/dc), the system can't create a dir that already exists (/data/dalvik-cache) and can't write anything to a dir that doesn't exist (/cache/dc), so it won't show any of the apps. It is an easy fix to just recreate the /cache/dc dir and reboot. None of your apps need to be reinstalled, since they are still in the /data/app dir.
 

turboyo

Senior Member
Jun 23, 2009
592
2
Miami
None of the apps are 'gone' per se, but since the /data/dalvik-cache dir is just a symlink to a non-existant dir (/cache/dc), the system can't create a dir that already exists (/data/dalvik-cache) and can't write anything to a dir that doesn't exist (/cache/dc), so it won't show any of the apps. It is an easy fix to just recreate the /cache/dc dir and reboot. None of your apps need to be reinstalled, since they are still in the /data/app dir.

Awesome, that cleared it up. Will be doing this now.
 

UnkzDomain

Senior Member
Nov 9, 2008
410
4
Louisville
unkzdomain.com
alright bringing this back up, works great but .. Just in case how do we move dalvik back to data with out loosing apps or anything?
I'm guessing you can do these in recovery:

rm /data/dalvik-cache
mv /cache/dc /data/dalvik-cache
rm -rf /cache/dc

But I haven't tested it. In theory it should work. The first command removes the symlink, the second moves the existing cache to the original location of dalvik-cache, and the last removes the copy of dalvik-cache on the cache partition.
 

riverajuan

Senior Member
Apr 16, 2008
547
26
I have tried this process, but shouldn't I see an increase in internal memory if you go to sdcard / phone storage?

Please advise, I am not totally clear of tthe process.

Can someone help?

I am very interested on this
 
I'm guessing you can do these in recovery:

rm /data/dalvik-cache
mv /cache/dc /data/dalvik-cache
rm -rf /cache/dc

But I haven't tested it. In theory it should work. The first command removes the symlink, the second moves the existing cache to the original location of dalvik-cache, and the last removes the copy of dalvik-cache on the cache partition.

It's up to you, but I would suggest just letting Android regenerate the cache...

rm /data/dalvik-cache
rm -R /cache/dc

I have tried this process, but shouldn't I see an increase in internal memory if you go to sdcard / phone storage?

Please advise, I am not totally clear of the process.

Can someone help?

I am very interested on this

It depends on how many applications you have installed, but you should see at least some kind of increase if you move the dalvik-cache off of /data and onto the /cache partition.
 

sibere

Retired Recognized Developer
May 14, 2006
2,055
375
Paris
I was able to get dalvik-cache to /cache by going into clockworkmod recovery and accessing from adb:

mv /data/dalvik-cache /cache/dc
ln -s /cache/dc /data/dalvik-cache

After the files are moved and the symlink is created, you should have no problems when rebooting.

However, I came across a problem when I flashed the radio, since it wiped the cache partition. If you are missing all your installed apps in android, it might be that the cache partition was wiped. You need to recreate the /cache/dc folder and reboot.

I've moved dalvik-cache to /cache with a symlink. However, everytime i booted, /cache was 770 and not 771.

To solve this, I just add a little script in /system/etc/init.d

#!/system/bin/sh
#
# Change 770 to 771 /cache to enable dalvik-cache
/system/bin/chmod 0771 /cache
echo "*** cache updated ***"
exit

Name it for ex. 02cache and chmod 755 it.

reboot and the /cache should be 771 now and dalvik-cache should work fine without patching anything (I have a stock rooted froyo rom)
 
  • Like
Reactions: osm0sis

turboyo

Senior Member
Jun 23, 2009
592
2
Miami
I've moved dalvik-cache to /cache with a symlink. However, everytime i booted, /cache was 770 and not 771.

To solve this, I just add a little script in /system/etc/init.d

#!/system/bin/sh
#
# Change 770 to 771 /cache to enable dalvik-cache
/system/bin/chmod 0771 /cache
echo "*** cache updated ***"
exit

Name it for ex. 02cache and chmod 755 it.

reboot and the /cache should be 771 now and dalvik-cache should work fine without patching anything (I have a stock rooted froyo rom)

forgive the newbness but to make that a script file do you just make that script into a .txt file and add it to system/etc/init.d? what exactly are you naming the file?
 

sibere

Retired Recognized Developer
May 14, 2006
2,055
375
Paris
forgive the newbness but to make that a script file do you just make that script into a .txt file and add it to system/etc/init.d? what exactly are you naming the file?

I did it with "vi", a linux text editor.

You can name it whatever you like. the 2 first numbers are for the order of execution if you have more than 1 script in /etc/init.d/
 

Almighty1

Senior Member
Jun 9, 2010
1,037
276
47
San Francisco, California USA
bit.ly
I've moved dalvik-cache to /cache with a symlink. However, everytime i booted, /cache was 770 and not 771.

To solve this, I just add a little script in /system/etc/init.d

#!/system/bin/sh
#
# Change 770 to 771 /cache to enable dalvik-cache
/system/bin/chmod 0771 /cache
echo "*** cache updated ***"
exit

Name it for ex. 02cache and chmod 755 it.

reboot and the /cache should be 771 now and dalvik-cache should work fine without patching anything (I have a stock rooted froyo rom)

I have a Motorola Droid running froyo 2.2 FRG83 rooted. I don't have a /system/etc/init.d file, what's the correct permissions for it? And shouldn't the 771 actually be on /cache/dc instead of /cache as all the 771 does vs the 770 is add the execute bit for others so basically it changes from rwxrwx--- to rwxrwx--x.

Also, I am curious what happened before you added the script to change the permissions, were you able to still use the terminal app to get into the shell after booting?
 

sibere

Retired Recognized Developer
May 14, 2006
2,055
375
Paris
To get /system/etc, you must boot into recovery mode
And I DO confirm to set 771 to /cache because the system rests it to 770 on each boot. For children folders, you can set 777, this will be kept even after a reboot.

Beleive me, that's how it works ;)

Sent from my HTC Desire using XDA App
 

Almighty1

Senior Member
Jun 9, 2010
1,037
276
47
San Francisco, California USA
bit.ly
To get /system/etc, you must boot into recovery mode
And I DO confirm to set 771 to /cache because the system rests it to 770 on each boot. For children folders, you can set 777, this will be kept even after a reboot.

Beleive me, that's how it works ;)

Sent from my HTC Desire using XDA App

There is no need to boot into recovery mode to get to /system/etc which is the same as /etc. All you need to do is use either root explorer app or get the terminal shell prompt and then get into the directory after you mount it as read+write. Besides, how do you get into the /system/etc directory with recovery mode?

I know /cache is set to 770 after boot but since /cache/dc is the directory that you're dealing with and the only difference between 770 and 771 is the 1 adds the execution by others to the permissions so it doesn't give others read+write anyways as that requires another 6 so why wouldn't just setting 771 on /cache/dc work. Before you did the 771 on /cache, are you still able to boot and use the phone and the apps?
 

Ace42

Senior Member
Jul 20, 2009
11,344
2,047
New York
Moto G Power
Motorola Edge
There is no need to boot into recovery mode to get to /system/etc which is the same as /etc. All you need to do is use either root explorer app or get the terminal shell prompt and then get into the directory after you mount it as read+write. Besides, how do you get into the /system/etc directory with recovery mode?

I know /cache is set to 770 after boot but since /cache/dc is the directory that you're dealing with and the only difference between 770 and 771 is the 1 adds the execution by others to the permissions so it doesn't give others read+write anyways as that requires another 6 so why wouldn't just setting 771 on /cache/dc work. Before you did the 771 on /cache, are you still able to boot and use the phone and the apps?

This would normally be the case, however the slide doesn't have S-off like other phones, so we can't mount with r/w like you would.
 

sibere

Retired Recognized Developer
May 14, 2006
2,055
375
Paris
To get to /system/esltc in recovery, connect your phone to your PC and use adb

If you leave 770 to /cache, dalvik VM will not get access to the directory and will rebuild dalvik-cache in /data.

But man, if you don't trust me, you can always try yourself and make your own experiments

Sent from my HTC Desire using XDA App
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    I was able to get dalvik-cache to /cache by going into clockworkmod recovery and accessing from adb:

    mv /data/dalvik-cache /cache/dc
    ln -s /cache/dc /data/dalvik-cache

    After the files are moved and the symlink is created, you should have no problems when rebooting.

    However, I came across a problem when I flashed the radio, since it wiped the cache partition. If you are missing all your installed apps in android, it might be that the cache partition was wiped. You need to recreate the /cache/dc folder and reboot.

    I've moved dalvik-cache to /cache with a symlink. However, everytime i booted, /cache was 770 and not 771.

    To solve this, I just add a little script in /system/etc/init.d

    #!/system/bin/sh
    #
    # Change 770 to 771 /cache to enable dalvik-cache
    /system/bin/chmod 0771 /cache
    echo "*** cache updated ***"
    exit

    Name it for ex. 02cache and chmod 755 it.

    reboot and the /cache should be 771 now and dalvik-cache should work fine without patching anything (I have a stock rooted froyo rom)
    1
    Do you guys have any suggestions for me?

    Now that espresso has S-OFF, I suggest custom partitions (with less to /system and almost nothing to /cache) until AlphaRev makes custom HBOOTs with different partition layouts.