A2SD Explained
MIUI-Au is built around A2SD+ and you Should have an ext3 partiton on your SD Card before installing MIUI-Au.
  
MIUI China, and many other ROM chefs, use Darktremor A2SD (we’ll call it DT-A2SD).  DT is stable, reliable and very full featured with a command line interface that can be used to change many settings.  In early 2011 DT stopped moving the Dalvik cache to the SD Card automatically and it had to be done using the command line interface (a2sd cachesd command).  We at MIU-Au were not happy with this and some other aspects of DT so we built our own A2SD, which we call PC-A2SD.  Features of PC-A2SD are: Invisible, automatic, no command line interface and nothing for the user to do.  Automatically puts Dalvik cache on SD Card.  Automatically handles slow to mount SD Cards and will also allow the ROM to run without an SD card.  In real world use we believe it is no slower than DT, and provides 40Mb – 80Mb more internal phone storage by moving the Dalvik cache out of the phone and onto the SD Card.
 
If you are using MIUI-Au and have your SD card partitioned correctly with an ext3 partition, A2SD+ is Invisible and Automatic.  You do not have to do anything to make it work.
 
Check using Settings > Programs > Manage Applications > On Sd Card and if you find any apps here MOVE them back to the Phone

In fact you MUST ensure that all your apps are in the phone (where they are automatically located into the ext3 partition) and NOT in the SD card.

How big should the ext3 partion be?
Most
people use 512Mb and that’s usually more than enough.  If you have a 16Gb (or larger) SD Card and you anticipating downloading a horde of apps, then you might want to try 1Gb.  If you are using the experimental DATA2WHATEVER version you might want to try 2G.  Anything larger than 2Gb and you need to get a laptop and not a phone.  If you go over 2Gb you may experience SD Card corruption and the Market will not operate properly!
 

My phone is still giving me low memory warnings – Help!!

There are two possible reasons:
1. If you are using DT-A2SD and haven’t moved the Dalvik to the SD Card it can be taking up a lot of room in the phone.
2. All apps, even when they are on the SD Card due to A2SD still have some component in the phone and eventually the phone memory will become low. Test this by getting Cache Cleaner NG from the market and use it to clear the cache and see if the low memorty warnings stop. If you can’t install Cache Cleaner because memory is too low, boot into recovery, clear the Cache (but NOT the Dalvik cache and then reboot). Then try installing Cache Cleaner NG
The following explanation is mostly condensed from neoKushan’s excellent article available here.
  
Phone Memory
The SD card in your phone is a bit like normal PC Hard Drives, you can “partition” them (split them into two or more sections of different filesystems).
Normally, your SD card is just one big FAT32 partition, which is fine for storing your pics, messages, emails, etc.

Your phone will have its own internal flash memory (or “NAND“) storage.  
Traditionally with Android, you could only install applications to this NAND storage, you could not install them onto your SD card.

Froyo A2SD (or FA2SD)
In Froyo (Android 2.2) Google came up with a way to install apps to the SD card.  
A folder named .android_secure is created on the SD Card and this stores versions of applications, but there’s a few catches:

  1. Apps aren’t automatically stored here, you have to manually “move” them
  2. Not all apps are capable of being moved, in fact at this stage most apps aren’t, the developer needs to update their app and allow it.
    Some apps aren’t and won’t be updated and some developers may not want to allow it for whatever reason.
  3. Not all app data is moved, most of it is but some data is left on your phone so many people still run out of internal storage quickly.
  4. You can force ALL apps to be moved to this area by default, but it breaks incompatible ones.
  5. The SD Card Fat32 partition is not “mounted” (more about mounting later) until after the phone boots up.  Widgets load during boot, so if the app behind the Widget is on the SD Card the Widget won’t work.
  6. When the SD Card in your phone is accessed as a disk drive (using the USB cable) it must be “unmounted”.  When it is unmounted, the phone cannot see it or any apps on it.

Non-Froyo A2SD (or A2SD)
Before Froyo existed, some very clever people at CyanogenMod came up with a thing called “Apps2SD”, now referred to here as A2SD.
A2SD works by having your SD card partitioned into TWO filesystems: The normal FAT32 partition for your usual stuff and a secondary “ext” partition.  ext is just a filesystem, like FAT32 or NTFS, but it’s the filesystem used by Linux and is the filesystem used internally in the Android operating system.
ext has several different versions and the most common one you’ll see is ext3. The main difference between ext2 and ext3 is “journaling”, which is just a fancy way of saying that should an operation (such as copying, writing or reading) be interrupted unexpectedly (say, by you turning your phone off), then no data should be lost or corrupted.   FAT is not a journaling filesystem, which is one of the main reasons Microsoft moved to a journaling filesystem (NTFS) for Windows NT/2000/XP/Vista/Win7.  ext4 is an update of ext3 but is not as common and offers no advantage in the Android operating system.

