5,606,409 Members 33,432 Now Online
XDA Developers Android and Mobile Development Forum

How to run applications off the sdcard (Updated 6/3/09)

Tip us?
 
dwang
Old
(Last edited by dwang; 3rd June 2009 at 07:17 PM.)
#1  
Senior Member - OP
Thanks Meter 169
Posts: 2,140
Join Date: Nov 2008
Default How to run applications off the sdcard (Updated 6/3/09)

DOES NOT WORK ON CUPCAKE 1.5. Try one of the other apps to sd card threads.


I decided to create a new thread for hacking a rooted g1 to allow applications to run from the sdcard. The original thread's instructions don't work without some modifications and the original poster doesn't seem to have the time to update it.

I'll try to keep the original post as up to date as possible as new information comes.

Prerequisites:

1. Rooted g1 with jesus freak version 1.30 or 1.31, 1.41 (rc30, rc33) Works with all rooted US, UK, international versions of the g1.

2. Have "adb" from the android sdk installed on your desktop machine.

Sdcard preparation:

Divide your sdcard into 2 partitions. The first partition should be FAT, the second partition should be EXT2. This can be most easily accomplished using a linux or mac machine. For windows, you can use "paragon partition manager 9" to do this. It will allow you to partition your sdcard and format the 2nd partition to ext2 fs. It is very important that the 2nd partition be formatted as EXT2 or the rest of the procedure will NOT work. The 2nd ext2 partition will be used to store your installed apps.

In the original thread, somebody mentioned a HP sdcard partition tool program, but I don't believe that will allow you to format the partition to EXT2 fs.

Procedure:

1. With the phone off, insert your newly partitioned sdcard into the g1.

2. Connect your g1 to your desktop via the usb cable and turn it on.

3. Backup your original mountd.conf and initrc.rc files from your g1 by running the following commands on your desktop from the cmd shell:

adb pull /system/etc/mountd.conf <dir on your desktop>
adb pull /system/init.rc <dir on your desktop>

4. Mount your g1's /system directory as writable via the desktop cmd shell:

adb remount

5. IMPORTANT! Create a /system/sd directory on your g1 via the desktop cmd shell:

adb shell mkdir /system/sd

adb shell ls /system and make sure that the directory has been created.

6. Download the attached modified mountd.conf and init.rc files to your PC.

7. Push the modified mountd.conf to your g1 via the desktop cmd shell:

adb push /<dir on your desktop of modified file>/mountd.conf /system/etc/mountd.conf

8. Push the modified init.rc to your g1 via the desktop cmd shell:

adb push /<dir on your desktop of modified file>/init.rc /system/init.rc

9. Reboot your g1

10. Connect to the g1 shell via the desktop cmd shell:

adb remount
adb shell

11. Check to see that the ext2 partition has been created and mounted:

busybox df -h

You should see a line that looks similar to this:

/dev/mmcblk0p2 1.2G 9.1M 1.1G 1% /system/sd

If you don't see this line, you didn't partition your sdcard correctly. STOP! Go back and do that.

12. From the G1 shell run the following cmds to copy your app and app-private directories from the internal g1 storage to the sdcard.

busybox cp -a /data/app /system/sd
rm -r /data/app
ln -s /system/sd/app /data/app

busybox cp -a /data/app-private /system/sd/app-private
rm -r /data/app-private
ln -s /system/sd/app-private /data/app-private


13. Reboot, enjoy all the extra storage!


Undo Procedure by heldc:

Dunno if this has been posted yet, but the undo process is simple. I just did it with no problems, and thought others might want it as well. (Note-if you're copy pasting this to do it, anything following # til the end of a line is just a comment, don't copy/paste it.)

adb remount #makes your file system writeable
adb push /<place you backed up mount.conf to>/filenameofbackeduporiginalmount.conf /system/etc/mountd.conf #restores the original mount.conf
adb push /<place you backed up init.rc to>/filenameofbackeduporiginalinit.rc /system/init.rc #restores the original init.rc
adb shell #opens the phone shell
rm -r /data/app #deleting the symbolic link to /system/sd
mkdir /data/app #recreating /data/app
rm -r /data/app-private #deleting the symbolic link to /system/sd
mkdir /data/app-private #recreating /data/app-private
reboot

Instructions without adb using terminal app by LucidREM

this is a form of the instructions from this thread .. but modified slightly to be used directly from the "Terminal" .. i did not use my USB on my phone to root or run apps .. everything i did was on the G1

$su
#mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
#mkdir /system/sd

6. Download the attached modified mountd.conf and init.rc files to your SD.

#busybox cp -a /sdcard/mountd.conf /system/etc/mountd.conf
#busybox cp -a /sdcard/init.rc /system/init.rc

9. Reboot your g1

$su
#mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
#busybox df -h

You should see a line that looks similar to this:
/dev/mmcblk0p2 1.2G 9.1M 1.1G 1% /system/sd

If you don't see this line, you didn't partition your sdcard correctly. STOP! Go back and do that.

