I am trying to mount WhatsApp media directory from portable SD to internal "SD", as the phone internal storage is very limited.
My phone: Sony Xperia XZ1 Compact (32GB internal storage, 128GB external SD card), Pie 9.0, stock image, bootloader unlocked, dm-verity, and SElinux enforcing. Magisk 20.1 (mount Namespace Mode= Global Namespace). bindfs v.1.14.2.
I have read and tried what is shown in these threads:
- How to bind-mount "data" and "obb" folders from external SD card in "/sdcard/Android"?
- How can I make a symlink (or equivalent) inside /storage/emulated/0?
- How to bind mount a folder inside /sdcard with correct permissions?
- Why can't WhatsApp write to bind mounts?
Output of /proc/filesystems
nodev sysfs
nodev rootfs
nodev ramfs
nodev bdev
nodev proc
nodev cpuset
nodev cgroup
nodev cgroup2
nodev tmpfs
nodev configfs
nodev debugfs
nodev tracefs
nodev sockfs
nodev pipefs
nodev devpts
ext3
ext2
ext4
vfat
msdos
nodev ecryptfs
nodev sdcardfs
fuseblk
nodev fuse
nodev fusectl
f2fs
nodev pstore
nodev selinuxfs
texfat
nodev functionfs
The last relevant lines of output from mount -r ....
/data/media on /mnt/runtime/default/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid,default_normal)
/data/media on /storage/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,multiuser,mask=6,derive_gid,default_normal)
/data/media on /mnt/runtime/read/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=23,derive_gid,default_normal)
/data/media on /mnt/runtime/write/emulated type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,multiuser,mask=7,derive_gid,default_normal)
/dev/block/sda60 on /mnt/qns type ext4 (rw,seclabel,nosuid,nodev,noexec,noatime,discard,data=ordered)
/dev/block/vold/public:179,1 on /mnt/media_rw/6534-3933 type texfat (rw,dirsync,nosuid,nodev,noexec,noatime,uid=1023,gid=1023,umask=0007,allow_utime=0020,utf8,min_prealloc_size=64k,max_prealloc_size=121910k,writeback_boundary=4M,readahead=4M,fail_safe,discard,hidden=show,errors=continue)
/mnt/media_rw/6534-3933 on /mnt/runtime/default/6534-3933 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6,nocache)
/mnt/media_rw/6534-3933 on /storage/6534-3933 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=1015,mask=6,nocache)
/mnt/media_rw/6534-3933 on /mnt/runtime/read/6534-3933 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18,nocache)
/mnt/media_rw/6534-3933 on /mnt/runtime/write/6534-3933 type sdcardfs (rw,nosuid,nodev,noexec,noatime,fsuid=1023,fsgid=1023,gid=9997,mask=18,nocache)
The output of proposed command:
bindfs -u u0_a195 -g 9997 -p a-rwx,ug+rw,ug+X /mnt/media_rw/6534-3933/WhatsApp/Media /mnt/runtime/write/emulated/0/WhatsApp/Media
Gives me the following error:
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
I then add the nonempty string to the command, and then the external SD card directory mounts as "internal".
The new lines from mount -r now reads:
/mnt/media_rw/6534-3933/WhatsApp/Media on /mnt/runtime/write/emulated/0/WhatsApp/Media type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
/mnt/media_rw/6534-3933/WhatsApp/Media on /storage/emulated/0/WhatsApp/Media type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
/mnt/media_rw/6534-3933/WhatsApp/Media on /mnt/runtime/default/emulated/0/WhatsApp/Media type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
/mnt/media_rw/6534-3933/WhatsApp/Media on /mnt/runtime/read/emulated/0/WhatsApp/Media type fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other)
WhatsApp does READ all the files correctly, however I cannot download anything new to the drive. This is frustrating as hell, as I have come to this stage before. I just can seem to find out how to make WhatsApp being able to WRITE to the directory.
I have used apps like apps2sd, ts-bind, fbind, mount options. Anything under the sun. I can never reach a stage longer than WhatsApp being "tricked" to read from external SD, but never being able to write to external SD.
The only working solution, is not a viable solution, is to install experimental xposed, install old module xinternalSD, and magisk module "ExSDCard Access Enabler". Then WhatsApp works perfectly, but I believe this is a very unstable for the rest of my system and my phone. And I would really like to have a more clean solution to this problem, like the one you are proposing.
Please assist in this great great headache.
Last note, also tried the command as given from your other post:
bindfs -o nosuid,nodev,noexec,noatime,context=u:object_r:sdcardfs:s0 -u 0 -g 9997 -p a-rwx,ug+rw,ugo+X --create-with-perms=a-rwx,ug+rw,ugo+X --xattr-none --chown-ignore --chgrp-ignore --chmod-ignore /mnt/media_rw/6534-3933/WhatsApp/Media /mnt/runtime/write/emulated/0/WhatsApp/Media
Same result after adding nonempty option, WhatsApp can read from external SD, but cannot write to it.