[MOD] [GUIDE] Save /data space and use that /cache partition!

Bert98

Senior Member
Jul 24, 2012
1,091
393
0
22
Padova
LINK TO THE THREAD WITH THE AUTOMATED SCRIPT (thanks to @skyguy126): http://forum.xda-developers.com/moto-g/general/mod-storage-reloacting-dalvik-cache-t2953616

Hello everybody

as you may know, our Moto G's internal eMMC card has a ~600Mb partition called /cache, which is not used since the apps' cache is stored in /data, so the latter fills up and the first one stays empty.

Owning a 8Gb model, having 600Mb not available for storage really bugged me, because my phone's memory (/data partition) was always full because it's a 5.7Gb space shared between apps and microSD files.

Well, thanks to @skyguy126, who linked me to this guide, I managed to link the dalvik cache files to the /cache partition :D

Now, it may not work for you if:
a) you have A LOT of apps installed.
And by "a lot", I mean more than 90-100 apps, but if you have a 8Gb model, you probably don't :laugh:

b) you're running ART
Since ART uses a lot more space than dalvik, the space in the /cache partition probably won't be enough. When I was running ART, it used 1Gb more than dalvik.​

Other than that, all you need is a rooted phone, the Terminal Emulator app installed (HERE), a root file manager, at least one hand and a working brain :D

I TAKE NO RESPONSIBILITY FOR ANY DAMAGE THAT HAPPENS TO YOUR PHONE, CONTINUE AT YOUR OWN RISK.

Steps:
1) Open any text editor, messaging app, notes app or anything that allows a text input. write the following line, select it and copy it to your clipboard (you'll need it later).
Code:
ln -s /cache/dalvik-cache /data/dalvik-cache
Also, make sure you open the Terminal Emulator app and type in "su" (without quotes), then grant it superuser access. You'll need to switch to it quickly.

2) Open your root file manager, while making sure you still see the terminal emulator's notification (I used Root Explorer but any other app should work just fine), go to /data, select the /dalvik-cache folder (just to be sure, hit "properties" to check its size. If it's less than 600Mb you're good to go. If it's not, this won't work, sorry) and move (NOT copy, MOVE) it to /cache. If it asks you to merge two folders, do it.

NOTE: now some apps may start force closing, it's normal, keep going

3) Switch to the Terminal Emulator app (via the recents screen or by tapping its notification" and paste the text you copied at the beginning by long-pressing the black screen and hitting "Paste" (DUH?!?:eek:), hit enter, make sure no error messages come up, then reboot.

TA-DAAAA!

Your dalvik cache is now linked to the /cache partition, enjoy that half a gigabyte :cool:

If you need any help, feel free to PM me :)

"But Bert, what if it doesn't work and my phone explodes?"

Well, if it blows up there's nothing much I can do, but if it's just stuck at bootanimation/bootlogo/somewhere where you can't use it, simply head to the recovery and wipe dalvik-cache. This will revert the process and delete the link, putting the phone as it was before :)
 
Last edited:

skyguy126

Senior Member
Sep 17, 2014
454
110
43
github.com
Batch File to Automate the Process!!! :D

Look at reply #58 for latest information


Old:
Batch file complete, credit goes to @Bert98 for devising a method.

USE THIS COMPLETELY AT YOUR OWN RISK! You may NOT rehost, take credit, or make a paid download without the permission of @skyguy126 or @Bert98

This will only work on windows based computers!
I tested this on my moto g xt1032 16GB running CM11 Nightly and it worked fine.

Click that thanks button if it helped! :D

How to use:
Step 1: Download the attached file and extract.
Step 2: Double click the cachemove.rbat file and follow the onscreen instructions.

EDIT: THIS IS NOT WORKING ON MOTO G STOCK 4.4.4!!!
I am working on this issue but any help is greatly appreciated!

Common errors:
"adbd root cannot run as root in production builds"
Solution: http://forum.xda-developers.com/showthread.php?t=1687590
Install the app and run it. Enable insecure binary.

Changelog:
v1.1 - Fixed some minor bugs in script.
v1.2 - Added a restore script.


 
Last edited:
  • Like
Reactions: Chris Kurisu

KahosTch

Member
Nov 25, 2012
34
5
0
Hello everybody

as you may know, our Moto G's internal eMMC card has a ~600Mb partition called /cache, which is not used since the apps' cache is stored in /data, so the latter fills up and the first one stays empty.

Owning a 8Gb model, having 600Mb not available for storage really bugged me, because my phone's memory (/data partition) was always full because it's a 5.7Gb space shared between apps and microSD files.

Well, thanks to @skyguy126, who linked me to this guide, I managed to link the dalvik cache files to the /cache partition :D

Now, it may not work for you if:
a) you have A LOT of apps installed.
And by "a lot", I mean more than 90-100 apps, but if you have a 8Gb model, you probably don't :laugh:

b) you're running ART
Since ART uses a lot more space than dalvik, the space in the /cache partition probably won't be enough. When I was running ART, it used 1Gb more than dalvik.​

Other than that, all you need is a rooted phone, the Terminal Emulator app installed (HERE), a root file manager, at least one hand and a working brain :D

