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

Apps-to-SD in Recovery Terminal Tutorial(includes cache and dalvik-cache)

Search This thread

[email protected]

Senior Member
Jun 15, 2007
1,094
9
Alright, I've been posting this all over trying to help people figure out how to do this and figured it's time to make a dedicated thread. If at any point you get an error DON'T PROCEED. See if I referenced the error you're getting and, if so, do what I suggested. If not, post your error here and I'll try to get back to you ASAP.

NOTE: This can now also be done through my appstoSD app posted on this forum!!!! It will do everything for you.

This tutorial assumes you have:
A: A micro-sd card with 2 partitions, the first must be FAT32 and the second must be ext2.
B: Your phone must have one of the apps-to-sd ROM's installed.
C: Busybox installed into the /system/xbin directory. For steps on this please reference Darkrift's thread.

Before we start, let's make sure your phone is set up to handle this. Open up the terminal emulator app(available in the market) and type:

Code:
su
busybox df -h

If /system/sd doesn't appear, something is wrong. Either your sd card isn't partitioned correctly or your phone has a ROM that doesn't have apps to sd enabled. If /system/sd does show up then you're set and can start the tutorial

NOTE: Moving the cache is highly unstable and works for some people but not for most. I don't recommend trying unless you have a good idea of how to get your phone back to a usable state if it starts boot looping.

Now, for the first step you need to copy all the apps over to the sd card. To do this type(still in the terminal emulator)(The third and fourth lines are for cache to sd only):
Code:
busybox cp -a /data/app /system/sd/
busybox cp -a /data/app-private /system/sd/
busybox cp -a /data/dalvik-cache /system/sd/
busybox cp -a /data/data /system/sd/
exit
exit
Once the terminal emulator app closes, power off your phone. Then, turn it on in recovery mode by holding down the home button and then pressing the power button. Continue holding the home button until the "T-Mobile G1" icon goes away and a menu comes up. Then press Alt-x to go to recovery terminal. Press enter and a prompt should come up with a "#". Now type(If you only want your apps on your sd card and not the caches, skip steps 6-9)
Code:
mount data
rm -rf /data/app
ln -s /system/sd/app /data/app
rm -rf /data/app-private
ln -s /system/sd/app-private /data/app-private
rm -rf /data/data
ln -s /system/sd/data /data/data
rm -rf /data/dalvik-cache
ln -s /system/sd/dalvik-cache /data/dalvik-cache
reboot

And... you're all set! Your phone might take a while at the android screen since it has to populate the apps tray. If it lasts >5-10 minutes then something likely went wrong. Make sure you did all the steps correctly and if you did try the steps in the recovery terminal section of this tutorial again. If it still doesn't work, post here and we'll try to get it sorted out. That aside, enjoy having your apps on SD card and the permanent 72-73MB available!

EDIT: forgot the app-private directory. Thanks, LucidREM!!!
 
Last edited:
  • Like
Reactions: HTCDreamOn

LucidREM

Senior Member
Jan 18, 2009
1,572
5
Baltimore
www.lucidrem.us
Now, for the first step you need to copy all the apps over to the sd card. To do this type(still in the terminal emulator)(The second and third lines are for cache to sd only):
Code:
busybox cp -a /data/app /system/sd/
busybox cp -a /data/dalvik-cache /system/sd/
busybox cp -a /data/data /system/sd/
exit
exit
Once the terminal emulator app closes, power off your phone. Then, turn it on in recovery mode by holding down the home button and then pressing the power button. Continue holding the home button until the "T-Mobile G1" icon goes away and a menu comes up. Then press Alt-x to go to recovery terminal. Press enter and a prompt should come up with a "#". Now type(If you only want your apps on your sd card and not the caches, skip steps 4-7)
Code:
mount data
rm -rf /data/app
ln -s /system/sd/app /data/app
rm -rf /data/data
ln -s /system/sd/data /data/data
rm -rf /data/dalvik-cache
ln -s /system/sd/dalvik-cache /data/dalvik-cache
reboot

i see a missing step here .. what about /data/app-private
 

DynaMight

