I moved all the data of WhatsApp to /mnt/media_rw/6333-6461/WhatsApp, where 6333-6461 is my external SD card. I opened WhatsApp to find that I could not open any previously downloaded data. This is expected.

Now, I executed the following commands in Termux:

$ su
# mount -o bind /mnt/runtime/write/6333-6461/WhatsApp /mnt/runtime/write/emulated/0/WhatsApp

When I opened WhatsApp, I could see all the data that I had previously downloaded. But now I cannot send or receive anything - all sending fails, camera access from WhatsApp fails, and downloading fails.

Evidently WhatsApp is not being able to write onto the bind mount. Any solution to the problem?

My phone, a Samsung Galaxy On7, Android 6.0.1, is rooted with Magisk 20.1 and running stock ROM.

  • What are the permissions of the WhatsApp folder? Nov 22 '19 at 9:31
  • mount -o bind /storage/6333-6461/WhatsApp /storage/emulated/0/6333-6461/WhatsApp
    – alecxs
    Nov 23 '19 at 1:44
  • @alecxs I have tried that; WhatsApp cannot even read previously downloaded data, let aside write data. Nov 23 '19 at 5:54
  • must be written for older android days when external sd was just named sdcard1, so don't know for sure it works. i just created a empty file .sdcard1 in the WhatsApp folder to let the script know sdcard1 should be bind mounted mediafire.com/file/l6fz52s6n1cgbjh/whatsapp2sd.zip i was wrong it wasn't /storage and i believe it only worked on early stage (as init.d script)
    – alecxs
    Nov 23 '19 at 14:03
  • mount -o bind /mnt/media_rw/6333-6461/WhatsApp /data/media/0/WhatsApp
    – alecxs
    Nov 23 '19 at 14:05

Why can't WhatsApp write to bind mounts?

# mount -o bind /mnt/runtime/write/6333-6461/WhatsApp /mnt/runtime/write/emulated/0/WhatsApp

Apps cannot directly access /mnt/runtime/write/6333-6461 or /mnt/runtime/write/emulated/0/ because /mnt/runtime is only traverse-able by root. Apps access /storage/emulated/0 or /sdcard (symlink to the former) which is bind-mounted to /mnt/runtime/write/emulated/0/ for apps with WRITE_EXTERNAL_STORAGE permission. External SD card is accessible at /storage/6333-6461 in the same way.

When /mnt/runtime/write/6333-6461/WhatsApp is bind-mounted at /mnt/runtime/write/emulated/0/WhatsApp, WhatsApp will actually try to write to external SD card which is not allowed at least since Android 4.4. This is controlled by using permissions READ|WRITE_EXTERNAL_STORAGE / READ|WRITE_MEDIA_STORAGE, GID everybody (9997) / media_rw (1023) and mount namespaces. See details in How to move files to external SD card?.

Any solution to the problem?

There are some workarounds to set required permissions using FUSE or sdcardfs when bind mounting external directories. For details see How to bind mount a folder inside /sdcard with correct permissions?

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.