I TAKE NO RESPONSIBILITY FOR ANY DAMAGE THAT HAPPENS TO YOUR PHONE, CONTINUE AT YOUR OWN RISK.

Steps:
1) Open any text editor, messaging app, notes app or anything that allows a text input. write the following line, select it and copy it to your clipboard (you'll need it later).
Code:
ln -s /cache/dalvik-cache /data/dalvik-cache
Also, make sure you open the Terminal Emulator app and type in "su" (without quotes), then grant it superuser access. You'll need to switch to it quickly.

2) Open your root file manager, while making sure you still see the terminal emulator's notification (I used Root Explorer but any other app should work just fine), go to /data, select the /dalvik-cache folder (just to be sure, hit "properties" to check its size. If it's less than 600Mb you're good to go. If it's not, this won't work, sorry) and move (NOT copy, MOVE) it to /cache. If it asks you to merge two folders, do it.

NOTE: now some apps may start force closing, it's normal, keep going

3) Switch to the Terminal Emulator app (via the recents screen or by tapping its notification" and paste the text you copied at the beginning by long-pressing the black screen and hitting "Paste" (DUH?!?:eek:), hit enter, make sure no error messages come up, then reboot.

TA-DAAAA!

Your dalvik cache is now linked to the /cache partition, enjoy that half a gigabyte :cool:

If you need any help, feel free to PM me :)
Hello! Thnk you for the tip, but, with me, i think, didnt work.
Im stuck in the boot, can you helpme to restore the directories? BTW, i have folloed all the steps like you say, i dont know why not work, im using CRom

Greetings!
 
  • Like
Reactions: Bert98

Bert98

Senior Member
Jul 24, 2012
1,091
393
0
22
Padova
Hello! Thnk you for the tip, but, with me, i think, didnt work.
Im stuck in the boot, can you helpme to restore the directories? BTW, i have folloed all the steps like you say, i dont know why not work, im using CRom

Greetings!
Do you have TWRP on your device?

Inviato dal mio Moto G utilizzando Tapatalk
 

fabus

Senior Member
Nov 12, 2013
188
68
0
Wroclaw
Hello! Thnk you for the tip, but, with me, i think, didnt work.
Im stuck in the boot, can you helpme to restore the directories? BTW, i have folloed all the steps like you say, i dont know why not work, im using CRom

Greetings!
To get it working just wipe dalvik cache in cwm, it will re-create directory in /data.

I had the same issue..

I will try to investigate what went wrong with this....
 

fabus

Senior Member
Nov 12, 2013
188
68
0
Wroclaw
I have found an issue. When you are copying /data/dalvik-cache to /cache/dalvik cache permissions can be mismatched (different partition type).

To fix it just:
- Go to CWM
- Connect phone to PC (should be recongnized as ADB device, if not check in Hardware Manager how it was recongizes)
- issue "ADB shell" command
- in Android shell: chmod 644 /cache/dalvik-cache/*
- reboot and you are done :)

I have made up an easier way to achive dalvik-cache on /cache partition:

On running android:
- make sure /cache/dalvik-cache folder is empty!!
- Rename /data/dalvik-cache to /data/dalvik-cache2
- ln -s /cache/dalvik-cache /data/dalvik-cache
- reboot and done :)

Android will recreate dalvik cache in /cache/dalvik-cache dir, it will take about 10 minutes, so be patient :)

if something goes wrong, just rename /data/dalvik-cache2 by ADB (e.g. in CWM)

I hope if was helpfull.

Cheers,
 

AndroidHtc101

Senior Member
Apr 8, 2013
352
125
73
Guys could some experts code a batch file for this?
I appreciate the guide but terminal codes etc are beyond me.....
600mb is quite a lot of space to gain for an 8gig moto g:)

Sent from my XT1032 using XDA Free mobile app
 

dethrat

Senior Member
Jan 2, 2012
408
98
0
Guys could some experts code a batch file for this?
I appreciate the guide but terminal codes etc are beyond me.....
600mb is quite a lot of space to gain for an 8gig moto g:)

Sent from my XT1032 using XDA Free mobile app
It's up to 600mb. It's what ever size your dalvik cache is. I don't think this will work on android 5.0 since the change to art.
 

AndroidHtc101

Senior Member
Apr 8, 2013
352
125
73
Skyguy

I have around 125apps and 500mb free, would installing the batch screw my phone up?

Thanks for helping :)

Sent from my XT1032 using XDA Free mobile app
 

Bert98

Senior Member
Jul 24, 2012
1,091
393
0
22
Padova
Skyguy

I have around 125apps and 500mb free, would installing the batch screw my phone up?

Thanks for helping :)

Sent from my XT1032 using XDA Free mobile app
It depends on your /data/dalvik-cache folder's size, you can check with root explorer :)

Inviato dal mio Moto G utilizzando Tapatalk
 

AndroidHtc101

Senior Member
Apr 8, 2013
352
125
73
Hi Bert

It's 466.92mb

If I could get 500mb of more free space I would have a gig free which would really help my 8gb moto g:)

Sent from my XT1032 using XDA Free mobile app