Welcome to the Android Central Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Page 1 of 2 12 LastLast
Results 1 to 25 of 27
  1. Thread Author  Thread Author    #1  
    picasticks's Avatar

    Posts
    136 Posts
    Carrier
    picarom+picasticks kernel

    Default [MOD] Move Dalvik to /cache to free up 40-60 M on /data

    This is a mod to move your phone's Dalvik cache to the /cache partition, freeing up the space it would normally take up in /data. Depending on how many apps you've got installed, you'll free up 40+ M of space on /data.

    This is an old mod that has been around a while and in all of the Optimus S ROMs. Recently I flashed my phone back to stock to build my own ROM, and was shocked to learn I had to delete half my apps until I'd reimplemented this feature! Finally, I understood why all the V people were messing around with old-school link2sd/app2sd instead of just using the froyo-native "Move to SD card"! Personally, I have tons of apps installed and around 60 M free on /data.

    I recently contributed this mod to LeslieAnn for Harmonia, so here I'm just putting it out separately. I don't know if he's the original author, but I owe props to KSmith since I originally cribbed mvdalvik.sh from ThundeROM. Thanks!

    Can I use this mod?

    This mod will only help you if you don't already have it. So, it's great if you're running mostly stock, like me.

    I don't know about every ROM, but these ROMs already have this feature (so you don't need to add it):
    • Harmonia (upgrade to latest)
    • Nameless/Reborn
    • CM7


    These ROMs don't (yet) have this feature (so you can add it):
    • stock (obviously)
    • Aphrodite
    • Bumblebee
    • Rodimus


    Other ROMs ... I haven't checked, but I'll update this list as people provide info.

    Count'em ... TWO ways to install

    1. There is an easy way, an update .zip. However, it may not be compatible with your ROM.

    2. There is the hard way, for which I will give full instructions. It is compatible with everything! However, it requires a Linux machine, the Android SDK installed, and familiarity with the command line. (You *could* also do it on an OS X or Win machine, if you've got mkbootimg and mkbootfs binaries ... but in that case you probably don't need this tutorial).

    So, first see if meet the requirements for the easy way. If you don't, or you're just a nerd, look at the hard way.

    1. The Easy Way

    The update .zip will replace the root filesystem (all the .rc files and other stuff in /) of your phone with a modded one from a stock Optimus V.

    Why could this possibly be bad? Well, your ROM may have done customizations in there that you want to keep. Or, it may have done customizations that don't matter to you, at least not as much as 40 M free on /data!

    I will try to make recs based on what I know about various ROMs, but you've got to make the decision for yourself.

    DO flash the .zip for:
    • stock ROM, including flashed with alternate kernel
    • Aphrodite
    • Bumblebee (NOTE you will lose init.d support ... so if you care about this move on to the hard way)
    • Rodimus (NOTE you will lose init.d support ... so if you care about this move on to the hard way)


    If you're still here, just download the attached mvdalvik-update.zip, copy it to your /sdcard, and flash like any update .zip. Last, be sure to wipe Dalvik and cache before you reboot.

    2. The Hard Way

    1. Download the attached mvdalvik-howto.zip and unzip it. From here on I'll assume it's unzipped into your home directory (and will refer to ~/mvdalvik-howto/filename) but you can put it anywhere. It contains:

    • flash_image: this is an ARM binary for your phone in case you don't already have
    • init.rc.diff: this is a patch you will be applying to your init.rc
    • mkbootfs: this is a Linux x86 binary I compiled from the froyo branch of Android
    • mkbootimg: "
    • mvdalvik.sh: this is a shell script you will be putting in /system/etc/ on your phone
    • split_bootimg.pl: script to unpack the boot partition image


    2. OK, first let's put mvdalvik.sh into /system/etc.

    Code:
    adb shell "mount -o remount,rw /dev/block/mtdblock5 /system"
    adb push ~/mvdalvik-howto/mvdalvik.sh /system/etc/
    adb shell "chmod 700 /system/etc/mvdalvik.sh"
    adb shell "mount -o remount,ro /dev/block/mtdblock5 /system"
    3. Now you will dump /boot to boot.img, unpack it, patch init.rc, and repack. (Read this for background.)

    Code:
    adb shell "cat /dev/mtd/mtd0 > /sdcard/boot-old.img"
    adb pull /sdcard/boot-old.img
    mkdir ramdisk && cd ramdisk
    gzip -dc ../boot-old.img-ramdisk.gz | cpio -i
    patch init.rc < ~/mvdalvik-howto/init.rc.diff
    cd ..
    ~/mvdalvik-howto/mkbootfs ramdisk | gzip -9 > ramdisk.gz
    ~/mvdalvik-howto/mkbootimg --kernel boot-old.img-kernel --ramdisk ramdisk.gz --cmdline 'mem=477M console=ttyMSM2,115200n8 androidboot.hardware=thunderc' --base 0x12200000 -o boot-new.img
    4. (possibly optional) If your ROM doesn't already have a flash_image command, you can add the included binary:

    Code:
    adb shell "mount -o remount,rw /dev/block/mtdblock5 /system"
    adb push ~/mvdalvik-howto/flash_image /system/bin/
    adb shell "chmod 755 /system/bin/flash_image"
    adb shell "mount -o remount,ro /dev/block/mtdblock5 /system"
    5. Now push boot-new.img to /sdcard, flash, clean up and reboot to recovery:

    Code:
    adb push boot-new.img /sdcard/
    adb shell "cat /dev/zero > /dev/mtd/mtd0"     # don't worry, "No space left on device" is normal
    adb shell "flash_image boot /sdcard/boot-new.img"
    adb shell "rm /sdcard/boot-new.img /sdcard/boot-old.img"
    adb reboot recovery
    6. Wipe Dalvik and cache, and reboot. You're done!
    theboundless likes this.
  2. #2  

    Default

    Yeah Link2sd lets u move the dalvik cache also to sd.
  3. #3  

    Default

    Quote Originally Posted by zedorda View Post
    Yeah Link2sd lets u move the dalvik cache also to sd.
    This moves it to cache partition.
    Would I have to uninstall link2sd before attempting this?

    Sent from my VM670 using Tapatalk
  4. Thread Author  Thread Author    #4  
    picasticks's Avatar

    Posts
    136 Posts
    Carrier
    picarom+picasticks kernel

    Default

    Quote Originally Posted by overthinkingme View Post
    This moves it to cache partition.
    Would I have to uninstall link2sd before attempting this?

    Sent from my VM670 using Tapatalk
    I haven't tested that but you shouldn't have to.

    Link2SD sets up a system of symlinking the apk and dex files of an individual app to copies on another location. This just bind mounts the entire dalvik cache (/data/dalvik) to the cache partition (mtdblock1).

    The system just sees /data/dalvik and uses it as normal.
  5. #5  

    Default

    I ask because it symlinked the dalvik cache too with it. I'm guessing the dalvik will be moved symlinks and all?

    Thank you for your time and contribution

    Sent from my VM670 using Tapatalk
  6. Thread Author  Thread Author    #6  
    picasticks's Avatar

    Posts
    136 Posts
    Carrier
    picarom+picasticks kernel

    Default

    Quote Originally Posted by overthinkingme View Post
    I ask because it symlinked the dalvik cache too with it. I'm guessing the dalvik will be moved symlinks and all?

    Thank you for your time and contribution

    Sent from my VM670 using Tapatalk
    You're welcome!

    Yes, that's what I think will happen. When you do this mod, you will want to wipe dalvik and cache in recovery. Then, on boot, dalvik is mounted to a different disk partition. Then the system rebuilds the dalvik cache. Finally, Link2SD will start once the full system is up, and do whatever magic it normally does (which I think is to look for .dex files in /data/dalvik, move them to sd partition, and symlink in /data/dalvik to the sd versions).

    If you are using Link2SD, this won't free up as much space as if you weren't, because these .dex are living on SD. But, there's still the dalvik cache for all your system/apps, and now that will be on cache instead of data, so you should still gain some space.
  7. #7  

    Default

    How do you flash the mvdavlik-update.zip? I can't see the options in the recovery menu.
  8. Thread Author  Thread Author    #8  
    picasticks's Avatar

    Posts
    136 Posts
    Carrier
    picarom+picasticks kernel

    Default

    Quote Originally Posted by theboundless View Post
    How do you flash the mvdavlik-update.zip? I can't see the options in the recovery menu.
    What recovery are you running? It's just a standard flashable .zip file, should work with any custom recovery.
  9. #9  

    Default

    I'm on RA-thunderc-1.1.0-GNM

    Where am I supposed to put the zip file?

    Oh yeah, and will losing init.d support affect sl4a scripts?
  10. #10  
    00_wrath_00's Avatar

    Posts
    657 Posts
    Carrier
    Running Quattrimus ICS

    Default

    I tried using xionia recovery and it worked flawlessly. Thanks picasticks keep up the good work.

    Sent from my VM670 using Tapatalk
  11. #11  
    00_wrath_00's Avatar

    Posts
    657 Posts
    Carrier
    Running Quattrimus ICS

    Default

    Quote Originally Posted by theboundless View Post
    I'm on RA-thunderc-1.1.0-GNM

    Where am I supposed to put the zip file?

    Oh yeah, and will losing init.d support affect sl4a scripts?
    Just place on the root of your sd card. Go to flash zip on thunderc recovery scroll down til you find the zip name. As to your other question not sure if you'll lose it or not.

    Sent from my VM670 using Tapatalk
    theboundless likes this.
  12. #12  

    Default

    Thanks, I got it working, my recovery was just acting wonky I guess, i deleted the file, redownloaded it, deleted a few old useless zips on my sd card, and there it was! Trying it out right now, funny, I just posted on the bumblebee rom thread about doing this! Great timing Pikasticks
  13. #13  
    JMusic's Avatar

    Posts
    158 Posts
    Carrier
    Stock-ish

    Default

    I was asking about this earlier and was directed to this post. I'm just curious if there is an easier way, because this seems like it may be more complex than it needs to be. On my old Samsung Moment I moved the dalvik cache to the cache directory and just linked it back to the data directory. Is there a reason this wouldn't work on the Optimus?
  14. #14  
    JMusic's Avatar

    Posts
    158 Posts
    Carrier
    Stock-ish

    Default

    And on another note...

    adb pull /sdcard/boot-old.img
    mkdir ramdisk && cd ramdisk
    gzip -dc ../boot-old.img-ramdisk.gz | cpio -i
    needs to be:

    adb pull /sdcard/boot-old.img
    ./split_bootimg.pl boot-old.img
    mkdir ramdisk && cd ramdisk
    gzip -dc ../boot-old.img-ramdisk.gz | cpio -i
  15. #15  

    Default

    Can this be used with Data2ext or would it be pointless?

    I was hoping to run the Dalvik cache on the phones memory instead of the SD will this be the case with this mod?
  16. #16  
    LeslieAnn's Avatar
    AC Forums Android Developer

    Posts
    2,893 Posts
    Carrier
    Harmonia 3

    Default

    Quote Originally Posted by JMusic View Post
    I was asking about this earlier and was directed to this post. I'm just curious if there is an easier way, because this seems like it may be more complex than it needs to be. On my old Samsung Moment I moved the dalvik cache to the cache directory and just linked it back to the data directory. Is there a reason this wouldn't work on the Optimus?
    Easiest method is to load a rom with it included.
    Harmonia and Bumblebee have it built in, I'm not sure about Nameless/Reborn.
  17. #17  
    JMusic's Avatar

    Posts
    158 Posts
    Carrier
    Stock-ish

    Default

    Quote Originally Posted by LeslieAnn View Post
    Easiest method is to load a rom with it included.
    Harmonia and Bumblebee have it built in, I'm not sure about Nameless/Reborn.
    I'm not looking for easy, just "works". I like the ROM that's on the phone already just fine. The reason I asked about sym-linking is it seems so logical that I was curious why it wasn't being used.

    I'm quite alright with doing any necessary work (I started with the manual steps for this mod, obviously).
  18. #18  

    Default

    nice work! thanks
  19. #19  

    Default

    This is a good mod. Thanks
  20. #20  

    Default Re: [MOD] Move Dalvik to /cache to free up 40-60 M on /data

    Thanks Picasticks for making this mod avaliable to us. Unfortunately when I flashed mvdalvik-update.zip to my android it now won't start up. When I turn it on it just says "fastboot mode" in small letters up in the top left corner and does nothing. At that point it doesn't respond to the power button either, so I just have take out the battery to turn my phone off. I did not wipe the dalvik and cache in recovery, because I didn't know what that meant exactly, so could that be why my phone is not starting up now? In the recovery mode on my phone where I flashed the mvdalvik-update.zip from, it didn't apear to have an option to wipe the davik or cache. (By the way, in my limited understanding I thought that you were refering to the folder data\davikcache, which I have deleted from time to time to remove any useless left over files from uninstalled apps, but I didn't bother to delete this time before shutting down the OS, because it starts rebuilding it as soon as you've deleted it. I just presumed that there would be an option to wipe it in recovery mode.)

    So the main problem is, I can't boot my phone now and don't know how to fix it - either revert it back to the way it was, or just make it boot up. Unfortunately I didn't do a nandroid backup first. I need to get my phone back up and running. Is anyone able to help??

    My phone is a rooted Acer Liquid MT S120 and is running stock ROM Gingerbread 2.3.6 and use Link2SD with partitioned SD card.
  21. #21  

    Default Re: [MOD] Move Dalvik to /cache to free up 40-60 M on /data

    You are posting in an LG optimus v forum, and this looks like a very old mod for optimus v roms
    I would suggest trying to post in your phones forum
    Then I would try to get to your recovery menu and hopefully restore your backup
    And I hope you haven't ruined your phone

    Sent from my VM670 using Android Central Forums
  22. #22  
    thekraven's Avatar

    Posts
    1,409 Posts
    Carrier
    kraven cm7/CM9

    Default Re: [MOD] Move Dalvik to /cache to free up 40-60 M on /data

    This mod has a boot.img which is phone specific, and made for the LG VM670. So hopefully you didn't brick yours. You might be able to flash in recovery a rom that is made for your phone. Or see if there's a stock rom you can flash.
  23. #23  

    Default Re: [MOD] Move Dalvik to /cache to free up 40-60 M on /data

    I see now you didn't make a backup

    Sent from my VM670 using Android Central Forums
  24. #24  

    Default Re: [MOD] Move Dalvik to /cache to free up 40-60 M on /data

    Oh no... I didn't see that above the thread name it said "Forum> LG Android Phones> LG Optimus Forums> Virgin Mobile Optimus V> Optimus V Rooting, ROMs, and Hacks>"
    That's the problem with coming to thread via a google search! Thanks guys for your quick response. It doesn't sound good, I was hoping I didn't have to reset the phone by flashing a new rom, but it sounds now like that is what I may have to do. Don't have time to do it now though. I'll make sure to back up my SD card first, just incase...
  25. #25  

    Default Re: [MOD] Move Dalvik to /cache to free up 40-60 M on /data

    Adamhos, thanks for your suggestions. Do you know if there is a thread for Acer phones on androidcentral? I've only been able to find the Acer tablet thread, there doesn't seem to be one.
Page 1 of 2 12 LastLast

Posting Permissions