Android StorageManagerService and VOLD interaction| Part 2/2

In the previous post we have seen that how volume daemon (vold) communicates with StorageManagerService and how the information is passed from the native layer to the framework layer. In this article we will see how the information again passed between vold and StorageManagerService to mount the SD card or any other external storage.

Previously we have seen upto how vold send DiskScanned information to StorageManagerService (SMS). Now lets see how the public or private volume gets populated.

The difference public and private volume is, when your SD card is acted as internal storage then it will be treated as a private volume, otherwise it will be a public volume only. 

When readPatition() method is called of Disk.cpp, it calls createPublicVolume() before calling onDiskScanned()

Android vold createPublicVolume

Here we can see an Object of PublicVolume is created. After creation, the volume is pushed to volumes list (mVolumes) and create() method is called.

The above condition will be executed when you format the SD card or any external storage.

Let’s see what’s inside create() method.

Android vold VolumeBase create method

The create() method then call doCreate(), which is called  inside PublicVolume.cpp
The doCreate() method will create  device node with the dev path =

"/dev/block/vold/%s", getId().c_str()

Here getId() is the ID of the newly created disk. It will be in the form of “public:major,minor“. For example: public:179,33

device node creation for external storage

Once the device node is created, vold will send a callback to StorageManagerService by calling onVolumeCreated().

The onVolumeCreated() will then call the onVolumeCreatedLocked(). This method sends an handler message H_VOLUME_MOUNT to mount the external volume. In Android 11, the StorageManagerService uses the asynchronous AIDL(IVoldMountCallback.aidl) to receive callback from vold daemon.

handler message to mount

The storageManagerService uses another aidl IVOLD.aidl to communicate to vold deamon. The StorageManagerService uses an asynchronous AIDL to receive the callback when mounting is done. At this point you can now understand, how the complete cycle of communication goes from StorageManagerService to Vold and from Vold to StorageManagerService.

The below diagram will clearly explain the cycle of communication.

Basic workflow diagram of android vold

The mount() method will be called on VolumeNativeService.cpp

volumenativeservice mount and callback

The above function is self-explainatory. The VolumeManager finds the volume using volId, then sets the mount flags, mount userId and mountCallback and then calls the mount() of VolumeBase.cpp.

The VolumeBase set the state as checking first then calls doMount()

status_t VolumeBase::mount() {
if ((mState != State::kUnmounted) && (mState != State::kUnmountable)) {
LOG(WARNING) << getId() << " mount requires state unmounted or unmountable";
return -EBUSY;

status_t res = doMount();
if (res == OK) {
} else {

return res;

The doMount() method first checks whether the file system of if type vFat or exFat. Then it mounts the external storage.

Here I am taking the example, the file system is of type vFat. This is how the checking is done.

vold vfat check before mounting

The vold forks a seperate process which will check if the file system is vFat or not. 

Here is the log snippet:

D/vold: /dev/block/vold/public:179,33: UUID="7295-B756" TYPE="vfat" 
D/vold: /system/bin/fsck_msdos
D/vold: -p
D/vold: -f
D/vold: -y
D/vold: /dev/block/vold/public:179,33
D/vold: /dev/block/vold/public:179,33: Next free cluster in FSInfo block (16) not free
D/vold: FIXED
D/vold: /dev/block/vold/public:179,33: 2040 files, 8787136 KiB free (274598 clusters)
I/vold: Filesystem check completed OK

Let us see the PublicVolume::doMount() method.

vold public volume domount 2
vold public volume domount 3

Once the mounting is done, the vold uses the callback to pass this information to StorageManagerService by calling onVolumeChecking() method.

Finally you will see this type of logs in logcat:

system_process I/StorageManagerService: Mounted volume VolumeInfo{public:179,33}:
type=PUBLIC diskId=disk:179,32 partGuid= mountFlags=VISIBLE mountUserId=0
fsType=vfat fsUuid=7295-B756 fsLabel=
path=/storage/7295-B756 internalPath=/mnt/media_rw/7295-B756

In this way Vold completes it process of mounting the external physical storage on Android.


This is the complete flow of how SD card or any other external storage is getting mounted in Android. Here I have taken the references from Android 11 which is the latest android available to date. There are other scenarios, that I have not discussed like formatting and quickly ejecting and mounting the SD card from setting App. These all things are managed and controlled by vold only. If you like this post, please do share it on social media like Facebook or WhatsApp. If you have any suggestions or questions please do let me know in the comment section. Or if you want to know anything about any app or software for your own purpose, write us to, and please like our Facebook page.


Swetabh is an Android Developer and a Tech enthusiast. His enthusiasm drives him to know about various technologies. Now he wanted to share his knowledge to other enthusiast who are passionate to know-how and become a GIZMOMIND.

Leave a Reply