[T-Mobile Samsung Galaxy S II SGH-T989] mstrk242:
Hello everyone. I see a lot of very basic android questions floating around the forums, so I figured I'd give a VERY basic rundown of the android filesystem for those who don't know. (If you're even slighty experienced, this'll seem like a "duh" thread, you should skip this. This is for new people.)

Ok, to understand android, first thing you need to understand are the basic partition structures. There are 5 android partitions.

boot

cache

recovery

system

data

Before I get into the partitions, you'll have to understand what a mount point is. When you "mount" a drive, you are making it available to the system. On linux (and by extension, android), you need to have a mount point. This is a directory somewhere that serves as a path for the mounted filesystem. So for example, let's say I wanted to mount mmcblk0p1 to a temp directory to edit it. For this example I'll create a directory /data/temp. Now you'd mount mmcblk0p1 /data/temp. When you read the contents of the directory temp under the directory data, you'll see all the info stored on mmcblk0p1. Even something as simple as a flash drive needs to be mounted under linux. If you're an ubuntu user, usually it automounts to /mnt/name of device.

Now, when you boot android, the first thing it does is boot up the linux kernel (when you see the tmobile splashscreen, that's when the kernel is loading.) Next, it loads up the ramdisk. Both of these files are on the boot partition. (When you open up a cwm zip file, you'll see boot.img in there, that's where these reside.) There are two files on the boot partition. zImage (the linux kernel), and initrd.gz (the cpio archive containing the ramdisk.)

What is the ramdisk you ask? Well, very simply, it's the place where the root file system is loaded, and where the init.rc resides. The init.rc is the android startup script (again, basic analogy). If you'd really like to learn about android and how it works, this is the first file I'd start reading.

On to the partitions:

boot - Described above, containing the zimage and initrd.gz

recovery - this is where either the stock recovery or clockwork recovery is located. This is only accessed when entering recovery mode.

cache - You guessed it, this is where some parts of android cache it's file. (Not to be confused with the dalvlik cache, that's located on the data partition.)

system - this is where the system is located. (Esentially the rom you're flashing.)

data - this is the partition where all your installed apps go, as well as the location of a couple parts of the system, like the dalvik-cache and the batterystats.bin file. (Quite a few more, just givinig examples.)

So what does all this mean to you? Well, I see a LOT of people asking about wipes before installs, or asking about flashing kernels, this is why I took the time to explain this.

When you enter cwm, and do a backup, it creates 5 .img files on your sdcard. (One for each of the partitions mentioned above.) When you flash a kernel, it only replaces the boot.img, and a couple files in the system folder. Usually these are kernel modules like the wifi module, and any other modules that aren't compiled into the system. (Although most kernel builders build cifs.ko and all that right into the kernel so the modules aren't needed.)

When you flash a rom, it will always replace the /system and /boot partitions. The rest, that depends on the rom. If you'd like to know what your rom is doing, open up the cwm zip file, and go to meta-inf/com/google/android and you'll see 2 files. Updater-script and update-binary. Updater-script will tell you what it does on install. (You'll see it mounting the partitions it needs, what it does and doesn't format, and also it does a whole bunch of simlinks.) Simlinks, or symbolic links, are either files or directories that point to somewhere else. For example, let's say you are a user who uses ext-sd. What you do is create a simlink for /data that points to the ext3 partition on your sdcard. This way, anytime the system goes to /data it writes somewhere else. Most of the simlinks created in android are more for busybox commands, but that's for another post :)

If you'd like to see what your mount points are, from an android terminal emulator (or of course adb, but if you are experienced with adb chances are you don't need any of this info in the first place :)), type mount. (You might need to type su first, hit enter, then mount). This will list all your mount info. If you'd like to know the actual device name of the mount point, you'd look here. On ours, for example, it's:

mmcblk0p24 is /system

mmcblk0p26 is /cache

mmcblk0p25 is /data

and so on.

Ok, finally, a couple other questions I see often:

Why does my system "hotboot"?

When a system hotboots, it means that zygote has crashed. This is the virtual machine that android runs in. So if you are using your phone, and you all of a sudden go back to the boot animation (NOT the splashscreen with the kernel logo), you just hot-booted. When an application allows you to hotboot all it does is the following command from inside linux: pkill zygote (or pkill -9 zygote).

How do I calibrate my battery?

The batter calibration is a file called batterystats.bin. This is located in /data/system. When you get to 100% charge, if you delete this file, it'll start over on the battery calibration. (There are also market apps to do this for you for the squeamish.)

Other notable files:

gps.conf

Located in the /system/etc folder. This has all the gps configuration, nameservers, and things like this.

build.prop

Located in /system

A lot of device info is stored in here. For more info, google it. :)

Hopefully this wasn't too mashed together and confusing. I tried to follow a logical order, but I've had way too much turkey and beer today, so I'll post this and let it fly.

Have a happy thanksgiving everyone!