Cache On Sd Card - G1 Android Development

After following this guide,
http://android-dls.com/wiki/index.php?title=Haykuro_Apps_to_SD#Preparing_SD_card
A friend said do this to move all your phones cace to sd card
Code:
rm -rf /data/dalvik-cache
ln -s /system/sd/dalvik-cache /data/dalvik-cache
But my question is what are the cons and pros about it?
One thing I heard is it shortens its life, but how much of it is shorten?

Code:
cp -a /data/dalvik-cache /system/sd
rm -rf /data/dalvik-cache
ln -s /system/sd/dalvik-cache /data/dalvik-cache
this is the right code I don't have any issues atm. I'm using 16gb class6 may ext2 is 500mb but my I didn't move my /data/data to sd because I noticed a little lag if I move my /data/data to sd

the new sd cards are tested for millions of write cycles. you would have to write constantly for years to reach that. you will be ok. the worst is you would have to replace your card after a few years. by then they will have 100gb micro sd cards(maybe an exageration) .

jrherras said:
Code:
cp -a /data/dalvik-cach /system/sd
rm -rf /data/dalvik-cache
ln -s /system/sd/dalvik-cache /data/dalvik-cache
this is the right code I don't have any issues atm. I'm using 16gb class6 may ext2 is 500mb but my I didn't move my /data/data to sd because I noticed a little lag if I move my /data/data to sd
Click to expand...
Click to collapse
someone said the first part is
Code:
/system/sd/
not
/system/sd
Which one is it?

tanner2007 said:
someone said the first part is
Code:
/system/sd/
not
/system/sd
Which one is it?
Click to expand...
Click to collapse
doesn't matter
system/sd
system/sd/
/system/sd
/system/sd/
they're all the same

jrherras said:
doesn't matter
system/sd
system/sd/
/system/sd
/system/sd/
they're all the same
Click to expand...
Click to collapse
Thank you, after looking at your siggy i see you have
" Cache, Dalvik-cache on SD"
there are two different caches? if so, should I move both?
I have apps on sd right now my class 6 chip, now I wanna move cache, all caches

Sorry to bump, just now I learn theres a few different caches, which are the phone ones that could help speed up the phone

jrherras said:
doesn't matter
system/sd
system/sd/
/system/sd
/system/sd/
they're all the same
Click to expand...
Click to collapse
Oh, don't agree.
For the first two be the same as last two you need to be in the '/' directory.

I don't really think a normal card can last that long. Flash devices are divided to many "pages" and you have to write one whole page each time, so we have to use file systems that take this into account (e.g. yaffs and jffs). if you don't use such file system, a page could be re-written hundreds of times just to save one file. this is made even worse, in case of inode tables, journals, and frequently used files. (this is why they use ext2 with noatime.) your card could easily die in months!!!
also, android doesn't have file system check on boot and the linux design assumes all file system are intact (that's why you're forced to do fsck on normal linux boot), so if the fs on your card is corrupted, the os will not complain and will keep messing it up!!
don't cry when you have to wipe because the phone can't access dalvik-cache and hang on boot.

Related

modified: Installing & Run application on sdcard

