What purpose does the /cache partition in Android serve? Are there any cases where clearing the /cache partition could result in lost data?
2 Answers
/cache
partition is mostly for saving the downloads from Google Play Store, found in /cache/downloads
. It also can hold the recovery log found in /cache/recovery
called last_log
as well (this holds any errors and/or diagnostics from the recovery
binary a lá CWM or stock, which will get logged in the file to aid debugging and development of the recovery
binary).
There is also another directory in there called lost+found
which holds any recovered files (if any) as a result of file-system corruption, such as incorrectly removing the SDcard without un-mounting it.
So really, there is no loss of data from clearing it.
In fact, upon Android boot-up, the script will clear out the /cache/downloads
to make way for any new downloads/updates from Google Play Store.
To give a closer overview on filesystems used on Android devices, here's a short table with a selection of the more important ones:
+---------------+------------------+------------------------------------------+
| Mount Point | File System Type | What to find here |
+---------------+------------------+------------------------------------------+
| /proc | proc | metadata about the system such as file |
| | | system statistics |
| /data/data[1] | YAFFS2 | almost all app data |
| /data[2] | EXT3/EXT4/YAFFS2 | data from apps (except those stored on |
| | | /data/data) plus system |
| /cache | YAFFS2/EXT3 | Cache file system used by some apps and |
| | | by the system |
| /mnt/asec | tmpfs | unencrypted .apk file (the encrypted |
| | | counterpart is stored in |
| | | /mnt/sdcard/.android_secure; decrypted |
| | | variant is needed for running systems to |
| | | access/execute |
| /app-cache | tmpfs | temporary file system used e.g. by the |
| | | stock-browser on some HTC devices |
| /mnt/sdcard | vfat | FAT32 file system on the SD-card |
| /mnt/emmc | vfat | FAT32 file system on the embedded |
| | | (internal) eMMC |
+---------------+------------------+------------------------------------------+
[1] on older systems, entire /data
is just a single partition/file system
[2] on newer devices, /data
can be further segemented
You will not find all these file systems on all devices -- but if you find some of them, this list should give you a raw idea.