What format is Android storage?

Android is a popular mobile operating system developed by Google. Since its launch in 2008, Android has seen massive growth in adoption and now has over 75% of the global smartphone market share. With over 1 billion active Android devices, storage management has become an important consideration for users.

Storage on Android devices primarily comes in two forms: internal storage and removable storage. Let’s take a deeper look into how Android handles storage and file management.

Types of Android Storage

Android devices have two main types of storage: primary storage and secondary storage. Primary storage refers to the internal storage that comes built into the device and contains the Android OS itself, preinstalled apps, and user data. This is sometimes referred to as internal storage or ROM (read-only memory). Secondary storage refers to removable storage mediums that can be used to store additional data, like an SD card or microSD card. Let’s explore these two main storage types in more detail:

Primary storage is the built-in, non-removable flash memory that comes with the Android device. This is where the core Android OS system files, configuration files, downloaded apps, and user data such as contacts, messages, settings etc. are stored by default. Primary storage uses flash memory technology for high performance and is typically partitioned into different logical sections. Since primary storage is limited in capacity and built into the device, it cannot be physically removed or upgraded in most cases. The amount of primary storage varies across Android devices but is typically a few gigabytes at minimum for modern devices.

Secondary storage refers to external storage mediums that can be used to store additional data on an Android device, such as photos, videos, and music files. The most common type of secondary storage is a removable memory card, such as an SD card or microSD card. Secondary storage connects to the device through external slots or ports. Because secondary storage is removable and upgradeable, it enables expanding the storage capacity of the device beyond the built-in primary storage. For example, SD cards ranging from 8GB to 512GB can significantly increase the storage space for media files, backups, or other data. Secondary storage can also include USB drives connected via USB OTG. However, SD cards remain the predominant removable storage medium used across consumer Android devices.

Internal/Primary Storage

Internal storage, also known as primary storage, refers to the built-in read-only memory (ROM) on Android devices that houses the operating system, system files, and pre-installed apps. It is typically 4-16GB in size depending on the device. Unlike external SD cards, the primary storage cannot be physically removed. Android manages internal storage and automatically handles system and app data storage within it.

Internal storage uses a Linux filesystem format such as ext4, f2fs, or YAFFS. It contains multiple partitions for system, boot, recovery, miscellaneous files, and user data. The /data partition stores user data such as app data, app databases, cached data, and media files created by the user. The internal memory is encrypted by default to protect user privacy.

While internal storage offers high read/write speeds, its capacity is limited. Users cannot directly access the /data folder on internal storage through a file manager app without root access. Instead, Android provides scoped storage where apps can only access their own app-specific directories. The Storage Access Framework allows users to grant file access across different apps.