Senior Member
Apr 13, 2006
121
14
I'm sure its been asked and answered :) but I'll ask again! I understand it can take quite a few minutes to boot but is this every time you reboot or just the first time?

Thanks
 

emms007

Senior Member
Mar 19, 2008
132
5
if you use a class six sdcard, the apps will load faster. i believe that class 6 flash media is faster than the phones flash.

Pushing (writing) a 2MB file through adp push seems a bit faster to the SDCARD compared to the internal memory.
-> rough average for SDCARD : 1200 KB/s
-> rough average for system storage : 1000 KB/s

Regarding pulling (reading), internal seems faster :
-> rough average for SDCARD : 1247 KB/s
-> rough average for system storage : 1250 KB/s

These tests are everything but serious.. This is using the famous SanDisk 8GB Mobile Ultra (class 6).
To conclude I'd say that speed is almost the same, sometimes a bit faster for SDCARD.
 

bigballa

Senior Member
Feb 24, 2009
866
90
Atlanta
www.twitter.com
i have one question
i tried to read through the thread but it was waay to large and long

if u do install apps to the sd card
when u install a newer rom on it does that mean the apps are automatically installed once again? i would like to do this because haykuro's roms are released once a week and i dont like reinstalling apps over and over again...
 

[email protected]

Senior Member
Jun 15, 2007
1,094
9
i have one question
i tried to read through the thread but it was waay to large and long

if u do install apps to the sd card
when u install a newer rom on it does that mean the apps are automatically installed once again? i would like to do this because haykuro's roms are released once a week and i dont like reinstalling apps over and over again...

Unfortunately the answer is "sorta". The apps will still be on your sd card in the same places you put them. BUT all the symlinks will be gone so it'll look like they all dissapeared. You'll have to repeat the recovery terminal part of the tutorial, but all the stuff before it will be unnecessary.
 

wizern23

Senior Member
Jan 15, 2009
593
16
Mobile, Alabama
i keep getting /system/sd/app is not a directory but when i run mkdir /system/sd/app it says that the file already exists.

the one time i got adb to work i did the steps through it to get apps to sd but the i had to wipe my phone. do i have to do the steps in the first post or recreate the symlinks?
 

[email protected]

Senior Member
Jun 15, 2007
1,094
9
i keep getting /system/sd/app is not a directory but when i run mkdir /system/sd/app it says that the file already exists.

the one time i got adb to work i did the steps through it to get apps to sd but the i had to wipe my phone. do i have to do the steps in the first post or recreate the symlinks?

In terminal emulator do this:

Code:
su
cd /system/sd
ls -l[CODE]
And put what it says on the line with "app" in it here. If it says "app ->" and has something after the arrow(my guess would be /data/app) then you put the symlink the wrong way. Make sure you do ln -s /system/sd/app /data/app, not the other way around. Let me know what your results are
 

wizern23

Senior Member
Jan 15, 2009
593
16
Mobile, Alabama
In terminal emulator do this:

Code:
su
cd /system/sd
ls -l[CODE]
And put what it says on the line with "app" in it here. If it says "app ->" and has something after the arrow(my guess would be /data/app) then you put the symlink the wrong way. Make sure you do ln -s /system/sd/app /data/app, not the other way around. Let me know what your results are[/QUOTE]

huh? can you repeat that because i didnt understand what you were saying

im at the first step anyway. and thats when it says /system/sd/app is not a directory. my other question is is do i have to use
rm -rf /data/app
rm -rf /data/dalvik-cache
rm -rf /data/app-private

to re-establish the symlinks or did the steps through adb i used get erased when i wiped it.
 
Last edited:

cevatt

Member
Jan 2, 2009
31
0
In terminal emulator do this:

Code:
su
cd /system/sd
ls -l[CODE]
And put what it says on the line with "app" in it here. If it says "app ->" and has something after the arrow(my guess would be /data/app) then you put the symlink the wrong way. Make sure you do ln -s /system/sd/app /data/app, not the other way around. Let me know what your results are[/QUOTE]

i had the same problem. it said /system/sd/app is not a directory even though it already existed. when i used your code above this was my result:

