[Galaxy S II Android Development] gundalbert:
!!! Do not do this, I'm having some issues now, whoch didn't show of at first. I will leave the post and the method here, in case someone else also wants to see if he can get it really done. (Issues: e.g. opening settings -> storage crashes settings)

Hi all,

my 2nd post in this thread.

I did some investigation on how to mount the external SD to /mnt /sdcard/external_sd which was also the content of my first post here:

http://xdaforums.com/showthread.php?p=25573167#post25573167

This was just a workaround using tasker, to execute a remount after boot.

I think I have a real solution now, only adb (or root explorer, ...) to edit some files is needed.

I will give you the HowTo here, if you are interested in why I did it this way and so on... just read on after the howto.

userinit.sh

Create the file /data/local/userinit.sh with following content:

#!/bin/sh

# mount sdcard with all options which are set by android MountService.
# user:system, group:sdcard_r (essential for media-scanning and so on)

#needed for: mounting external_sd to /mnt/sdcard/external_sd (defined in /etc/vold.fstab). /mnt/sdcard is treated by MountService after trying to mount /mnt/sdcard/external_sd
mount -o rw,dirsync,nosuid,nodev,noexec,relatime,umask=0702,allow_utime=0020,uid=1000,gid=1015 -t vfat /dev/block/mmcblk0p11 /mnt/sdcard

vold.fstab

Edit /etc/vold.fstab, change

/mnt/emmc

to

/mnt/sdcard/external_sd (make sure this directory exists)

Leave the mount for the internal_sd as it is. The MountService will check it, see it is already mounted and then redirect it to the media scanner ;-)

build.properties

same thin here, replace /mnt/emmc with /mnt/sdcard/external_sd (don't know if this is really needed, but I did it)

reboot

So, why do we need to "hack" this, instead of just adjusiting the vold.fstab file?

This is because the MountService class of the android framework for some reason first tries to mount /mnt/sdcard/external_sd whioch fails and then mounts /mnt/sdcard.

I did not get this thing to do it the right way ;-) But was to lazy to read and understand the implementation.

So, what we need to do is to make sure /mnt/sdcard is mounted before the MountService steps in.

For this I had a look on how the sdcard is mounted (options, user, group, ...)

Here is a sample output of my system:

...
/dev/block/vold/259:3 on /mnt/sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
...

A mount command to achieve this would be.

mount -o rw,dirsync,nosuid,nodev,noexec,relatime,umask=0702,allow_utime=0020,uid=1000,gid=1015 -t vfat /dev/block/mmcblk0p11 /mnt/sdcard

Looks pretty much the same, but I replaced the vold block (which does not exist when we are trying to boot) with the actual fat partition (Partition 11) on device mmcblk0.

Now we will have to make sure, we execute this during boot and before the MountService steps in. Fortunately, we already have a possibility to do this, MountService does it's work pretty late during a boot cycle.

If you have a look at /etc/init.d there are a few scripts in place, one of them is "90userinit", which will earch for a file userinit.sh located in /data/local and if it's present, execute it.

Here we place our mount command given above.

That's it.

It works for me, I hope this could help someone out by fixing the "issue" (I know it isn't really an issue, but it can be annoying f you are used to this structure).

Regards

gundalbert