Android Bytes

…everything is a bytearray after all

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” 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+ 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.

Dalvik Cache
This is the simple explanation.. The long one is a little bit complicated. So, when Android starts up, the DalvikVM looks throught all of your applications (.apk files) and frameworks, and builds a tree of dependencies. It uses this dependency tree to optimize the bytecode for every application and stores it in the Dalvik Cache. The applications are then run using the optimized bytecode. This is why when you install a new ROM, sometimes it takes a very long time to boot for the first time. Any time an application (or framework library) changes, it’s reoptimized and the cache is updated.

Data2Ext
What this Data2Ext hack basically does is changing some partition settings (loopback) to increase write performance and to saver power. Originally created for the HTC Desire, it delivers some huge improvements and it really is a must-have for the Desire. The benchmark scores are outstanding. The hack was created by the xda-developers user ownhere and you can check his thread for more information

If you found this interesting, please don't forget to like/share it. Like the page too, in order to receive all the updates in Facebook.

You might also like:

    >>Terminology
    >>E:can’t open /cache/recovery/command
    >>Useful Android Terminal Commands
    >>youADB – A very convenient tool for your phone
    >>Connect to the Android phone through ADB wireless

  • http://www.rojaemsami.ru/forum/profile.php?mode=viewprofile&u=17777 fast cash loan

    I feel this is among the most important info for me. And i am glad studying your article. However want to commentary on some normal issues, The web site taste is great, the articles is in reality great . Excellent task, cheers

  • http://woodworkingpatternswizard.info woodworking patterns

    I’m having a small issue I cannot make my reader pick up your feed, I’m using google reader by the way.

  • Andrew
  • http://www.todgnow.com Magda Barkalow

    We stumbled over here coming from a different website and thought I may as well check things out. I like what I see so i am just following you. Look forward to finding out about your web page for a second time.

  • http://www.yahoo.com/ Raynoch

    One or two to remebmer, that is.

  • http://www.yahoo.com/ Alyn

    I really appreicate free, succinct, reliable data like this.

  • Frank

    Thanks. Your article has given me a good picture of what is going on on the sd card. Finally! I have searched for hours, grappling with this stuff getting more confused as I went on.

  • http://android.bytearrays.com/android/free-some-space-on-phones-memory-without-data2ext/ Free some space on phone’s memory without DATA2EXT | Android Bytes

    [...] { $.Lightbox.construct({ }); }); Data2Ext is an excellent hack to have your “internal memory” increased, but if you don’t want to [...]

Subscribe to email feed

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Difference Between A

The post title is referring to the difference between Android ...

HTC Sense 3.5 is com

coolexe, a very appreciated developer from xda-developers has managed to ...

Asphalt 6: Adrenalin

If you own a Samsung Galaxy S II or a ...

Ice Cream Sandwich S

At Google I/O this year, the newest version of Android ...

Android Hacker's Key

Here’s a full 5-row keyboard including arrow and Esc/Ctrl keys, ...

Difference Between A

The post title is referring to the difference between Android ...

HTC Sense 3.5 is com

coolexe, a very appreciated developer from xda-developers has managed to ...

Free some space on p

Data2Ext is an excellent hack to have your “internal memory” ...

Install InsertCoin R

InsertCoin ROM is one of the best custom ROMs for ...

Flashing a custom HB

Installing a custom ROM may become a little bit frustrating ...