Overall, internal storage reliably houses the Android OS and pre-installed apps while providing high-speed access to app data. Its capacity constraints mean external SD cards are often used to supplement storage for user files like photos, videos, and music. (Froemling, 2019; https://www.digitalocean.com/community/tutorials/android-internal-storage-example-tutorial )

Secondary/Removable Storage

Many Android devices support expandable storage via an external SD card (Android SD Card storage for LrM). This allows users to increase the overall storage capacity of their device and provide a location to store photos, videos, music, and other files. External SD cards use the FAT32 filesystem and connect to the device via the microSD slot or USB OTG.

By default, Android treats external SD cards as portable storage instead of adoptable storage. This means the SD card is mounted separately from internal storage and apps must request permission to access files on the SD card. However, some devices allow SD cards to be formatted as adoptable storage which combines the external storage into the main internal storage (Removable storage (external) sdcard path by manufacturers).

A downside of using external SD cards is that the performance is often much slower compared to internal flash storage. There are also inconsistencies in how different apps handle SD card storage, with some like Spotify ignoring the SD card completely (SD card storage location no longer an option). Overall, SD cards provide a way to add more storage but come with caveats around performance and integration.

Filesystem Support

Android supports several common filesystems for storage, including EXT4, exFAT, and FAT32. The primary filesystem used by Android is EXT4, which stands for Fourth Extended Filesystem. EXT4 is a journaling filesystem that provides improvements in performance, reliability, and disk space utilization compared to its predecessor EXT3.

For secondary and removable storage like SD cards and USB drives, Android also supports the exFAT and FAT32 filesystems. exFAT allows for larger file sizes compared to FAT32, while FAT32 has wider compatibility with other devices like cameras. When formatting external storage on Android, you have the option to choose between exFAT and FAT32 depending on your needs.

Support for multiple filesystems allows Android to work with storage devices of different formats. The platform includes the necessary drivers and libraries to read and write to all of its supported filesystems. Filesystem support is implemented in the Android kernel and built into system components like vold and sdcard for accessing storage.

Partitioning

Android devices use multiple partitions for separating different types of data and system files. The main partitions are:

  • System – Contains the Android OS files and operating system
  • Data – Stores user data such as contacts, messages, settings, and installed apps
  • Cache – Temporary app data and files
  • Recovery – Boots into recovery mode for maintenance and updates
  • Boot – Bootloader files required during startup
  • Vendor – Device-specific files from manufacturers

Starting in Android 11, devices can use dynamic partitions managed by the userspace instead of the kernel. This allows partitions to be resized as needed without repartitioning the entire storage (Source). Older Android versions rely on traditional static partition tables.

Users can repartition devices using tools like Diskpart on a Windows PC. This allows reallocating storage between partitions like System and Data (Source). However, repartitioning requires a full wipe and factory reset.

Encryption

Android has supported encryption of data storage since Android 3.0 Honeycomb. Encryption helps protect sensitive user data and can be enabled in the device settings. When enabled, Android uses an encrypted key stored in hardware to encrypt data before it’s written to storage. The encryption keys are secured using hardware mechanisms like Trusted Execution Environment (TEE) and StrongBox Keymaster. The encryption algorithm typically used is AES 128-bit or AES 256-bit [1].

When encryption is enabled, most data such as photos, messages, downloads, apps and their data are encrypted. Exceptions include some caching and app data marked to be excluded [2]. Encryption protects data even when the device is lost or stolen. However, some weaknesses have been found over the years, allowing encryption bypass in some devices [3]. Google continues to improve encryption support in Android to make it more robust.

Adoptable Storage

Adoptable storage was introduced in Android 6.0 Marshmallow as a way to expand internal storage. It allows the user to format an external microSD card as internal storage and seamlessly use it in tandem with the device’s built-in storage.

Prior to Android 6.0, external SD cards could only be used as portable storage for files like photos, videos, and music. With adoptable storage, the SD card is encrypted and formatted to function as part of the device’s internal storage.

According to Google’s documentation, when an SD card is formatted as adoptable storage, it “becomes part of the extended internal storage of an Android device” and “can hold any type of data that internal storage can hold, not just media files.”

Some key features of adoptable storage include:

  • Expanded internal memory for apps, games, photos, videos, and more
  • Encryption and integration into the Android filesystem
  • Seamless use alongside built-in storage with no file management needed
  • Ability to migrate data between internal storage and adoptable SD card

The adoptable storage feature aimed to solve the limitations of portable external storage and simplify storage expansion for Android users.

Storage Access Framework

The Storage Access Framework was introduced in Android 5.0 to provide more secure file access for apps. It allows apps to access files and docs while preventing unauthorized access to other apps’ data. Apps must use this framework to interact with files located in shared storage areas like Downloads, Documents, Pictures, etc.

To access files, apps use the Storage Access Framework’s open selector which shows a user-facing UI for finding and selecting a file. The user must explicitly grant access to the selected file through this UI. Once granted, apps can read, edit or delete that file.

Apps can continue accessing selected files across devices and sessions until access is revoked. The framework manages persistent access permissions so users don’t have to approve every file access.

Overall, the Storage Access Framework allows secure file interactions while giving users control over their data. It prevents apps from arbitrarily accessing files without explicit user consent through the built-in UI.

Conclusion

In summary, Android uses several different storage formats and locations to store data. The primary internal storage uses EXT4 or F2FS filesystems to store apps, user data, and system files. Removable storage like SD cards typically use FAT32 or exFAT filesystems. Android also supports full disk encryption as well as file-based encryption for secure data storage.

Looking ahead, we can expect continued improvements in Android storage technology. Adoptable storage allows SD cards to be formatted and encrypted as internal storage. New filesystems like F2FS optimize performance for flash storage. And new APIs like the Storage Access Framework simplify managing files across multiple storage locations. The Android platform will likely continue expanding flexible storage options while ensuring security remains a top priority.