WARNING: Proceed at your own risk, this may damage your phone and/or make it unstable. This is for advanced users only and should only be attempted by those who understand the risks of the following changes
Original post: http://www.androidin.net/thread-1099-1-1.html
AS usual, this is for those WITH ROOT ONLY
Preparation:
1. Installed JF RC30 V1.2 (only if you are using JF RC30 1.2 , this is not compatible with RC8)
2. Make a NANDROID backup (you may get everything back to normal if the phone screw up)
3. A MICRO-SD card with 2 partitions divided : (1) a fat-32 partition, (2) a ext2, you need a linux/mac to format the sdcard with ext2 partition
* the fat 32 will be mounted as sdcard and the ext2 will be mounted as /sd for application data, make your own decision for the size*
4. insert the sdcard with 2 partition on the phone
5. set the phone to aeroplane mode for safe
Procedure:
1. adb pull /system/etc/mountd.conf /*somewhere you may want to back it up*
2. rm -f /system/etc/mountd.conf
3. using the modified mountd.conf, adb push /*the path of modified mount.conf */mount.conf /system/etc/mountd.conf
4. adb pull /system/init.rc /*somewhere you may want to back it up*
5. rm -f /system/init.rc
6. using the modified init.rc, adb push /*the path of modified init.rc*/init.rc /system/init.rc
7. reboot
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
Now, the phone will install and run everyone on /sd, still mounting /sdcard as usual. It is possible that to mount or unmount /sdcard by usb without everything screwed up. Beware that your sdcard will be used as part of system, removing the sdcard may freeze the phone. If the phone get freeze because of removing the sdcard, plug the sdcard again and soft reset.
It is also possible that copy the application data to another card. If you want to change the sdcard, switch the phone off, mounting the sdcard to computer directory, copy the /sd partition to another sdcard with ext2 partition
Back to normal:
1. rm -f /system/etc/mountd.conf
2. adb push /*the backup of mountd.conf* /system/etc/mountd.conf
3. rm -f /system/init.rc
4. adb push /*the backup of init.rc* /system/init.rc
5. busybox cp -a /sd/ /data/app
6. rm -r /sd/
Change of mountd.conf:
changing /dev/block/mmcblk0 to /dev/block/mmcblk0p1
change of init.rc:
adding
insmod /system/modules/2.6.25-01843-gfea26b0/kernel/fs/ext2/ext2.ko
mknod /dev/mmcblk0p2 b 179 2 1000
mount ext2 /dev/mmcblk0p2 /sd noatime nodiratime
Any chance of this being simplified into the actual commands necessary for this!?
I'm a semi-noob at *nix stuff... I can format my SD card into 2 partitions, but I'm lost at step 4... What do we need to edit??
Changed step 4...just adb pull the mount.conf for editing..open the file in text editor..find "mmcblk0" and change it "mmcblk0p1" ..save the .conf...del the original one..push the new one to the original directory..
Yay. Now hopefully we can get this in an update.zip to flash
Yeah, I'm putting off doing this until someone makes an update.zip which I definitely know how to apply and get rid of if I screw anything up
REPLACES the internal memory...?
So the internal memory isnt used?
kinda the same trick as the browser cache and market cache, just a bit more complex as its an entire filesystem your moving, which wouldnt let the sys see the internal, mem, please correct me if im reading it wrong, Im not a total noob at linux but no guru dev either...
bhang
The internal memory is still used, just not for /data/app
19.rm -r /data/app
20.ln -s /sd/app /data/app
Click to expand...
Click to collapse
It should probably be /sdcard/app. In any case, this is a fairly complex mod that is not suited for Linux newbies. I would advise against folks considering this mod unless they understand and can test each step before attempting.
I agree and added a warning to the first post
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Stericson said:
Ummm yea, so what happens when you mount your sdcard for storage? I expect the phone goes crazy?
This tutorial, if you could call it that,(no offense) is really badly written and this process seems too risky for what you gain considering that if we are patient google will come out with this themselves.
Stericson
Click to expand...
Click to collapse
The procedure calls for two partitions on the microsd, one FAT32, other EXT. Theoretically it should work with mounting for mass storage. However, I agree that it's a rather sloppy hack.
There is talk about a similar strategy being officially implemented by the Android team. Instead of two partitions, it would be loopback mounted to a file in the FAT32. That would also provide some encryption security. See here. It's just talk though. Won't be a reality for at least a few months.
Well talk is certainly better than nothing...thanks for the info....
Stericson
I post a method withtout compiling the ramdisk.img but that do not force mounting the sd ext2 drive under rootfs but still workable...probably when i back to work I can compile 1 to flash
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
TheDudeOfLife said:
Am I the only one that thinks there are a few things that are getting 'lost in translation' here?
I'm not getting /sd mounted properly upon reboot...there's no way I'm going to continue attempting this till I see a better (no offense) tutorial or do a little more research on the command lines.
I would really shy away from this if you're an average user or don't know what mountd and init.rc files are used for....this could flat out wreck your phone.
Click to expand...
Click to collapse
/sd is /sdcard (mount point for the micro sd card's partition)
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
pershoot said:
/sd is /sdcard (mount point for the micro sd card's partition)
Click to expand...
Click to collapse
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
IzzeLing said:
I'm getting stuck right here:
8. busybox cp -a /data/app /sd/
9. rm -r /data/app
10. ln -s /sd/app /data/app
11. reboot
It's saying read only system blah blah, even though I have indeed mounted it is rw
Click to expand...
Click to collapse
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
This line looks mangled (need flags in the args):
Edit: nevermind, looks like it should work in the init.rc
TheDudeOfLife said:
No....no it is not.
/sd is a mount of the ext2 partition used for the 'copy' of /data/app (one of the things i disagreed with is picking /sd as a mount point for the second partition.)
/sdcard is the fat32 mount point...used as usual for mounting files.
Click to expand...
Click to collapse
ahh yea. i just re-glanced over the instructions.
cool.
TheDudeOfLife said:
Type mount in adb shell and see if /sd is even mounted. I wasn't seeing it in my list. I don't think his mount command in the init.rc is correct, but I'm too busy with holiday stuff.
Don't rm -r /data/app if you have not 100% verified the copy works.
Click to expand...
Click to collapse
Yeah, don't see it. Hm.

Dalvik cache gone wrong

I was reading that you could save some space by moving your dalvik cache to your sd card, so i was trying to move it, and somehow i botched the code up.
Now when i reboot i lost my open home, and currently, have the default one, what is worse is that, all my apps are gone everything. I am still on JF 1.42 RC but i can't install nor uninstall anything, and the phone doesn't show any other programs then the default one. Terminal is not there, and i can't gain any method to it. I check my sd card and the dalvik cahce is there, i am hoping that maybe i didn't sim link it correctly? The phone still shows more or less the same space as though i have apps install however it doesn't show the app for me to access.
What can i do?
you can try:
rm /data/dalvik-cache
mkdir /data/dalvik-cache
chmod 0771 /data/dalvik-cache
from adb shell. (btw, stop if the first line returns an error)
without the dalvik-cache folder you won't be able to do anything that involves unpaking apk packages (that's basically everything you do on an android).
I strongly advice you not to put the folder on sd.
This also demonstrates the importance of a bakup before doing anything to the phone, or anything for that matter.
Can i insert the command in the terminal during home+power and alt X because i can't get my adb to work correctly?
yes, but you'll have to mount the data partition first:
mount -t yaffs2 /dev/block/mtdblock5 /data
and then:
rm /data/dalvik-cache
(you don't have to type the other 2 commands, because the system will create the directory automatically during boot)
and in this case you'll have to reboot properly: either use the reboot command or home+back
naTTan said:
Can i insert the command in the terminal during home+power and alt X because i can't get my adb to work correctly?
Click to expand...
Click to collapse
OK ignore that i have just gotten adb to work, not in fastboot thought, i think the driver is a bit messed up in that state, but it works fine if the phone is on.
Thank you bill.cn i was able to regain some function with your help however now open home is giving me repeated stop messages, how can i uninstall it using adb?
Do i just remove it from data/app?
Help again ?
naTTan said:
OK ignore that i have just gotten adb to work, not in fastboot thought, i think the driver is a bit messed up in that state, but it works fine if the phone is on.
Thank you bill.cn i was able to regain some function with your help however now open home is giving me repeated stop messages, how can i uninstall it using adb?
Do i just remove it from data/app?
Help again ?
Click to expand...
Click to collapse
Safest way would be to go to settings->applications->OpenHome and then uninstall it. Remember, android isn't expecting users to add and remove apps using the terminal so doing it the normal way is best when possible.
billc.cn said:
you can try:
rm /data/dalvik-cache
mkdir /data/dalvik-cache
chmod 0771 /data/dalvik-cache
from adb shell. (btw, stop if the first line returns an error)
without the dalvik-cache folder you won't be able to do anything that involves unpaking apk packages (that's basically everything you do on an android).
I strongly advice you not to put the folder on sd.
Click to expand...
Click to collapse
There is nothing wrong with moving dalvik to sdcard, I did it with absolutely no problems. I can do everything i could do before with dalvik to sdcard.
nattan - make sure you do a nandroid backup before doing something like this
I had the same problem... thank god for Nandroid!
Anyways, what happened is you deleted the dalvik-cache. The thing is, its not the same type of cache as your browser, where if there is no data, the browser will pull new data.
Not the case here.
To prevent that, you NEED to copy the contents, THEN symlink.
Similar to the way you did apps move. You don't rm -R them unless you have copied it first.
naTTan said:
OK ignore that i have just gotten adb to work, not in fastboot thought, i think the driver is a bit messed up in that state, but it works fine if the phone is on.
Thank you bill.cn i was able to regain some function with your help however now open home is giving me repeated stop messages, how can i uninstall it using adb?
Do i just remove it from data/app?
Help again ?
Click to expand...
Click to collapse
The safest way is to try Settings first. If it doesn't work, you can remove the apk from /data/app and the data folder in /data/data (needs root)
Ryanmo5 said:
There is nothing wrong with moving dalvik to sdcard, I did it with absolutely no problems. I can do everything i could do before with dalvik to sdcard.
nattan - make sure you do a nandroid backup before doing something like this
Click to expand...
Click to collapse
I am just worried about performance and stability problem. I think normal sdcard isn't really designed to hold a program cache.
Thanks for all your help, i couldn't at all access settings because open home was constantly giving errors. I had to ultimately remove it from /data/app and reinstall it.
I might consider moving the cache again, however not in the near future =P
Here you go:
kingblind said:
I figured out how to move the Dalvik Cache..
busybox cp -a /data/dalvik-cache /system/sd/dalvik-cache
rm -rf /data/dalvik-cache
ln -s /system/sd/dalvik-cache /data/dalvik-cache
reboot
Click to expand...
Click to collapse
Ok something is not going right here, i tried it again and sure enough the same error happens, i am sure i put the code correctly so what is wrong here?
I followed this code :
Dalvik Cache
busybox cp -a /data/dalvik-cache /sdcard/dalvik-cache
rm -rf /data/dalvik-cache
ln -s /sdcard/dalvik-cache /data/dalvik-cache
reboot
twice and the same error happens, at first i thought i botch the code up but since it happened again, i think not.
When i put in the first command, the busybox one, it gives multiple warning, can't preserve ownership or permission, is that what is wrong? If so why?
naTTan said:
Ok something is not going right here, i tried it again and sure enough the same error happens, i am sure i put the code correctly so what is wrong here?
I followed this code :
Dalvik Cache
busybox cp -a /data/dalvik-cache /sdcard/dalvik-cache
rm -rf /data/dalvik-cache
ln -s /sdcard/dalvik-cache /data/dalvik-cache
reboot
twice and the same error happens, at first i thought i botch the code up but since it happened again, i think not.
When i put in the first command, the busybox one, it gives multiple warning, can't preserve ownership or permission, is that what is wrong? If so why?
Click to expand...
Click to collapse
Try this:
su
busybox cp -a /data/dalvik-cache /sdcard/dalvik-cache
rm -rf /data/dalvik-cache
ln -s /sdcard/dalvik-cache /data/dalvik-cache
reboot
If you're doing anything that involves the root of the program, type in "su" first.
I did put su and waited for it to turn to # however the problem still persist.
For example is says
cp : cannot preserve ownership of ' /sdcard/dalvik-cache/dalvik-cache/[email protected]@[email protected] : operation not permitted.
This happens to all apps so i can't usually proceed with moving the dalvik cache.
Any idea guys?
usually that means that it requires the ext2 filesystem and you should be copying to the /system/sd directory. But if this can be done to the /sdcard fat32 filesystem then try the cp without -a
I am just guessing since I haven't tried to use the /sdcard (fat32) for anything but storage.
I thought dalvik cache can be put on the sdcard and doesn't need a ext2 partition, can someone verify this? Anyone here running it of the SDcard on a fat32 partition?
i tried cp without -a but it says, /data/dalvik-cache was ommited. can i use cp -r?
I'm no guru, just a noob that takes notes...lol. I don't know if this will help but in the 2nd line what does the f (rm -rF) do? I ask because the line I used doesn't have it and I had/have no issues with the dalvik.
busybox cp -a /data/dalvik-cache /system/sd/dalvik-cache
rm -r /data/dalvik-cache
ln -s /system/sd/dalvik-cache /data/dalvik-cache
reboot
hope this helps.
I would wager to bet that the Dalvik-Cache requires the permission model that is absent in Fat32, meaning it must be moved to the EXT2 partition, so the advice to put it onto your /sdcard/ and not /system/sd, is very bad.
my dalvik cache copies over ok- i can see it there with ls, but when i try to remove the dalvik cache it gives me a read only error- i am using 5.02Hr3? not possible to move dalvik for this version?
***edit**** apparently when if used the -rf instructions it gave me this error- just used -r and it worked great. internal storage gone from 29MB to 65!!!

paragon problem

Ok, i searched and couldn't find much about my problem with trying to partition my sd card to get ext2. when i try to partition in paragon it tells me this when i click on the sd card:
A new partition cannot be created on this hard disk. Most probably, all primary slots are occupied and there is no extended partition.
I tried reformatting the memory card to see if that would help, but it didnt change anything. So why is my sd card only allowing one primary partition? Is there any way around this problem? I tried on a 1gb card i had laying around and it will let me do it just fine, just not to my 8gb.
It doesnt work with Windows 7 either. And i tried compatibility modes.
You have to go into the advance mode. which is on the bottom of the main blue screen when you open it up. Then you have to delete the partition on your card. After that hit Apply(the green checkmark at top). right click on your sd where its says unallocated space and create the fat32 partition to the size you want and then use the rest of the space to create the ext2 partition no bigger than 2gb. When you have the two partitions hit apply and follow the directions it gives you. It mostly runs on its own at that point but you will need to restart the computer when it asks you to. make sure you do this through an adapter and not usb because it will show an error message after restart.
OK i deleted the partition but it only gives me the option to test the surface or something like that, i've tried the apply button twice now, and it just takes a few seconds and says its done, it says its unallocated now but when i explroe it in paragon i can see all my files still but it doesnt show on the computer anymore. it still has the same name and everything in paragon, but i still can't format it or create a partition, so right now i can't do anything else with it in paragon. in disk management i can see its there though and format it so i tried creating a simple volume on it leaving 100mb open for ext2 but after i do that i can't do anything else with the unallocated space in disk management and paragon still only sees the fat32 part of it, so i deleted the whole partition again and just did fat32. is my sd card just pure **** or what?
DO this
I had the same problem till today until i first formatted sd to single partition ie. fat 32 and then used my phone to partition it using the following steps-
You will need to download the attached file
and dump mke2fs and sdsplit or http://www.mediafire.com/?d9ceg9sbi2g files on your sdcard
There should not be any data except the files you downloaded.
BEFORE WE BEGIN, THIS WILL ERASE YOUR SDCARD, BACKUP BEFORE YOU START!
Step 1 - We're going to Partition your sdcard
open terminal emulator
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# busybox cp -a /sdcard/mke2fs /system/
# busybox cp -a /sdcard/sdsplit /system/
# cd system
# chmod 777 mke2fs
# chmod 777 sdsplit
******************************************
This is important! What size is your sdcard? If it's a 1gb and you want to share 50-50 then move to the next step and use 500m otherwise you have some very simple maths to do. 1gb is 1000mb (not actually but for simplicity...) if your card is 4gb and you want 500mb app space you need to specify 3500m. if it's 8gb and you want 1gb you would specify 7000m take the size you want for apps away from the size of your sdcard, add an m to the end and that is your magic number.
*******************************************
# sh sdsplit -fs MAGICNUMBER --pmke2fs /system/mke2fs
DOnt forget to put m after magic number like write 7000m instead of 7000
If all goes well you now have 2 partitions to your sdcard: you should get a message like this
Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 1 62 7277445+ b Win95 FAT32
/dev/block/mmcblk0p2 63 968 497983 83 Linux
If you have, congrats. my next post in this thread will explain how to move your application, but pat yourself on the back, the hardest bit has been done!!!!!!
If any error come on copying data back to sd like can't mount sd dont worry.
It should be good till creating ext2 partition.
If not please follow go back to the beginning and follow these steps exactly.
Step 2 Mounting you're new linux partition.
Ok dump init.rc and mountd.conf on your sdcard (the windows portion - which is the only part that will appear) I highly recommend at this point you copy a update.zip onto your card just incase everything goes horribly wrong
Open Terminal emulator
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# mkdir /system/sd
# busybox cp -a /sdcard/mountd.conf /system/etc/mountd.conf
# busybox cp -a /sdcard/init.rc /system/init.rc
# reboot
I recommend a nandroid a before partition and wipe after partition.
Now everythings done. Download APPS to sd apps and move your apps.
COngrats.
.There may be other methods but others didn't work for me but this one did.
I also had the same problem exact same. I f****ed my sd with paragon and this saved me.
ok so after windows still wouldnt see the sd card in my computer, i checked it again and even though i assigned it a drive letter it didnt show up so i assigned it one again. so then the computer seen it so i decided to play with paragon again. this time though it let me partition it, idk why it was so goofy before but i got it setup now. i wanted to give 100mb to ext2 but since i have to use the slider i could only give 77 or 155, 77 a little low and 155 to high since the cards about filled as it is, so ill see how 77mb works. thanks for the help
do as said
Make it atleast 500 mb Will work better with it or u have to repartition it.

Haykuro 6.0r1 Apps + Cache on SD Tutorial

Hey, I haven't seen this posted on this forums.
I had spent 5+ hours scouring, frustrated for a solution to get back all of my apps on my SD card. I had updated from JF's ADP build to Haykuro's 6.0. Lost every single app link. Tried everything, and could not get ADB to work with my phone. So, I finally figured it out.
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!
Thanks for this mah dude!... nuff props for contributing to the society
Hey, there's actually a wiki page on this:
http://android-dls.com/wiki/index.php?title=Haykuro_Apps_to_SD
It doesn't cover moving dalvik-cache though, but it's the same steps.
Moving /data/data to the SD card is highly unadvised. This location has information constantly written to it... the space isn't worth the speed loss, plus the constant writing will shorten the life of your SD card.
i think that with that price of 8gig sd card there is not so important to care about the life b'cause to make backup of sd is for me one from first procedures before new flash (if changing from haykuro to dude or jf for example)... so when it will go for paradise... there's no problem to buy a new one and maybe bigger... anyway, u can in time use different space from the sd for a ext just start the partition in other place of memory

How to swap SD cards w/ Apps2SD

All props go to Jonnythan who gave the steps in another post. Mods may want to sticky this....
1. As always: Nandroid backup
2. reboot phone
3. adb shell into the phone
4. mkdir /sdcard/backup/
mkdir /sdcard/backup/app
mkdir /sdcard/backup/app-private
cp -r /data/app/* /sdcard/backup/app/
cp -r /data/app-private/* /sdcard/backup/app-private/
5. copy sd card to pc
6. Shut off phone and remove old sdcard and insert new sdcard
7. Start in recovery mode and partition new sdcard (fat32, ext2, swap)
8. Enable usb mode, copy data from old sdcard to newly partitioned sdcard
9. reboot and ignore force closings
10. Plug in USB and enable USB mode
From PC ADB shell into phone and type the following (enter after each line):
rm -r /data/app/*
rm -r /data/app-private/*
[chances are those directories are empty already, but you never know]
cp -r /sdcard/backup/app/* /data/app/
cp -r /sdcard/backup/app-private/* /data/app-private
reboot recovery
11. Restore most recent nandroid
12. reboot and enjoy
All thanks again to Jonnythan
Tweaks:
Between 5 and 6, shut off phone. Then start step 7 by specifying to start into recovery mode to partition the card. Then specify that you need to plug in the usb and adb shell for step 10. End step 10 by typing in "reboot recovery" which will reboot you right into the recovery partition.
Thanks for writing it up! Now I don't have to
Ok, I must be doing something wrong here... Does this require a custom ROM or anything? Im on the sprint Hero, stock ROM and I do have root. Everytime I get to step 4, at the cp -r /data/app/* /sdcard/backup/app/ command i get an error. It cant find the directory. Also, if i check the folder properties through Astro or linda file manager, it says 0 files, 0 folders, and also shows that it is not taking up any space. Just as a test to see if I was somehow blocked, I made a nandroid backup and deleted the /data folder, and upon reboot nothing had changed. Still have all of my apps on the phone...
I think the stock ROM doesn't include the cp command.
jonnythan said:
I think the stock ROM doesn't include the cp command.
Click to expand...
Click to collapse
Wait, when i get my sd card I have to do all this? I can't just reformat using the utility and drag and drop everything back into the sd card?
runsoverfrogs said:
Wait, when i get my sd card I have to do all this? I can't just reformat using the utility and drag and drop everything back into the sd card?
Click to expand...
Click to collapse
Not if you're using AppsToSD.
If you're not using A2SD then just make a backup of the old card, unmount it, put the new one in, and copy everything back. If you are using A2SD, the process is more complex.
Cp = Copy. Works on any rom. Like he said since you're on the stock rom, I doubt you're using Apps2SD so no you don't have to do all this.
If only people would actually read the thread title....
"How to swap SD cards w/ Apps2SD."
Don't have Apps2SD? Then this isn't the thread for you.
Exactly what I was thinking.
jonnythan said:
If only people would actually read the thread title....
"How to swap SD cards w/ Apps2SD."
Don't have Apps2SD? Then this isn't the thread for you.
Click to expand...
Click to collapse
I'm using the modaco 1.1, i should've mentioned that. Doesnt that come with Apps2SD built in?
Only if you partitioned your sd card before you flashed.
After step 6, how do you boot into recovery mode to partition the new card if you dont have the recovery image on the new card? Did I miss a step where I added the recovery image to the new card?
chalan30 said:
After step 6, how do you boot into recovery mode to partition the new card if you dont have the recovery image on the new card? Did I miss a step where I added the recovery image to the new card?
Click to expand...
Click to collapse
The recovery partition is installed on the phone itself, not the card.
thanks I dont know why the first time I tried i didn't get back into the recovery screen but the second time I booted into it just fine... oh well thanks for all your hard work!!!
Partitioning links
To partition the new card, you might want to include links to sdparted and this page for people who want to do it manually.
I have a question about how to make the swap. I have moved /data/dalvik-cache/ to my sd card and freed up about 25 meg of space on internal memory. Is there anything I need to do in addition to your instructions or would it be better to just do a wipe and start from scratch. I am using MoCaDo 1.2 Rom using apps2sd and ext3 partition. I have a 16 gig card coming. By moving the cache I now have 143 meg of internal memory with about 65 apps installed counting some of the stock apps. I have removed several of those as well. 34 apps from the market or handmark.
esoteric1311 said:
All props go to Jonnythan who gave the steps in another post. Mods may want to sticky this....
1. As always: Nandroid backup
2. reboot phone
3. adb shell into the phone
4. mkdir /sdcard/backup/
mkdir /sdcard/backup/app
mkdir /sdcard/backup/app-private
cp -r /data/app/* /sdcard/backup/app/
cp -r /data/app-private/* /sdcard/backup/app-private/
5. copy sd card to pc
6. Shut off phone and remove old sdcard and insert new sdcard
7. Start in recovery mode and partition new sdcard (fat32, ext2, swap)
8. Enable usb mode, copy data from old sdcard to newly partitioned sdcard
9. reboot and ignore force closings
10. Plug in USB and enable USB mode
From PC ADB shell into phone and type the following (enter after each line):
rm -r /data/app/*
rm -r /data/app-private/*
[chances are those directories are empty already, but you never know]
cp -r /sdcard/backup/app/* /data/app/
cp -r /sdcard/backup/app-private/* /data/app-private
reboot recovery
11. Restore most recent nandroid
12. reboot and enjoy
All thanks again to Jonnythan
Click to expand...
Click to collapse
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
jmanley69 said:
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
Click to expand...
Click to collapse
Now I'm confused don't take much.
I tried reading the ext2 partition using ubuntu and loading it temp on my windows 7 PC. It would not let me open that partition so I could not copy anything to it.
I guess the easiest way is to just wipe the phone back to factory, booting to recovery with the new card in and create the fat32-ext2-swap partition, re-flash the MoDaCo or any Rom that uses Apps2Sd and install all my apps again. I am assuming this would work as well.
jmanley69 said:
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
Click to expand...
Click to collapse
Well, for one thing your method requires a linux machine
But what would you even have symlinks on the SD card for? Symlinks, uids, and attributes on SD card files simply aren't an issue at all for most people.
And truthfully if you are already doing that kind of stuff, you don't need this guide.
jonnythan said:
Well, for one thing your method requires a linux machine
But what would you even have symlinks on the SD card for? Symlinks, uids, and attributes on SD card files simply aren't an issue at all for most people.
And truthfully if you are already doing that kind of stuff, you don't need this guide.
Click to expand...
Click to collapse
As far as Linux... get VMWare player for free and download ubuntu and you're set real fast. Also if you notice what I said about doing a tar instead id using Linux.
As far as symlinks. You're right there "shouldn't" be any... but if you're backing up something why not do it right just in case? We have no idea what future versions of apps2ad sill do. It may happen that a file MUST reside on internal memory and therefore you'd need a symlink.
As far as the rest...
Actualy... each app gets its own user id and mismatches in those can cause problems with some apps. And each file in Linux gets attributes to tell the OS who is allowed ti read/write/execute it. If those get messed up it can cause problems.
So... we have a responsibility aa educators to give the best instructions possible. And not give instructions that ultimately would result in a backup that is missing vital information and would lead to a complete reload to fix the problems.
There are many reasons why Google decided to restrict apps to internal memory and we will never know all of them... this may very well be one of the problems they saw happening.

Categories

Resources