On Android's root (/), what is the purpose of each folder? I want to learn the folder hierarchy structure. I would like to know the differences between Android 2.3 and 4.x, if they have different folders in "/".
First, you need to be aware of two facts:
- Android uses more than one file system (think of "multiple drives/partitions" when comparing with your computer
- while sharing a common base, directory structures might differ between manufacturers
In my answer, I will concentrate on the mentioned "common base". However, there still might be deviations made by some manufacturers.
As said, Android makes use of multiple partitions. In the file system, they are represented by "directories", which serve as their mount-points:
┌─────────────┬───────────────────────────┐ | Partition | Explanation | ├─────────────┼───────────────────────────┤ | /boot | kernel & Co. | | /cache | app cache | | /data | user data partition¹ | | /data/data | app data¹ | | /dev | devices² | | /mnt/asec | encrypted apps (App2SD) | | /mnt/emmc | internal sdcard³ | | /mnt/sdcard | external sdcard³ | | /proc | process information² | | /recovery | used in recovery mode | | /system | system ROM (read-only) | └─────────────┴───────────────────────────┘
¹ Details below
² virtual file systems
³ these might differ. Often,
/mnt/sdcard is the internal SD card, while the external SD card is found in
Above list is far from being complete, but should hold the most important partitions.
Here I again will concentrate on the partitions which are most interesting (or this answer would get far too long and, for most readers, boring.
These are in most cases two separate partitions, but there might be cases where this is handled otherwise. One thing they have in common (add
/cache here as well): they get wiped on a factory-reset, while the other partitions are usually left untouched by that.
As for the directories contained, I will again concentrate on a selection; most things here you either cannot touch without having your device rooted.
┌────────────────────┬──────────────────────────────────────────────┐ | Directory | Explanation | ├────────────────────┼──────────────────────────────────────────────┤ | /data/anr | traces from app crashes (App Not Responding) | | /data/app | .apk files of apps installed by the user | | /data/backup | Googles Cloud-Backup stuff | | /data/dalvik-cache | optimized versions of installed apps¹ | | /data/data | app data² | | /data/local | temporary files from e.g. Google Play³ | | /data/misc | system configuration (WiFi, VPN, etc.) | | /data/system | more system related stuff (certs, battstat) | | /data/tombstones | more crash stuff ("core dumps") | └────────────────────┴──────────────────────────────────────────────┘
¹ for details on the Dalvik cache, see: dalvik
² each app gets its own data directory assigned here, using the app's package name. There might be a similar directory on your SD card, mostly used by apps with larger amounts of data.
³ usually, files are stored here temporarily to be installed/executed. Google Play e.g. downloads
.apk files to this directory, before installing the downloaded app on your device
Of course, I intentionally skipped several directories. If you really want to go into details, this site might not be the best fitting place (as we deal with end-user questions -- and end-users normally don't touch these things). In that case, several places/resources might be recommended:
- XDA Developers
- good technical books on Android (e.g. Andrew Hoog's Android Forensics and Mobile Security, which goes much deeper into details here)
- Where can I ask questions that aren't Android Enthusiast questions?