1

(I posted this question on Stack Overflow before(https://stackoverflow.com/questions/42738392/android-mount-obb-to-external-sd-card-failed), then I found here may be a better place to post this question.)

I want to move a game's obb(1GB) to SD card. Copied the obb file to SD card, and symbolic link by:

su
ln -sf /storage/sdcard1/Android/obb/com.game /sdcard/Android/obb/com.game

but failed with "function not implemented".

I googled it, and got "some filesystem doesn't support symbolic link".

So I tried to use mount by command:

su
mount -o bind /storage/sdcard1/Android/obb/com.game /sdcard/Android/obb/com.game

but I found only root can see the files in the folder. Then I do:

cd /system/bin/
chmod 4777 ./toolbox #make anyone can use mount(in toolbox)
su u0_aXXX #the game's uid
mount -o bind /storage/sdcard1/Android/obb/com.game /sdcard/Android/obb/com.game
ls -l /sdcard/Android/obb/com.game
$ -rwxrwx--- u0_aXXX sdcard_r com.game.obb

But when I

cat /sdcard/Android/obb/com.game/com.game.obb
$ cat: /sdcard/…ame.obb permission denied

I'm using android5, any solution? Thanks.

0

(If you're finding how to move obb to external sdcard and mount it back to internal, here's the right place!) Finally I found the solution of this question by myself! The app can't access the obb by itself, it requires media_rw to access it. Found by lsof:

sdcard 340 media_rw 15 ??? ??? ??? ???
/data/media/obb/com.game/com.game.obb
sdcard 340 media_rw 17 ??? ??? ??? ???
/data/media/obb/com.game/com.game.obb
com.game 26335 u0_a266 36 ??? ??? ??? ???
/storage/emulated/0/Android/obb/com.game/com.game.obb
com.game 26335 u0_a266 37 ??? ??? ??? ???
/storage/emulated/0/Android/obb/com.game/com.game.obb 

So I have to mount the external sdcard folder to two places and each has to have its right owner:

owner    folder
u0_a266  /storage/emulated/legacy/Android/obb/com.game
media_rw /data/media/obb/com.game

But if I mount /storage/sdcard1/Android/obb/com.game to those two places, it will become:

owner    folder
u0_a266  /storage/emulated/legacy/Android/obb/com.game
u0_a266  /data/media/obb/com.game

Then I found if I do:

mount -o bind /storage/sdcard1/Android/obb/com.game /storage/emulated/legacy/Android/obb/com.game
mount -o bind /mnt/media_rw/sdcard1/Android/obb/com.game /data/media/obb/com.game

I found this works fine, because the mount command's source and destination is their original owner. The app can run very well!

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.