drwx----- root        root                   2009-04-12 20:11 lost+found
-rw-r--r-- system    system     29303  2009-04-11 11:56 app
 

[email protected]

Senior Member
Jun 15, 2007
1,094
9
huh? can you repeat that because i didnt understand what you were saying

im at the first step anyway. and thats when it says /system/sd/app is not a directory. my other question is is do i have to use
rm -rf /data/app
rm -rf /data/dalvik-cache
rm -rf /data/app-private

to re-establish the symlinks or did the steps through adb i used get erased when i wiped it.

Umm I wouldn't proceed cause if /system/sd/app isn't a directory then you're gonna have lots of problems. I need to know what it says after you type
Code:
su
cd /system/sd/
ln -s
Specifically, there'll be a line of output that has the word "app" towards/at the end. I need to know what's in that line. If the line doesn't start with a 'd' then app isn't a directory and something happened and you need to remove /system/sd/app by typing this in the terminal emulator:
Code:
su
busybox rm -rf /system/sd/app
and then restart the process from the beginning.
 

wizern23

Senior Member
Jan 15, 2009
593
16
Mobile, Alabama
it says that /system/sd/app is not a directory but when i do mkdir /system/sd/app it says the file already exists.

the line with app in it says
-rw-r--r-- system system 29303 2009-04-14 17:27 app.

okay removing that made it work.

[edit] Thank you so much. it finally worked. i now have 73mb free on the phone.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Alright, I've been posting this all over trying to help people figure out how to do this and figured it's time to make a dedicated thread. If at any point you get an error DON'T PROCEED. See if I referenced the error you're getting and, if so, do what I suggested. If not, post your error here and I'll try to get back to you ASAP.

    NOTE: This can now also be done through my appstoSD app posted on this forum!!!! It will do everything for you.

    This tutorial assumes you have:
    A: A micro-sd card with 2 partitions, the first must be FAT32 and the second must be ext2.
    B: Your phone must have one of the apps-to-sd ROM's installed.
    C: Busybox installed into the /system/xbin directory. For steps on this please reference Darkrift's thread.

    Before we start, let's make sure your phone is set up to handle this. Open up the terminal emulator app(available in the market) and type:

    Code:
    su
    busybox df -h

    If /system/sd doesn't appear, something is wrong. Either your sd card isn't partitioned correctly or your phone has a ROM that doesn't have apps to sd enabled. If /system/sd does show up then you're set and can start the tutorial

    NOTE: Moving the cache is highly unstable and works for some people but not for most. I don't recommend trying unless you have a good idea of how to get your phone back to a usable state if it starts boot looping.

    Now, for the first step you need to copy all the apps over to the sd card. To do this type(still in the terminal emulator)(The third and fourth lines are for cache to sd only):
    Code:
    busybox cp -a /data/app /system/sd/
    busybox cp -a /data/app-private /system/sd/
    busybox cp -a /data/dalvik-cache /system/sd/
    busybox cp -a /data/data /system/sd/
    exit
    exit
    Once the terminal emulator app closes, power off your phone. Then, turn it on in recovery mode by holding down the home button and then pressing the power button. Continue holding the home button until the "T-Mobile G1" icon goes away and a menu comes up. Then press Alt-x to go to recovery terminal. Press enter and a prompt should come up with a "#". Now type(If you only want your apps on your sd card and not the caches, skip steps 6-9)
    Code:
    mount data
    rm -rf /data/app
    ln -s /system/sd/app /data/app
    rm -rf /data/app-private
    ln -s /system/sd/app-private /data/app-private
    rm -rf /data/data
    ln -s /system/sd/data /data/data
    rm -rf /data/dalvik-cache
    ln -s /system/sd/dalvik-cache /data/dalvik-cache
    reboot

    And... you're all set! Your phone might take a while at the android screen since it has to populate the apps tray. If it lasts >5-10 minutes then something likely went wrong. Make sure you did all the steps correctly and if you did try the steps in the recovery terminal section of this tutorial again. If it still doesn't work, post here and we'll try to get it sorted out. That aside, enjoy having your apps on SD card and the permanent 72-73MB available!

    EDIT: forgot the app-private directory. Thanks, LucidREM!!!