12. From the G1 shell run the following cmds to copy your app and app-private directories from the internal g1 storage to the sdcard.

#busybox cp -a /data/app /system/sd
#rm -r /data/app
#ln -s /system/sd/app /data/app
#busybox cp -a /data/app-private /system/sd
#rm -r /data/app-private
#ln -s /system/sd/app-private /data/app-private

Reboot your g1

Update 1/19/2009:

Installing non-wipe custom themes shouldn't cause any issues. I just installed the BUUF theme and I didn't have to re-do the procedure.

Update 1/20/2009:

Added undo procedure by heldc

Update 1/27/2009:

Added procedure for moving data directory to the sdcard, without performance issues.

This is not stable so I've moved it to the bottom.

13. Copy /data/data directory from internal storage to sdcard. This is OPTIONAL as some people are still reporting issues.

mkdir /system/sd/data
cp -rp /data/data /system/sd
rm -r /data/data
ln -s /system/sd/data /data/data

Reversal procedure:

rm /data/data
cp -rp /system/sd/data /data

Update 2/7/2009:

Add instructions by lucidrem that doesn't require adb. Allows you to apply the hack from the g1 using terminal app
Attached Files
File Type: zip modified mountd & init.zip - [Click for QR Code] (685 Bytes, 3983 views)
 
vtecpower
Old
#2  
Junior Member
Thanks Meter 0
Posts: 16
Join Date: Jan 2009
going to try this right now..i will tell you if it works on my G1
 
vtecpower
Old
#3  
Junior Member
Thanks Meter 0
Posts: 16
Join Date: Jan 2009
i followed all the steps and i was able to boot into my phone without any problems. I was also able to install apps from market BUT when i instaled them my STORAGE LEFT went down from 54 to 51MB.
**I can see all the apps i installed in /system/sd/apps
please help,
thanks
 
Sistum Id
Old
#4  
Sistum Id's Avatar
Senior Member
Thanks Meter 21
Posts: 478
Join Date: Jan 2009
Location: Phoenix
Running apps off the SD card show any signs off slowness or laggyness?
 
Perrosky
Old
#5  
Senior Member
Thanks Meter 0
Posts: 125
Join Date: Jun 2007
Hey I would like to know what software are u using to create the partition on the sd, I tried partition magic 8 and partition mananger but the softwares can't see the sd card.
 
vtecpower
Old
#6  
Junior Member
Thanks Meter 0
Posts: 16
Join Date: Jan 2009
I use Paragon Partition Manager 9
 
dwang
Old
#7  
Senior Member - OP
Thanks Meter 169
Posts: 2,140
Join Date: Nov 2008
Quote:
Originally Posted by vtecpower View Post
i followed all the steps and i was able to boot into my phone without any problems. I was also able to install apps from market BUT when i instaled them my STORAGE LEFT went down from 54 to 51MB.
**I can see all the apps i installed in /system/sd/apps
please help,
thanks
Only the apk files are moved to the sdcard. The apps database files are still on the internal storage and all the cache files are still on the internal storage. Its still a good idea to manually move them over to the sdcard.

So as you install more apps, the internal storage will still shrink, but not as much as before and will go down slowly.

You can try to also move the /data/data directory over to the sdcard, that will move all the database files from the internal storage to the sdcard, but I haven't tried that. If you have a class 6 sdcard, try it and see if that slows things down.
 
vtecpower
Old
#8  
Junior Member
Thanks Meter 0
Posts: 16
Join Date: Jan 2009
Quote:
Originally Posted by dwang View Post
Only the apk files are moved to the sdcard. The apps database files are still on the internal storage and all the cache files are still on the internal storage. Its still a good idea to manually move them over to the sdcard.

So as you install more apps, the internal storage will still shrink, but not as much as before and will go down slowly.

You can try to also move the /data/data directory over to the sdcard, that will move all the database files from the internal storage to the sdcard, but I haven't tried that. If you have a class 6 sdcard, try it and see if that slows things down.
I have a class 5 4gb card and i want to try to move /data/data to sd
Can you please post guide how to move /data/data to sd..
thanks
 
mark925
Old
#9  
Senior Member
Thanks Meter 4
Posts: 246
Join Date: Jan 2009
Just did this and so far, so good!
 
Perrosky
Old
#10  
Senior Member
Thanks Meter 0
Posts: 125
Join Date: Jun 2007
Quote:
Originally Posted by vtecpower View Post
I use Paragon Partition Manager 9
I'm downloading the program now thanks...

Now I have to figure out how to do the partition in Ubuntu Lol

Tags
sdcard
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Speed up the ROM or Kernel Build Process

Creating a kernel, ROM, or any other development projectrequires knowledge and tools. While … more

Google Glass Now Open to Anyone… with $1500 to Spend (Update: Not Anymore)

Google Glass, which recently received its official update … more

Android 4.4.2 OTA Now Available for the Verizon Droid DNA

A couple of days ago, we talked about how the Android 4.4.2 upgrade for the HTC … more