I am working on IMX8QM with Android 9. I needs to configure usb stick on static mount point.

Once USB stick detected, create sda1, after check I got:

mek_8q:/sdcard # df
Filesystem                1K-blocks     Used     Available    Use%     Mounted on
/dev/root                   1777588     1189664     587924     67%         /
tmpfs                       2918920     488         2918432    1%         /dev
tmpfs                       2918920     0           2918920    0%         /mnt
/dev/block/mmcblk0p12       249828      58936       190892     24%        /vendor
/dev/block/mmcblk0p14       9086336     967628      8118708    11%       /data
/data/media                 9086336     967628      967628     11%     /mnt/runtime/default/emulated
/dev/block/vold/public:8,1  3918844     1311400     2607444    34% /mnt/media_rw/2A61-DD07
  • Strictly speaking, do you need a static mount point, or do you need a static way to access specific directories on the usb stick, whatever the name of the mount point?
    – ftpo
    Nov 22 '19 at 5:34
  • Hi, I done by using the Ifran guide. Thank You. // Use UUID as stable name, if available std::string stableName = getId(); if (!mFsUuid.empty()) { stableName = mFsUuid; } mRawPath = StringPrintf("/mnt/media_rw/USB");
    – VKS
    Nov 22 '19 at 6:53

You got it correctly, USB OTG sticks are mounted at /mnt/media_rw/[UUID].

// Use UUID as stable name, if available
    std::string stableName = getId();
    if (!mFsUuid.empty()) {
        stableName = mFsUuid;
    mRawPath = StringPrintf("/mnt/media_rw/%s", stableName.c_str());

For FAT family of filesystems UUID is not the 32 digits long real UUID, but a serial number (8 digit long). So the mount point vold creates isn't static since Android 6. UUID (or serial number) of filesystem changes when you change USB stick or re-format it (unless you explicitly set the same UUID when or after creating filesystem). For static mount point you need to modify vold source code or mount filesystem manually. For more details see: How to change random filesystem label on USB OTG?

SD cards are also emulated form /mnt/media_rw/[UUID] to /storage/[UUID] but still the path is not static. See details here: How to move files to external SD card?

  • Thank you Ifran. So, for Android to mount usb in static point we needs to edit at the source code side. Is it right ?
    – VKS
    Nov 22 '19 at 3:16
  • @VKS choose whichever method suites your needs 1) always set same UUID when formatting USB 2) mount manually 3) modify vold source 4) use Android APIs to get storage path Nov 22 '19 at 9:58
  • Thank you Ifran. Now I able to provide static mount point by configure this line. mRawPath = StringPrintf("/mnt/media_rw/USB"). Do you know how to access this path through android application (creating new application)
    – VKS
    Nov 22 '19 at 10:03
  • No sorry, I'm not a developer. But fixing that path will also mount SD card at same path (I didn't read the source code completely though). So using USB and SD card at the same time won't be possible. Nov 22 '19 at 10:04

I have a Huawei P30 on Android 9 and a Huawei tablet on Android 8: on both, mount point for the internal drive is: "/storage/emulated/0".

Only the tablet has a SD card mounted, and mount point is "/storage/0000-0000". I see no reason for it would be different for the P30 on Android 9.

If you install Termux (a Unix shell for Android), you can go on both with a normal user and move data here and there :^)

  • 1
    /storage/0000-0000 is not the actual mount point, it's an emulated view of actual filesystem mounted at /mnt/media_rw/0000-0000. SD cards are emulated by vold, USB sticks aren't. See details here: android.stackexchange.com/a/218338/218526 Nov 21 '19 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.