简体   繁体   English

Android挂载obb到外部SD卡失败

[英]Android mount obb to external SD card failed

I want to move a game's obb(1GB) to SD card. 我想将游戏的obb(1GB)移动到SD卡。 Copied the obb file to SD card, and symbolic link by: 将obb文件复制到SD卡,并通过以下符号链接:

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: 所以我尝试使用mount by命令:

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. 但我发现只有root才能看到文件夹中的文件。 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? 我正在使用android5,任何解决方案? Thanks. 谢谢。

(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! (如果你正在寻找如何将obb移动到外部SD卡并将其重新安装到内部,这里是正确的地方!)最后我自己找到了这个问题的解决方案! The app can't access the obb by itself, it requires media_rw to access it. 应用程序无法自行访问obb,它需要media_rw才能访问它。 Found by lsof: 由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: 所以我必须将外部sdcard文件夹挂载到两个地方,每个地方必须拥有正确的所有者:

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: 但如果我将/storage/sdcard1/Android/obb/com.game挂载到这两个地方,它将成为:

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. 我发现这很好用,因为mount命令的源和目标是它们的原始所有者。 The app can run very well! 该应用程序可以运行得很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM