Storage Volumes (Android)
Also known as: getStorageVolumes, primary external volume, android storage volumes
On Android, a storage volume is a logical unit of mountable storage such as built-in internal storage or a removable SD card. Apps enumerate them through StorageManager.getStorageVolumes() to discover each volume's path, state, and whether it is the primary or removable volume.
- StorageManager.getStorageVolumes() returns each mountable volume: internal, SD card, or USB OTG.
- The primary shared volume maps to paths like /storage/emulated/0; secondary volumes may be removable.
- Each StorageVolume reports its state (mounted, removed, unmounted) and whether it is primary or removable.
Internal, external, and removable volumes
Android models storage as a set of StorageVolume objects. There is always a primary shared volume (the user-facing internal storage that maps to paths like /storage/emulated/0), and there may be additional volumes for a microSD card or USB OTG drive. The terms internal and external can be confusing: app-private internal storage is different from the shared external volume that the StorageVolume API enumerates.
Each volume reports a state such as MEDIA_MOUNTED, MEDIA_REMOVED, or MEDIA_UNMOUNTED, whether it is removable, and whether it is the primary volume. This lets an app behave correctly when an SD card is ejected or remounted.
Enumerating volumes in code
Apps get a list of volumes from StorageManager.getStorageVolumes(). Since Android 11, each StorageVolume exposes getDirectory() for its mount point, and apps query free and total space via StorageManager.getAllocatableBytes() or StorageStatsManager. The MediaStore API exposes volume names through MediaStore.getExternalVolumeNames(), with the primary shared volume identified as VOLUME_EXTERNAL_PRIMARY.
Because scoped storage restricts raw file-path access, accessing media on a secondary volume like an SD card generally goes through MediaStore or the Storage Access Framework rather than direct paths.
Why a cleaner enumerates volumes
To report accurate free space and find reclaimable files everywhere, a storage cleaner must enumerate every mounted volume, not just primary internal storage. A phone with a microSD card can hold gigabytes of duplicate or large media on the removable volume that a single-path scan would miss.
Cleanor walks each available storage volume so duplicate photos, large videos, and junk files on both internal storage and an SD card are found, giving a true picture of where space is used across the device.