Friday, April 3, 2015

mount - External Ext4 card mounted only for root (!) on Android 5.1 64 bits


In short: if I mount my Ext4 8GB SD card, only root (SU) can see it. The rest of users (so, the rest of apps) don't detect it.


As long as my Ext4 SD card is not correctly mounted (Android always yields Damaged SD card. Format it... blah blah blah), I followed this guide to mount it. And it works:



SD Card is at /dev/block/mmcblk1, so first partition is at /dev/block/mmcblk1p1.
I performed the (not very clear for me) prior ADB process:


su
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
start adbd
HOME=/sdcard adb start-server
adb connect localhost
adb -s localhost:5555 shell

exit
stop adbd
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
start adbd

And then the card is correctly mounted by doing (as root):


# mount -t ext4 /dev/block/mmcblk1p1 /storage/extSdCard && sleep 5 && /system/bin/vold

Note how it works as SU but not as normal user:


root@unknown:/ # ls /storage/sdcard1

lost+found
root@unknown:/ # exit
u0_a98@unknown:/ $ ls /storage/sdcard1
ls: can't open '/storage/sdcard1': Permission denied

I have tested the above steps via SSH (remote shell).
The SD Card has been formatted from Windows using Minitool Partition Wizard.


I have tested too:



  • Editing the /system/etc/permissions/platform.xml file manually (adding ) to WRITE_EXTERNAL_STORAGE section, as referred here.


  • SDFix.

  • Using Xposed framework with HandleExternalStorage module.


But the apps (Total Commander, Ghost Commander, or any other program) have no access to the Ext4 SDCard.


What else could I try?
Workarounds to make apps read (and write) SD Card accepted too.


Extra data 1:


Note the output of the mount command for both users:


root@unknown:/ # mount | grep "sdcard" -i
/dev/block/mmcblk1p1 /storage/sdcard1 ext4 rw,seclabel,relatime,data=ordered 0 0

root@unknown:/ # exit
u0_a98@unknown:/ $ mount | grep "sdcard"
u0_a98@unknown:/ $ mount | grep "mmcblk"

As can be seen, the root user has a mounted device that the normal user has not (!). I did not know this could happen on Linux.




No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...