I want to run the following command as root in the Android Terminal Emulator.
mount -o bind /storage/extSdCard /data/media
I have tested this on a Samsung Galaxy S3 running CyanogenMod 11 and it works as expected. When I enter /data/media
using another app like ES File Explorer file manager, I get to the contents of the external SD-card instead of the internal memory.
The problem is that this doesn't work on another S3 I have, this one running stock TouchWiz ROM version 4.3 and rooted with CF-Auto-Root. I have also tried using Adam's Custom kernel and it doesn't work either.
When I run the command on the terminal and then type ls /data/media
as root, it shows the external SD-card's content, but if I launch another terminal as a normal user (non root) and type the same command, I get the contents of the internal memory. Same thing happens if I try to access /data/media
using ES File Explorer file manager
So it seems that root commands only have effect for the root user, not for other users system-wide. What could be the cause of this behavior?
UPDATE:
OK, my bad, I didn't express myself correctly. It is true that a normal user can't access /data/media
. But /data/media
is the true location of the files in the internal memory. There are lots of paths where android makes this memory available for normal users, like /sdcard
or /storage/sdcard0
, both of which point to /data/media/0
through a FUSE filesystem.
My though here is that if I create a folder named 0
on the external sd and then bind /storage/extSdCard
to /data/media
, when the system tries to access /sdcard
or /storage/sdcard0
it will get the contents of /storage/extSdCard/0
as /data/media
no longer points to internal memory, but to external sd instead.
This works as expected on CM11 when I run as root
mount -o bind /storage/extSdCard /data/media
Then if I access /sdcard
on the terminal, either as root and as normal user, I get to the contents of /storage/extSdCard/0
. Same thing happens if I use ES File Explorer on normal or root modes
But when I do the same on rooted stock 4.3 firmware it doesn't work. Only root on the terminal can see the changes, normal user on the terminal and normal and root user on ES File Explorer will see no change
I get the contents of the internal memory.)
-- I don't get it how a normal user is even able to see any content in/data/media
at all without elevated privileges. You should get an error in terminal, something like "Operation not permitted". About your 2nd case with ES, as a normal user ES shouldn't be showing anything in/data
directory and I do not know how to go to a certain location directly using ES (it doesn't seem to have location bar). That said,/data/media
can still be accessed by a normal user using Terminal. I checked it, works well.