The original A2SD ”symbolically linked” the folder from the phone’s internal storage where apps are normally stored, to the ext3 partition on the SD card.  A symbolic link is a bit like a shortcut for folders, except it’s transparent to the operating system.   In other words, Android doesn’t know that when it’s installing it’s apps to the internal phone storage, it’s actually being stored in the ext3 partition on the SD card.  Current A2SD is integrated directly into the framework, rather than using the symbolic linking described above.  A2SD effectively boosts your internal phone memory by whatever size you made the ext3 partition on your SD card (usually 512Mb).
Plus, because ext3 is a native Linux filesystem, it doesn’t need to be “mounted”, meaning it’s ready to go as soon as the phone starts – so your widgets and apps work immediately (unlike Froyo A2SD, where widgets disappear because the apps stored on the SD card can’t be located until the card is mounted after the phone finishes booting up).

There are, however, two downsides with A2SD:

  1. Whatever space the ext3 partition takes up is taken away from the user accessible space on the SD card.  So if you have a 2Gb card (with something like 1.7Gb of user accessible storage) and you make a 512Mb ext3 partition, the space available for storing emails, music, videos etc on your SD card will “shrink” to 1.2Gb. 
  2. The phone is now forced to access the SD Card continually to retrieve apps and data from the ext3 partition.  This is made worse if you implement A2SD+ (discussed later) which also moves the phones internal cache onto the ext3 partition.  This continually “thrashing” between the ext3 and fat32 partitions results in a substantial decrease in read/write speeds to the fat32 partition.  This will be observed as a slowdown when recording and playing back video for example. 

Finally, there’s a difference between A2SD and A2SD+.    There’s an area in read/write NAND memory which is called the Dalvik cache.   It’s used by the Java runtime to cache the file/framework structure your phone uses to run apps.   A2SD+ moves the Dalvik cache (which is 40Mb+)  to the ext3 partition on your SD card as well, freeing up even more internal phone memory.  Some people believe that this may come at the cost of performance, as Dalvik cache should be in the fastest possible memory and this may be the phones internal NAND memory.  Expect to see some further changes on the way the Dalvik cache is handles in future A2SD releases.

Finally, any recent version of A2SD/A2SD+ should work with an SD card that is or isn’t formatted with an ext3 partition.  It’ll check for this partition when your phone first boots and if it’s not there, just use internal phone storage.

Having an ext3 partition WITHOUT A2SD/A2SD+ shouldn’t cause any issues, either, so you can format your SD card whenever you’re ready.

A2SD summary
A2SD “fakes” your phone’s internal memory and puts most of it a hidden section of your SD card.
A2SD+ pushes even more content (the Dalvik cache) to the SD card, freeing up even more space on the phone itself.
“Froyo” A2SD (FA2SD) has various limitations that “old” A2SD does not, but is much easier to handle as it doesn’t involve any kind of “partitioning”.  It also has positive as it doesn’t cause any slowdown in SD card access speed.
MIUI-Au ROMS are only available with A2SD+ so you MUST have an ext3 partition on your SD CArd

To check how much of your ext3 partition is used up, get Quick System Info from the Market
QSI will show the System Storage as something like 250MB, Free 29MB.  This is the NAND storage used by the kernel and Android itself, plus themes etc.
QSI will show Internal storage as something like 148MB, Free: 109MB.  Even with A2SD+, some apps still store some data to /data on the internal NAND storage. This cannot be tricked in to being moved to SD card, and Web browsers are common culprits.  So if you are still getting low memory with A2SD+ this is the reason.

6 Comments Posted by

6 Comments

  1. Whats the deal if we do have a Ext4? not answered above and the link is bogus.

  2. What if I have an EXT4 partition, immediately detected in the MIUI_XJ_D2EXT_X-PART ROM from http://www.miau.com . Could’nt this be automatically implemented???

    Thank you

  3. Fernando Ruelas

    Best explanation ever, this will help lots of people trying to understand the real purpose of moving apps to the sd card and how it hits the performance on you phone.

    Many thanks bro

  4. excellent explanation of how everything works. Thank you so very much for clearing up some questions I had.
    I don’t suppose having SD booster installed would have any negative outcomes whilst partitioning my SD card, would it?I’m going to uninstall it just to be sure.

    thx again

  5. HELP!!
    I installed the newest miui and i didnt want to run app2sd i like to run data2sd but some how it have app2sd and i lost 0.94 mb help!

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>