4

I am trying to mount an EXT4 formatted SD card under Cyanogenmod 13.1 (Android 6.0.1).

So far, I have setup scripts to mount the card at /mnt/ext_sdcard during boot. My current understanding is that the "sdcard" service must then be invoked to create a FUSE mount pointing to the real mount point which will eventually lead the media scanner to the newly mounted disk.

Following some older older documentation and forum threads lead me to this command in terminal:

service sdcard /system/bin/sdcard /mnt/ext_sdcard /mnt/test 1023 1023
    class late_start

When I run the command (as root of course), it fails with an exit status of 1 and no output/error messages.

My question: Am I doing something wrong, or is this command deprecated in 6.0.1 (the documents/forum thread seemed to relate to KitKat)? What is the correct syntax/arguments for using this command?

2 Answers 2

0

Are you putting this command in an init.*.rc file? My understanding is you would have this in a init.extmount.rc for example. This requires extracting and repacking the boot.img.

Since I had nothing better to do, I created this: https://github.com/BenBaltz/mountext

Its a recovery flashable zip to install your script by unpacking the boot.img and repacking it with the modifications.

EDIT Terminal commands

su -c mount -o bind /mnt/ext_sdcard /path/to/new/dir
7
  • Thanks Ben, I'll check out your script. Also, yes I am using this command in the main init.rc file currently
    – Jake
    Jan 20, 2017 at 12:11
  • I tried your command in init.mountext..rc and I got service: Unknown command sdcard. Then I tried service call sdcard... which returned Service sdcard does not exist. Also I found two running instances of sdcard on my system and found they were invoked with /system/bin/sdcard -u1023 -g1023 -U0 /mnt/media_rw/8005-91F9 8005-91F9. Does this command vary between Android ROM's?
    – Jake
    Jan 20, 2017 at 12:23
  • @Jake I don't see anything after 'I got'.
    – Ben Baltz
    Jan 20, 2017 at 12:26
  • @Jake This is what the bootlogs said? You have to reboot for it to be run.
    – Ben Baltz
    Jan 20, 2017 at 12:29
  • No, I ran it directly in terminal (as root). I'd rather run them in terminal until I'm sure they work rather than patching system files.
    – Jake
    Jan 20, 2017 at 12:31
0

In Android 6+ storage configuration:

Mounting of physical external storage volumes is handled by vold, which performs staging operations to prepare the media before exposing it to apps.
...
The hard-coded FUSE services have been removed from device-specific init.rc files and are instead forked dynamically from vold when needed.

So the sdcard services defined in *.rc files are no more required, neither storage_list.xml is maintained inside framework-res.apk. Instead vold completely manages the storage devices defined with flag voldmanaged= in fstab. See more details in Android's Storage Journey.

In Android 9 FUSE support was completely removed from sdcard binary replaced with sdcardfs. sdcardfs can be mounted directly using mount command, so sdcard isn't necessarily required. However from Android 6 to 8 sdcard binary should mount an emulated filesystem if executed with proper arguments. You can see the failure log in logcat.

Also you can use a third party FUSE-based tool bindfs to achieve the same. See details in How to bind mount a folder inside /sdcard with correct permissions?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .