Unfortunately, since Android 4.2 it is no longer possible on most device to mount a folder and make it available to other apps as well.
The details on how this works and why this was changed can be found here: Fix for empty app-mounted directories (CifsManager, etc.) in Android 4.2.
The page mentioned above says this:
Originally Posted by Zygote patch commit message
Zygote: Restrict slave mountspace so Dalvik apps can mount system-wide volumes
Android 4.2 implements multi-user storage using per-process mount namespaces. Originally, everything under "/" (the entire filesystem hierarchy) is marked as a recursive-slave mountspace for all zygote instances. This is done so that user-storage sandbox mounts under /storage/emulated are hidden from other apps and users.
Unfortunately this means that any Dalvik app (actually, any program whose clone/fork ancestry includes a Dalvik zygote, which is everything except services spawned directly from init) cannot mount system-wide volumes. Thus, apps like CifsManager are effectively broken in Android 4.2, since its cifs mounts are only visible to the CifsManager app itself. All other apps see empty mountpoints instead of the mounted volume. Furthermore, Linux provides no provision for a process to "escape" a recursive-slave mountspace in versions prior to Linux 3.8 (setns syscall).
Here, we restrict the slave mountspace to /storage (and, due to a possible kernel bug, /mnt/shell/emulated) so that Dalvik apps can mount system-wide volumes elsewhere (with appropriate permission, as in earlier versions of Android), while retaining full multi-user storage compatibility.
This change requires that a tmpfs volume is mounted as /storage in init.rc. If this volume is unavailable, then Zygote falls back to the previous behavior of marking the entire filesystem hierarchy as slave. It also implicitly requires that EMULATED_STORAGE_TARGET is path-prefixed by (part of the subhierarchy of) ANDROID_STORAGE, which is the typical case.
What it comes down to is that if apps mount a directory or block device, the mounted directory should only be visible for the apps that did the mount unless the app has special permissions, which are not generally available to non-system apps. And even if you manage to mount the directory globally, the Linux permissions will still get in your way.
Therefore, mounting is probably not the easiest solution to your problem, but if you really want to use mounts you should be able to add the commands to /system/bin/debuggerd
and then (as root) enter start debuggerd
to execute your own script with system privileges.
There is an easier way to work around the read only problems though, either by installing this app or by manually adding the media_rw
group to the WRITE_EXTERNAL_STORAGE
in the permissions file. This allow apps that have permission to write to the emulated SD card to also write to the 'external' SD card.
After making your external storage writeable, you should be able to use symlinks (ln -s /sdcard/MyPics /sdcard/DCIM/Camera
) to allow quick access to these directories.
ln -s
?ln -s /sdcard/MyPics /sdcard/DCIM/Camera
. You'll need to move the Camera folder first. – keepcalm May 15 '15 at 6:36