Android Partitions and File Hierarchy
Deck 2: Android file partition and hierarchy. The main partitions (/boot, /system, /recovery, /data, /cache, /misc, /sdcard), the root directory tree with ADB demos, where apps store data (shared preferences, internal, external, SQLite), mount points and VFS, and flash, media and pseudo filesystems.
To analyse any system you must know its file hierarchy. Knowing how Android organises data in files and folders lets an analyst narrow the search to specific locations.
- The Android file hierarchy is a customised version of the Linux hierarchy.
- It may change slightly with the manufacturer and the underlying Linux version.
- Some folders are visible only with root access.
Android PartitionsSearch on YouTube
| Partition | Contents | Forensic relevance |
|---|---|---|
/boot | Information and files needed to boot: the kernel and RAM disk | Without it the phone cannot start. Data in RAM is rich in value and should be captured during acquisition. |
/system | System files other than kernel and RAM disk: Android frameworks, libraries and preinstalled apps | Must never be deleted; that makes the device unbootable. |
/recovery | Backup boot option; boots the device into recovery mode | Recovery mode is used for phone updates and maintenance, and has tools to repair the installation. |
/data | Data of each application and most user data: contacts, SMS, dialled numbers | Most important partition for forensics. |
/cache | Frequently accessed data, some logs, and update packages downloaded over the cellular network | Data here may no longer be present in /data. |
/misc | Miscellaneous settings, mostly device state (on/off): hardware settings, USB settings | Shows how the device was configured. |
/sdcard | Everything on the SD card | Pictures, videos, files, documents. |
Partitions vary from phone to phone, because manufacturers customise Android.
Big Systems Rarely Delete Cached Media Silently: Boot, System, Recovery, Data, Cache, Misc, Sdcard.
Practical: Viewing Partitions with ADBSearch on YouTube
adb devices # list connected devices
adb shell # open a shell on the device
cd /proc
ls -al # the 'partitions' file is here
cat partitions # lists partitions (sda, sdb...) but not what they map to
exit # leave the shell and come back
adb shell
df # filesystem path (alias/mapping) and size info
ls -l $(find /dev/block -name by-name) # partition name -> block device mapping
cat /proc/partitions # partition layout
cat /proc/mounts # what is mounted wherecat /proc/partitions shows block devices (for example sda) but not whether sda is data, system or boot. The by-name symlinks under /dev/block give that mapping.
Android File HierarchySearch on YouTube
In Linux the file hierarchy is a single tree. The top of the tree is /, called the root.
Overview of DirectoriesSearch on YouTube
| Directory | What it holds | Demo |
|---|---|---|
acct | Mount point for the acct cgroup (control group), which provides user accounting (details about different users) | ls, cd acct/ |
cache | Frequently accessed data and app components. May hold images, browsing history and other app data. Contains lost+found, which keeps recovered files after filesystem corruption (for example, removing the SD card without unmounting it) | cd cache, ls |
data | Data of each application; most user data (contacts, SMS, dialled numbers) | cd data/, ls -al |
dev | Special device files for all devices. Mount point for the tmpfs filesystem, which defines the devices available to apps | cd dev, ls -al |
init | The init program executed when the Android kernel boots | cat init |
mnt | Mount point for all filesystems, internal and external SD cards | cd mnt/, ls |
proc | Mount point for procfs, access to kernel data structures and process information. For example /proc/meminfo gives memory allocation | cd proc/, cat meminfo |
root | Home directory of the root account. Accessible only on a rooted device | |
sbin | Binaries for several important daemons | cd sbin, ls |
misc | Miscellaneous settings, mostly state (ON/OFF): hardware settings, USB settings | |
sdcard | Data on the device's SD card | cd sdcard, ls |
system | Libraries, system binaries, system files and preinstalled apps | cd system, cat build.prop, cd app |
Important Subdirectories of /dataSearch on YouTube
/data/dalvik-cache: holds optimised dex files so they need not be compiled and loaded each time. When an app is installed, its.dexfile is modified and an.odex(optimised dex) file is created. It is cached here so the optimisation does not run every time the app loads. Demo:cd data/,ls -al,cd dalvik-cache,ls -al./data/data: the private data of all applications. Most user data is stored here, so it is very important forensically. Demo:cd data,ls,cd com.android.phone,ls.
/sdcard and DCIMSearch on YouTube
- The SD card can be removable or non-removable storage.
- Any app with the
WRITE_EXTERNAL_STORAGEpermission may create files or folders here. - Most phones have default folders such as
android_secure,Android,DCIMandmedia. - DCIM (Digital Camera Images) is the default directory structure for cameras, smartphones and tablets. It holds photos, videos and thumbnail (cache) files. Photos are stored in
/DCIM/Camera.
/system ContentsSearch on YouTube
build.prop: all build properties and settings for the device. It gives an overview of the device model, manufacturer, Android version, CPU details and more. Demo:cat build.prop.app: system apps and preinstalled apps. Mounted read-only to prevent changes. Besides.apkfiles you see.odexfiles. An.odexfile is a collection of parts of the app optimised before booting, meant to save space.framework: sources of the Android framework. Holds implementations of key services, such as the system server with the package and activity managers. Much of the mapping between Java app APIs and native libraries happens here. Demo:cd framework.
Practical: Walking the TreeSearch on YouTube
adb shell
ls -al # top-level folders; acct is listed first
cd acct/ ; ls ; cd ..
cd cache ; ls ; cd ..
cd data/ ; ls -al ; cd dalvik-cache/ ; ls -al ; cd ..
cd data ; ls ; cd com.android.phone ; ls ; cd ../../..
cd dev ; ls -al ; cd ..
cat init # contents of the init file
cd mnt/ ; ls ; cd ..
cd proc/ ; ls ; cat meminfo ; cd ..
cd sbin ; ls ; cd ..
cd sdcard ; ls ; cd ..
cd system ; ls ; cat build.prop ; cd app ; ls ; cd ../framework ; lsMost of these need root on a real phone. On an emulator adb root gives a root shell.
Assignment 1, Android File System Exploration using ADB. The lab connects with adb shell, lists the root directory (ls -al /) and /data, and explains the forensic relevance of each folder. Key findings: /data/data/<package> holds databases/, shared_prefs/, files/, cache/; /data/system holds accounts and lock settings; /data/app holds user-installed APKs; misc_ce/misc_de show the CE/DE split from L02; /system/build.prop identifies the device; /proc gives live process data.
Application Data StorageSearch on YouTube
Android apps store a lot of sensitive data. Apps on a device come from four sources:
- Apps that come with Android
- Apps installed by the manufacturer
- Apps installed by a wireless carrier
- Apps installed by the user
App data often holds a wealth of information relevant to an investigation (for example, WhatsApp forensics starts by finding where the WhatsApp package is installed).
- App data can be stored internally or externally.
- On external storage (SD card) data can be anywhere. On internal storage the location is predefined.
- Internal data of every app (system or user-installed) is saved in
/data/data/<package name>. For example, the default email app iscom.android.email, and its data is in/data/data/com.android.email.
App data can be stored in five places:
- Shared preferences
- Internal storage
- External storage
- SQLite database
- Network
Some Investigators Examine SQLite Nightly: Shared preferences, Internal, External, SQLite, Network.
Shared PreferencesSearch on YouTube
- A framework to store key-value pairs of primitive data types in
.xmlformat. Primitive types: boolean, float, int, long and string. - Stored in
/data/data/<package>/shared_prefs/, for example/data/data/com.android.email/shared_prefs/. - View with
cat:
cat /data/data/com.android.email/shared_prefs/com.android.email_preferences.xml<boolean name="account_settings_cc_bcc" value="true" />
<string name="account_name">user@example.com</string>
<string name="account_password">...</string>- Data is in name-value pairs. Parameters such as
account_name,account_passwordandrecent_messagesare interesting forensically. - Many apps store sensitive data in shared preferences because it is lightweight. So it is a key source of evidence.
Internal StorageSearch on YouTube
- Files are stored in the app's
/data/datasubdirectory. - Data here is private; other apps cannot access it.
- Even the device owner cannot view these files unless they have root.
- The developer can allow other processes to modify and update these files if needed.
- Most apps get the folders
databases,lib,shared_prefs,cache. - The
databasesfolder holds crucial data. View it with tools such as SQLite Browser.
External StorageSearch on YouTube
- Removable media (SD card) or non-removable storage that comes with the phone.
- A removable SD card can be used on other devices by moving the card.
- SD cards are usually formatted with FAT32, EXT3 or EXT4.
- External storage has no strict security enforcement. Data here is public. Other apps can read it if they have the needed permissions.
- Apps keep large files (images, videos) here for faster retrieval.
SQLite DatabaseSearch on YouTube
- A popular database format for structured data on many mobile systems. Open source, compact, full-featured.
- Android supports SQLite through dedicated APIs.
- App databases are usually at
/data/data/<ApplicationPackageName>/databases. - Highly valuable forensically: they often hold much of the app's important data.
| Storage | Location | Format | Who can read it |
|---|---|---|---|
| Shared preferences | /data/data/<pkg>/shared_prefs/ | XML key-value | App only (root to read) |
| Internal storage | /data/data/<pkg>/ (files, cache, lib) | Any file | App only (root to read) |
| External storage | /sdcard/... | Any file, FAT32/EXT3/EXT4 | Any app with permission |
| SQLite | /data/data/<pkg>/databases/ | .db files | App only (root to read) |
| Network | Remote server | Any | Server side |
Mid sem 2026 asked where a banking app would store account details (SQLite), login and preferences (shared preferences), downloaded statements (internal/external file storage) and temporary files (app cache). Map each data type to one of these locations with its path.
Android FilesystemSearch on YouTube
A filesystem defines how data is stored, organised and retrieved from a volume. A basic installation may use one volume split into several partitions, and each partition can have a different filesystem. Windows uses FAT32 or NTFS; Linux uses EXT2 or EXT4. Examination tools (FTK, Autopsy) extract evidence from an image based on its filesystem.
Purpose of a FilesystemSearch on YouTube
- A directory is a collection of files; files hold data and have extensions.
- To the OS everything is in memory, in binary form.
- The filesystem decides how content is stored in memory and how files are retrieved. For example, it lets the OS open a
.docxfile with Microsoft Word. - The filesystem manages the files and folders inside a partition.
Mount Points and VFSSearch on YouTube
- Android uses mount points, not drive letters (C:, E:).
- A mount point is a directory to which a partition is attached.
- Mounting attaches an additional filesystem to the currently accessible filesystem.
- Each filesystem has its own rules, so each offers different retrieval speed, security, size limits and so on.
- From a forensic view, identify which filesystems Android uses and which matter to the case. The filesystem holding user data is the main concern.
- Filesystems are not accessed by drive name. They are combined into one hierarchical tree. Each new filesystem joins this tree when it is mounted, and its files become the contents of the mount-point directory.
- Each filesystem has a kernel module that registers its operations with the Virtual File System (VFS). VFS lets applications access different filesystems in a uniform way.
cat /proc/mounts # sda, sdb... are partitions; /system, /data are mount points
cat /proc/filesystems # supported filesystems; 'nodev' marks pseudo filesystemsIn /proc/mounts, /system and /data are directories mounted on partitions such as sda and sdb.
Common Android FilesystemsSearch on YouTube
Three main categories:
- Flash memory filesystems
- Media-based filesystems
- Pseudo filesystems
Flash Memory FilesystemsSearch on YouTube
Flash memory is non-volatile memory that is erased and reprogrammed in units called blocks. Flash has special characteristics (long erase times for some blocks), so it needs special filesystems.
| Filesystem | Key fact from the slides |
|---|---|
| exFAT (Extended File Allocation Table) | Microsoft proprietary, optimised for flash drives |
| F2FS (Flash Friendly File System) | Open-source filesystem introduced by Samsung |
| JFFS2 (Journal Flash File System v2) | Log-structured filesystem used in Android; the slide states it is the default flash filesystem for AOSP since Ice Cream Sandwich |
| YAFFS2 (Yet Another Flash File System v2) | Not supported in newer kernels, but some manufacturers may still support it |
| RFS (Robust File System) | Listed on the slide with no further detail |
Media-based FilesystemsSearch on YouTube
These manage media storage and retrieval.
- EXT2/EXT3/EXT4 (Extended file system): one of the first filesystems to use the virtual filesystem.
- Journaling is the main advantage of EXT3 over EXT2. After an unexpected shutdown or corruption, EXT3 does not need the filesystem verified; files and folders stay available.
- EXT4 gained importance with dual-core phones. YAFFS2 had a bottleneck on dual-core systems, so with Gingerbread Android swapped YAFFS for EXT4.
- FAT (FAT12, FAT16, FAT32): supported by the MSDOS driver.
- VFAT (Virtual File Allocation Table): an extension of FAT16 and FAT32.
- Most Android devices support Microsoft's FAT32. Windows, Linux and macOS all support it, so they can read, modify and delete files on the FAT32 part of an Android device. Most external SD cards are formatted FAT32.
Pseudo FilesystemsSearch on YouTube
Pseudo filesystems are logical groupings of files. They have no real storage device and are marked nodev in /proc/filesystems.
| Pseudo FS | Mounted at | Purpose and forensic value |
|---|---|---|
| cgroup (control group) | /acct and others | Access and define kernel parameters. Android uses it to track jobs: it aggregates tasks and keeps track of them. |
| rootfs | / | Holds everything needed to boot. Mounted first; all other filesystems are mounted on it. If corrupt, the device cannot boot. |
| procfs | /proc | Kernel data structures, processes and system information. /proc/filesystems lists available filesystems; cat /proc/cpuinfo shows CPU details. |
| sysfs | /sys | Device configuration. Useful to check whether a setting was enabled on the phone. |
| tmpfs | /tmp (and /dev) | Temporary storage in RAM. Fast, but lost on restart or power-off. Examine or extract it before a reboot. Demo: cd tmp/, ls. |
cat /proc/filesystems
cat /proc/cpuinfotmpfs data lives in RAM. If the phone is rebooted or switched off, it is gone. This is one more reason not to power off a seized phone (see L01).
Quick self-testSearch on YouTube
Why is the /data partition the most important for forensics?
It holds the data of every application and most user data: contacts, SMS, dialled numbers, app databases and shared preferences under /data/data/<package>.
Why can /cache be useful even when /data has been examined?
/cache stores frequently accessed data, logs and downloaded update packages. Data here may no longer exist in /data.
What is the Dalvik cache and why is it there?
/data/dalvik-cache stores the optimised .odex file created from an app's .dex file at install, so the optimisation does not run every time the app loads.
What does build.prop tell a forensic analyst, and where is it?
/system/build.prop holds build properties: device model, manufacturer, Android version, CPU details and other settings.
Which ADB commands show the partitions and their mapping?
adb shell, then cat /proc/partitions (partitions only), df (paths and sizes), ls -l $(find /dev/block -name by-name) (name to block device mapping), and cat /proc/mounts (mount points).
List the five places an Android app can store data.
Shared preferences, internal storage, external storage, SQLite database, network.
What are shared preferences and why do they matter forensically?
XML files of key-value pairs of primitive types (boolean, float, int, long, string) in /data/data/<pkg>/shared_prefs/. Apps often store sensitive values such as account_name and account_password there because it is lightweight.
How does external storage differ from internal storage?
Internal storage (/data/data) is private to the app and needs root to read. External storage (SD card, usually FAT32/EXT3/EXT4) has no strict security; any app with permission can read it, and it holds large media files.
What is a mount point and what does VFS do?
A mount point is a directory to which a partition's filesystem is attached. VFS is the kernel layer where each filesystem module registers its operations, so apps can access different filesystems uniformly.
Name the three categories of Android filesystems with one example each.
Flash memory (F2FS, YAFFS2, JFFS2, exFAT, RFS), media-based (EXT4, FAT32, VFAT), pseudo (rootfs, procfs, sysfs, tmpfs, cgroup).
- Android uses a customised Linux tree rooted at
/; some folders need root. - Partitions:
/boot(kernel, RAM disk),/system(framework, libs, preinstalled apps),/recovery,/data(user and app data),/cache,/misc,/sdcard. - Key paths:
/data/data/<pkg>,/data/dalvik-cache(odex),/system/build.prop,/system/app,/system/framework,/DCIM/Camera. - Use
adb shellwithcat /proc/partitions,df,/dev/block/.../by-nameandcat /proc/mountsto map partitions. - App data goes to shared preferences (XML), internal storage, external storage, SQLite (
databases/) or the network. - Filesystems mount at mount points into one tree; VFS gives uniform access.
- Flash (F2FS, YAFFS2, JFFS2, exFAT, RFS), media (EXT2/3/4, FAT32, VFAT) and pseudo (cgroup, rootfs, procfs, sysfs, tmpfs) filesystems.
- tmpfs lives in RAM and is lost on reboot.