- Explanation of the terms: App2SD / Move2SD, A2SD, A2SD+, changing partition sizes.
- Why even if you use App2SD / Move2SD / A2SD you still can get into troubles with little space left: android system has 3 different places where it saves data of an installed app.
- How to check how much space is used / free.
- A A2SD vs. App2SD/MOVE2SD
- B changing partition sizes (to get more space from unused space in system and cache)
- C A2SD+ - moving data or dalvik-cache to sd card
Explanation of the terms (you might also want to read the glossary):
- App2SD / Move2SD - feature officially included in Android 2.2 (Froyo) (no root necessary), some apps can be partially moved to SD card, i.e. *.apks are moved to /sdcard/.android-secure (on fat32 partition). Can be done using android settings - apps - ... - move to SD card or using the app "Apps 2 SD". Normally only works with apps supporting the feature and needs to be done manually, but with the app "Move2SD Enabler" (root only) it's possible for all apps and automatically. Has the disadvantage that moved apps won't work if SD card is mounted to the PC connecting the phone by USB or if the SD card is removed.
- A2SD - feature included in most of the new Custom ROMs (see comparison table). Moves *.apks to SD card similar to App2SD, but works automatically and apps even work if the SD card is mounted to the PC connecting the phone by USB (and many apps even work if the sd card is temporally removed after boot). Moves the apks to the ext2 partition of the sd card instead to the fat32 partition as App2SD does. Therefore partitioning of the SD card is needed, it can be done using Clockworkmod or with partitioning software.
- A2SD+ - feature so far included in MoDaCo Custom Froyo and can be installed manually if A2SD is working already and if you have root access. Does not only move the *.apks to ext2 on SD card, but also the dalvik-cache or data folder, depending on what you decide to move. Is supposed to possibly slow down apps or system, but there are not enough experiences yet to clearly state the extent of that. Notably increases read/write to SD card so potentially reduces card life (as system and apps are accessing SD card for dalvik-cache while starting and accessing the data folder while running).
- changing partition sizes - feature included in some Custom ROMs using the TPT install method (e.g. Japanese Jellyfish RLS9), but is also able to be done with every other ROM, including Stock ROMs, no root necessary. Will change the size of the internal ROM /system and /cache partitions, removing unused (and unnecessary) free space from them to give the /data partition more free space. You can get up to 330 MB space for your /data partition!
However, even if you use App2SD / Move2SD / A2SD you can still get into troubles with little space left.
This is because of android's design, if you install an app, it will create stuff in these folders:
-> original .apk file; this is used by the dalvik machine to create executable and is used by paket manager to restore default data (if you go to Settings - Apps - manage apps - (select an app) - delete data + cache
-> if you use A2SD, this folder will be on your sd card (mounted to /system/sd, with symlink to /data/app)
-> if you use App2SD, then some of the apps in this folder are moved to /sdcard/.android-secure (only the ones that enabled the Move2SD function and only the ones you manually move using settings - apps or "Apps 2 SD" app)
-> this is the dalvik-executable file of the app - compiled for YOUR android phone. the app won't be executable without this, but you can delete it and it will be restored after next reboot. for compiling it uses the classes.dex inside the XYZ-1.apk zip archive (see 1.)
-> this is the data folder of your app. it will be created on install (from the content in the .apk's res, lib and assets folders) and be changed by your app. If you choose "delete data" in the settings - apps menu, this folder will be reseted to the default data, using the .apk file located in (1.)
-> so it's save to delete the contents of this folder, but it will be restored on next start of the app
even if you use A2SD (/data/app located on ext2 partition on the sd card) or Apps2SD (.apk files are stored on /sdcard/.android-secure and mounted to /mnt/asec ), you still will have the same space or even a bit more in the /data/dalvik-cache and the /data/data/ folders.
You can solve that problem by following the sections B and C in this guide (changing the partition sizes in order to get more free space, section B and moving data or dalvik-cache to sd card, section C).
Do you want to check how much space is used / free?
You can go to android settings - sd card. There you can see the free space of /data and /mnt/sdcard.
However these two are not all partitions used. To check the space of the other partitions, you have 2 options:
- (root needed) Use the app Rootexplorer or ES File Explorer and browse to the different places (/system, /cache, /data, /mnt/sdcard, /system/sd) to check the free space. Or use adb / terminal to browse to them (commands cd and ls) and check used space with command "du -sk".
- Alternatively (also without root possible) do this to have a look on the free space of the different partitions:
open terminal or adb shell and type "busybox df -h". If there are too many lines, type: "busybox df -h | head". If you don't have busybox installed, just type: "df".
/data is the data partition on the internal flash memory, /system/sd is the ext2 partition on the sd card and /mnt/sdcard is the sdcard.
In android settings - sd card you can only see the free space of /data and /mnt/sdcard, however /system/sd won't appear there.
A A2SD vs. App2SD/MOVE2SD:
(root needed or a Custom ROM with A2SD support)
If you want to use A2SD, check if your ROM supports it (in the ROM comparison table there is a column for it). A2SD is also possible if your ROM doesn't support it, however it will be more difficult.
To install A2SD you need to partition your SD card. To do this:
1. Backup the content of your SD card to your PC (using your PC file manager while usb connected to PC)
2. partition your SD card using clockworkmod recovery (on boot press Volume Down + Power Button, then in clockworkmod menu choose partition sd card - choose ext2 or ext3 (I recommend ext2, here is some discussion on ext2 vs. ext3) - then choose size of ext2: I recommend between 512 MB and 1024 MB - choose size of swap: 0MB, as swap isn't needed)
Caution! You should use Clockworkmod 126.96.36.199 or higher, as the previous versions didn't partition correctly.
3. if necessary: copy your backup back to your sd card
- your ROM should support A2SD
- you have to install it manually.
( For that you would need an init.d boot script that (a.) mounts the ext2 partition on your sd card to /system/sd and (b.) moves your /data/app folder to /system/sd, creating a symlink (symbolic link) from /data/app to /system/sd/app.
Where to get that boot script? - Perhaps someone has a link. If it's needed, we can upload such a script taken from a custom ROM. )
You can see if A2SD is working if you browse to /system/sd folder with an Root Explorer, as described above or if you execute the "df" command. If there is something inside /system/sd (some apps in the dir "app" resp. some space used as you can see with "df"), then A2SD is working.
A note to A2SD vs. Apps2SD: Using Apps2SD you will get problems when the SD card is not mounted. Using A2SD (ext2 partition on sd card), you can even connect your phone to the PC using USB and dismount the SD card on the phone to mount it on the PC - the ext2 A2SD partition will still work. But if you use Apps2SD (/sdcard/.android-secure folder), then something won't work if you unmount the sd card.
Also important: if you use A2SD, then you shouldn't use the Move2SD function from the android 2.2 system or the Apps 2 SD app that is a frontend of this. Explanation: if you have A2SD then all your apps will be installed to /system/sd automatically, i.e. to the sd card. However they appear to be "on the phone" if you use the Apps 2 SD app or have a look in settings - apps. If you move them to the sd card, then they will be moved to the /sdcard/.android-secure dir, i.e. from SD card to SD card. So that`s kind of useless and they won't work if SD card is mounted to PC while phone connected by USB.
A general note on the question whether to use the App2SD / A2SD feature:
As the .apk files (in 1.) are supposed to be accessed only when installing the app, re-creating the dalvik cache file or deleting the data of the app (reseting it to default data), there generally is no performance issue using A2SD. I therefore highly recommend it.
B changing partition sizes (to get more space from unused space in system and cache):
(no root required; works with ALL ROMs)
Recommended! Especially if A2SD isn't enough for you...
Perhaps you can get more space from unused spare space in the /system and /cache partition. Example:
/system 210 MB - 125 MB used - 85 MB free (=wasted!)
/cache 40 MB - 2 MB used - 38 MB free (=wasted!)
/data 210 MB - 200 MB used - 10 MB free (problem with space, warning that no space left!)
/system 128 MB - 125 MB used - 3 MB free
/cache 4.5 MB - 2 MB used - 2.5 MB free
/data 330 MB - 200 MB used - 130 MB free ( :-) )
How to change your partition layout:
(no root required; works with ALL ROMs)
1. create an nandroid backup, either
* using clockwork recovery, pressing Volume Down while pressing power on button on startup)
* or using ZTE-Blade Recovery Manager or some other nandroid backup tool.
2. download the partition layout suitable for your /system size ([Custom] ROM size), e.g.:
* 128 MB system, 4.5MB cache, 324MB data: shrink_cache_sane.zip by wbaw
(MD5 sum: 5eb8c0f5bba4e02fe30b86a96eb64ef8)
* 136 MB system, 1.5MB cache, 319MB data: partition_1_136_319.zip]/url] by wbaw
(MD5 sum: 8c1f3c28c317a435321e31cb31477e28)
Caution! Not all ROMs will work with a 128 MB system partition. If your ROM is bigger, you must install a bigger partition layout. Or you can uninstall apps from the /system/app folder that you don't need or reinstall them in /data/app. How to do this? 1.) Download the App "Uninstaller for Root" from the market, 2.) Backup the /system/app/XYZ.apk of the App to your sdcard (using "Uninstaller for Root" or manually). 3.) Install the XYZ.apk from your sdcard (in the folder 'RootUninstaller') using a File manager. For example, Google maps (Maps.apk) is around 5 MB.
* other layouts you can get from the thread Partition layout change or Partition Mod for Japanese Jellyfish RLS9 (you just need the 2 files appsboot.mbn and partition_zte.mbn from the archives)
* Caution! the 2 files 'appsboot.mbn' and 'partition_zte.mbn' really shouldn't be corrupted because that potentially could permanently damage (brick) the phone. Therefore you should always check MD5 checksums, e.g. using md5sum tool for windows.
3. create a new dir on your SD card, 'image'. low case.
copy the content of shrink_cache_sane.zip in this folder (appsboot.mbn and partition_zte.mbn). Then copy the bin files from your nandroid backup to this folder, boot.img, recovery.img, system.img, data.img.
Then rename data.img to userdata.img
4. You also need the files 'appsboothd.mbn' and 'partition.mbn'. You can get them from a TPT (Total Phone Transfer) Image Zip-File, e.g. from Japanese Jellyfish RLS9 (download the Japanese_Jellyfish_RLS9_image.zip).
5. Now you should have a directory "image" on your sd card, containing these files:
6. ensure your battery is not empty, then turn on your phone with volume up button pressed. some green text will appear ("Update from T-Card" or something like this). If it doesn't work, try pressing volume up and menu button.
7. wait for the process to complete (2mins max.)
8. Now you should have partition sizes changed and about 100MB more free space left
9. After loading the new firmware, it makes sense to rename the /image folder, such as to /flashedimage, so that it cannot be accidentally reflashed again in the future.
"How do I undo this?"
-> have a look in the standard solutions thread at the very bottom ("I have changed my partition sizes to have a 128MB system, I want to change it back"). Using this partition layout you can switch back to the standard partition layout:
No ROM, Just 2 Clockwork partitions, sets all partitions back to stock, you will need to use the Mounts/USB Mount in clockwork to put a ROM back on
(MD5: C8010D841AF463F3CB1FDEDFFAFA3B1E )
Note: the /cache partition is only needed for downloads from the market. If you want to download an app bigger than 4.5 MB, you will have to move the /cache directory to /data.
For this you can use the following cache redirect script:
The install procedure is slightly different depending on which ROM you use.
- If you use FLB-Froyo or any other ROM that loads userscripts from /etc/init.d/ then create the file:
/etc/init.d/80redirectcache with the following code:
#!/system/bin/sh # # #### START - Redirect cache partition to /data #### mkdir /data/cache chown system.cache /data/cache chmod 770 /data/cache mkdir /data/cache/recovery chown system.cache /data/cache/recovery chmod 770 /data/cache/recovery mkdir /data/cache/lost+found chown root.root /data/cache/lost+found chmod 770 /data/cache/lost+found umount /cache rmdir /cache ln -s /data/cache /cache #### END - Redirect cache partition to /data ####After creating the file (using adb push or Rootexplorer), make sure to get the script file executable - open terminal and execute these commands:
chown root.shell /etc/init.d/80redirectcache
chmod 755 /etc/init.d/80redirectcache
- If you use Japanese Jellyfish or any other ROM that loads userscripts from /system/bin/userinit.sh then you have to insert the above code in that file (only the code starting with "#### START - Redirect cache").
Insert it at the end of the file but before the following line:
"/system/bin/setprop userinit.filesystem.ready 1" (if existing).
- You can also add the code to /system/etc/init.qcom.post_boot.sh it should work with most roms using that file.
- Alternatively you can redirect the cache to RAM. This possibly speeds up market installs a little bit. Instructions here.
C A2SD+ - moving data or dalvik-cache to sd card:
(root needed or a custom ROM with A2SD+ support)
Only recommended if you dont't have enough space after finishing steps A (A2SD) and B (changing partition sizes)
The last possibility is to move either /dalvik-cache or the /data/data dir to your sd card. Be careful! I don't recommend that in general because your system possibly will be slower because the SD card is supposed to be much slower than the ROM drive.
The dalvik cache will be accessed every time an app starts, it will transfer the compiled files from the cache to the memory. So the start of an app will be slower perhaps but then it's okay (however as we know, android often terminates or pauses apps in background and they are "silently restartet" if you switch to them again, so also this will be slower).
The /data/data/ dir will be accessed by the apps, e.g. browser cache. So it depends on the app if it will be slower because of the moved folder.
How to move the data folder or dalvik-cache:
Sometimes this is also described by the term "A2SD+". Some Custom ROMs support it (e.g. MoDaCo Custom Froyo, according to the comparison table). So if you use MoDaCo Custom Froyo and have A2SD enabled (by having created the ext2 partition on the sd card as explained in section A), then also the dalvik-cache will be moved to the sd card.
However you also can do it by yourself if you already have A2SD enabled (this is necessary, as well as root access).
start the terminal and type (without |):
in order to move /data/data:
| cp -pr /data/data /system/sd
| rm -r /data/data
| ln -s /system/sd/data /data/data
Be careful! you will loose all your application data if this fails. however usually the default data can be restored by android using the .apk file. I recommend creating a [url="http://market.android.com/details?id=com.keramidas.TitaniumBackup"]Titanium Backup before doing this (as well as an nandroid backup).
and in order to move dalvik-cache:
| cp -pr /data/dalvik-cache /system/sd
| rm -r /data/dalvik-cache
| ln -s /system/sd/dalvik-cache /data/dalvik-cache
If the dalvik-cache should get lost, it's not such a problem because it will be easily recreated on reboot (taking some minutes the first time). However, the dir /data/dalvik-cache should exist and be accessible for the system (or the according symlinked dir).
Caution! If you do this, most of the apps or even the whole system won't work if the whole SD card is ejected / unmounted!
Edited by ztedd, 17 February 2011 - 12:14 AM.