Sunday, December 27, 2020

Mounting external SDCARD for WhatsApp

The way how WhatsApp using sent and received messages writing everything to internal sd card is very unfortunate for phones with small amount of build in memory. There is no default option to provide another path for Media files.

Since Android have mount folders capability the first try was to use bindfs from here: https://github.com/agnostic-apollo/bindfs/releases/tag/v1.0

DIR=/mnt/media_rw/[SD_CARD_FOLDER_NAME]

/mnt/bindfs-armeabi-v7a -o nonempty,nosuid,nodev,noexec,noatime,context=u:object_r:vfat: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 $DIR/WhatsApp /mnt/runtime/write/emulated/0/WhatsApp

But this approach were showing folders in /mnt/runtime/write/emulated/0/WhatsApp only for command prompt which was started from the phone itself, even starting the

Lucky Patcher Directory Binder were working only for default browser, but X-plore, for example, were not showing the mounted folder files and WhatsApp were not picking this either.
Here is a tutorial: https://proandroidgeek.blogspot.com/2015/04/how-to-use-directory-binder-in-lucky.html

However, using builtin mount command did the trick:

mount -t sdcardfs -o nosuid,nodev,noexec,noatime,mask=7,gid=9997 /mnt/media_rw/[SD_CARD_NAME]/WhatsApp /mnt/runtime/write/emulated/0/WhatsApp

This allowed WhatsApp to write/read using external sd card. Command could be set as a startup script in Tasker, for example, or placed in init.d, which is harder, but also could be as an option.

Note: at the moment of writing this post these commands were tested only on Samsung Note 4 with Marshmallow, SuperSU.

No comments:

Post a Comment