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.
What is a file system?
A file system (or filesystem) is an abstraction to store, retrieve and update a set of files. The term also identifies the data structures specified by some of those abstractions, which are designed to organize multiple files as a single stream of bytes, and the network protocols specified by some other of those abstractions, which are designed to allow files on a remote machine to be accessed.
Android supports different file systems:
- FAT: Used mainly for SDCards. This system is supported by most operating systems (Windows, Linux, Mac, etc.), which is why it's used for these "exchangeables". But it is also quite restricted, which is why it is rarely used somewhere else.
- exFAT: sometimes used instead of FAT -- but not generally supported
- extfs: The extended file system already has seen several generations. Android devices usually support ext2, ext3, and in most cases also ext4.
- YAFFS: A Log structured file system designed for NAND flash, but also used with NOR flash. This was often used for e.g. the /data partition with many devices up to Android 2.x
There are also some pseudo-filesystems used on Unix/Linux system in general and on Android devices in special:
- devfs: Virtual file system for managing devices on-the-fly
- procfs: Pseudo-file system, used to access kernel information about processes
- sysfs: Virtual file system holding information about buses, devices, firmware, filesystems, etc.
Internal storage of Android devices is devided into several partitions, each dedicated to a special "task".
Some of the more important ones include:
/system: This is where the Android system and the pre-installed apps reside. It usually is mounted read-only, so on non-rooted devices you cannot write here (with the exception of applying a system update, e.g. OTA, or flashing a new ROM)
/data: Here the downloaded apps and all app's data are located. Additionally, some system settings are stored here, log files, and more
Your sdcard usually has a single partition only -- but also could be split into multiple partitions.
/system: This is where the Android system and the pre-installed apps reside. It usually is mounted read-only, so on non-rooted devices you cannot write here (with the exception of applying a system update, e.g. OTA, or flashing a new ROM)
/data: Here the downloaded apps and all app's data are located. Additionally, some system settings are stored here, log files, and more
Your sdcard usually has a single partition only -- but also could be split into multiple partitions.
Below are some of the ways i am showing you to access the various files and folders in android file system:
System
directories
Method
|
Result
|
---|---|
Environment.getDataDirectory()
|
/data
|
Environment.getDownloadCacheDirectory()
|
/cache
|
Environment.getRootDirectory()
|
/system
|
External
storage directories
Method
|
Result
|
---|---|
Environment.getExternalStorageDirectory()
|
/storage/sdcard0
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_ALARMS)
|
/storage/sdcard0/Alarms
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_DCIM)
|
/storage/sdcard0/DCIM
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS)
|
/storage/sdcard0/Download
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_MOVIES)
|
/storage/sdcard0/Movies
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_MUSIC)
|
/storage/sdcard0/Music
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_NOTIFICATIONS)
|
/storage/sdcard0/Notifications
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES)
|
/storage/sdcard0/Pictures
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_PODCASTS)
|
/storage/sdcard0/Podcasts
|
Environment.getExternalStoragePublicDirectory(DIRECTORY_RINGTONES)
|
/storage/sdcard0/Ringtones
|
Application
directories
Method
|
Result
|
---|---|
getCacheDir()
|
/data/data/package/cache
|
getFilesDir()
|
/data/data/package/files
|
getFilesDir().getParent()
|
/data/data/package
|
Application
External storage directories
Method
|
Result
|
---|---|
getExternalCacheDir()
|
/storage/sdcard0/Android/data/package/cache
|
getExternalFilesDir(null)
|
/storage/sdcard0/Android/data/package/files
|
getExternalFilesDir(DIRECTORY_ALARMS)
|
/storage/sdcard0/Android/data/package/files/Alarms
|
getExternalFilesDir(DIRECTORY_DCIM)
|
/storage/sdcard0/Android/data/package/files/DCIM
|
getExternalFilesDir(DIRECTORY_DOWNLOADS)
|
/storage/sdcard0/Android/data/package/files/Download
|
getExternalFilesDir(DIRECTORY_MOVIES)
|
/storage/sdcard0/Android/data/package/files/Movies
|
getExternalFilesDir(DIRECTORY_MUSIC)
|
/storage/sdcard0/Android/data/package/files/Music
|
getExternalFilesDir(DIRECTORY_NOTIFICATIONS)
|
/storage/sdcard0/Android/data/package/files/Notifications
|
getExternalFilesDir(DIRECTORY_PICTURES)
|
/storage/sdcard0/Android/data/package/files/Pictures
|
getExternalFilesDir(DIRECTORY_PODCASTS)
|
/storage/sdcard0/Android/data/package/files/Podcasts
|
getExternalFilesDir(DIRECTORY_RINGTONES)
|
/storage/sdcard0/Android/data/package/files/Ringtones
|
Thanks.
Very Helpful. thanks....
ReplyDeletegetExternalCacheDir ()
Deleteboycabal99@gmail.com
ReplyDeletegetExternalFilesDir(DIRECTORY_DCIM)
ReplyDeleteAs we know there are many companies which are converting into Big Data Implementation Services with the right direction we can definitely predict the future.
ReplyDeleteHow about /storage/sdcard0/Android/obb/package
ReplyDelete