1of2

How can I bind mount e.g. /system/sd/xxx /sdcard/xxx

Recommended Posts

1of2    0

Ho all,

I've rooted my desire with r3 and all is well, however I still have a few questions (I'm a noob on Android)

I have partitioned 14G mounted @ /system/sd (ext3) and 1.5G mounted /sdcard (vfat)

Ideally, I'd like to get rid of vfat altogether and just have single ext3/4 partition and bind mount /sdcard to /system/sd/sdcard, bhut that is the future, For now, I'm trying to figure out how I can add the following two commands to the start up init.

mount /system/sd/music /sdcard/mp3 -o bind

mount /system/sd/photos /sdcard/dcim -o bind

I want the default apps (music player and camera to access the larger partition and not the vfat).

Also, somewhere during bootup (before /sdcard is mounted), the system does an fsck -t vfat /sdcard (actually the /dev/ name), we need to add fsck -t ext3 to the /dev/block/mmcblk0p2 because if you lose power, you can corrupt the ext3 fs and fsck must be performed the phone will not boot.

Anyone know were this is mounted from ?

Thanks.

Albert.

Edited by 1of2

Share this post


Link to post
Share on other sites
burst    0
Ho all,

I've rooted my desire with r3 and all is well, however I still have a few questions (I'm a noob on Android)

I have partitioned 14G mounted @ /system/sd (ext3) and 1.5G mounted /sdcard (vfat)

Ideally, I'd like to get rid of vfat altogether and just have single ext3/4 partition and bind mount /sdcard to /system/sd/sdcard, bhut that is the future, For now, I'm trying to figure out how I can add the following two commands to the start up init.

mount /system/sd/music /sdcard/mp3 -o bind

mount /system/sd/photos /sdcard/dcim -o bind

I want the default apps (music player and camera to access the larger partition and not the vfat).

Also, somewhere during bootup (before /sdcard is mounted), the system does an fsck -t vfat /sdcard (actually the /dev/ name), we need to add fsck -t ext3 to the /dev/block/mmcblk0p2 because if you lose power, you can corrupt the ext3 fs and fsck must be performed the phone will not boot.

Anyone know were this is mounted from ?

Thanks.

Albert.

set symlinks?

in recovery:

adb shell

ln -s /system/sd/music /sdcard/mp3

ln -s /system/sd/photos /sdcard/dcim

Edited by burst

Share this post


Link to post
Share on other sites
1of2    0
set symlinks?

in recovery:

adb shell

ln -s /system/sd/music /sdcard/mp3

ln -s /system/sd/photos /sdcard/dcim

you cannot symlink from vfat ?

Share this post


Link to post
Share on other sites
ddvo    0

This is how to got automounting an ext3 data partition on the SD card to work on my HTC Desire running 2.2 (Froyo).

I formatted the card with a tiny (50 MB), essentially unused, vfat partition - just in case Froyo insists in finding/mounting it - and all the rest with a single large ext3 (or ext2 or ext4) partition.

I use the latter partition flexibly both for data (in a directory "/card", which I bind mount to "/sdcard" as described below) and for app storage (in directories "/app", "/app-private", and "/dalvik-cache", which are sym-linked from "/data/app" etc. using "/etc/init.d/02stuff2sd" - attached -, which is some older version of http://pastebin.com/8LJj8rVz).

Since the /etc/init.d/02stuff2sd script already mounts at boot time the ext3 partition to /system/sd, I just added a second script as /etc/init.d/20autostart, which essentially bind mounts the "/system/sd/card" directory of the ext3 partition to the /sdcard directory:

busybox mount -o bind /system/sd/card /sdcard
Optionally, one may remount the "/sdcard" directory with stricter security settings:
busybox mount -o remount,nosuid,nodev,noexec,rw,errors=remount-ro,dirsync,relatime /mnt/sdcard
where unfortunately it is not possible to give the following extra parameters, which would give uniform access rights to all files:
uid=1000,gid=1015,fmask=0113,dmask=0002,allow_utime=0020
It turned out that that android.process.media (app_21) messes with the access rights of the photos taken by com.android.camera (app_42) and stored as /sdcard/DCIM/100MEDIA/IMAG0001.jpg etc., which does not surface when DCIM is part of the vfat partition because there is essentially no access right restrictions. As a workaround for the ext3 partition, to prevent errors like "no photos or videos found", my boot script additionally does
chmod 666 /sdcard/DCIM/*/*

One caveat: after unmounting the SD card directory /sdcard, mounting it again via the regular Froyo user menu results in the vfat partition being mounted instead of /system/sd/card . So either you need to mount it manually via the terminal emulator (or via adb), or simply re-boot.

02stuff2sd.txt

Edited by ddvo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


MoDaCo is part of the MoDaCo.network, © Paul O'Brien 2002-2016. MoDaCo uses IntelliTxt technology.