[Solved] Mounting ext. sdcard folders to int. sdcard

obicom

Senior Member
Nov 9, 2010
283
81
0
Cologne
Hi folks,

As you know, the Sony media and video player didn't show the mp3 and videos on the external SD card in his library.
Now my idea was to mount folders of the external sdcard into folders on the internal sdcard.

Solution:
I created a script for mounting photo, video and music folders from ext. sdcard to the corresponding folders on the int. sdcard. After successful tests, I implemented init.d support on my Tablet S for a 'autostart' solution at boot time and moved the script to 'init.d' folder. For me it works great and fulfilled my requirements 100%.

Enclosed the content of my 'automount' script:

#!/system/bin/sh
# need sleep 75 for right timing maybe you can reduce it to 30
sleep 75
mount -o bind /mnt/sdcard2/Music /mnt/sdcard/Music
mount -o bind /mnt/sdcard2/Video /mnt/sdcard/VIDEO
mount -o bind /mnt/sdcard2/Fotos /mnt/sdcard/Pictures
Here you can find my [HOW_TO] for init.d support:
http://forum.xda-developers.com/showthread.php?t=1505340

P.S.: If it do not work for you, try to increase the sleep value. If you have a 'fresh' system 30 should be enough ... if you use two or three widgets 'sleep 75' could be ok ... and so on ...
 
Last edited:

obicom

Senior Member
Nov 9, 2010
283
81
0
Cologne
But I guess the change of the mount point in the /etc/svold.fstab is particularly promising. I still waiting for a rating of a expert. No one here?
 

haenraets

Senior Member
Aug 14, 2009
174
36
0
Halen
Changed that line in true, rebooted.
Openend up Poweramp and this had to scan my folders again.
Sd Card still there and working but nothing more I think.
Can't really see if there's anything changed.
 

Ilmoran

Senior Member
Sep 4, 2010
50
4
0
I tried:

Removing nosdcard from ro.build.characteristics
Changing ro.external.storage.removable to true
Changing ro.separated.external.storage to false

I haven't been able to see any difference.
Things I looked at:
The stock video player won't recognize videos on my SD card.
Videos on SD card will play if I navigate to them using Root Explorer
I can move apps to SD card using Titanium Backup, and play them from the SD card.

Anyone have some tips on what else I can look for?
 

obicom

Senior Member
Nov 9, 2010
283
81
0
Cologne
50% Solution

Hi guys,

I tried a other way (and more secure) from a hint in an other forum.
If you use the following command with adb or a app like "scripter" on your tablet,
you will mount the external card into the internal, but step by step:

1. create a new folder /external_sd under /mnt/scard/
e.g. with adb shell : mkdir -p /mnt/sdcard/external_sd
2. then mount the /mnt/sdcard2 to this folder
e.g. with adb shell: mount -o bind /mnt/sdcard2 /mnt/sdcard/external_sd
3. now it is done and if you now refresh your media library, you will find all your media stuff on your media player.

Unfortunately you have to do the same after a reboot or switch off/on.
I am a little bit afraid to add this command line in init.rc or something else.
Do one of you have a proposal how we can make it permanent, without a risk?
 
  • Like
Reactions: CtrlY

condi

Senior Member
Feb 13, 2007
743
980
123
Hi guys,

I tried a other way (and more secure) from a hint in an other forum.
If you use the following command with adb or a app like "scripter" on your tablet,
you will mount the external card into the internal, but step by step:

1. create a new folder /external_sd under /mnt/scard/
e.g. with adb shell : mkdir -p /mnt/sdcard/external_sd
2. then mount the /mnt/sdcard2 to this folder
e.g. with adb shell: mount -o bind /mnt/sdcard2 /mnt/sdcard/external_sd
3. now it is done and if you now refresh your media library, you will find all your media stuff on your media player.

Unfortunately you have to do the same after a reboot or switch off/on.
I am a little bit afraid to add this command line in init.rc or something else.
Do one of you have a proposal how we can make it permanent, without a risk?
I will check it for you if you want ;) but after work, evening
 
  • Like
Reactions: zaynal and obicom

obicom

Senior Member
Nov 9, 2010
283
81
0
Cologne
These are good news :)
I am sure for you it is a "child's play", but I think helpful for all of us.
Please let me know if I can test something ...

THANKS IN ADVANCE !

-- Edit --

Maybe we can add this command to rescan media files after mount command:

mount -o bind /mnt/sdcard2 /mnt/sdcard/external_sd
pm enable com.android.providers.media/com.android.providers.media.MediaScannerReceiver
 
Last edited:
  • Like
Reactions: condi

ps3taker

Senior Member
May 4, 2011
512
43
0
London
Link2SD

If you want app data to be moved to external sd Link2Sd works but with a few extra steps only. Here is how I manage this on mine.

Installed Link2SD on tablet.

Formatted external card (in my case a 32GB microsd in an SD adapter) on my laptop using EASEUS to have to PRIMARY partitions 1st in FAT32 and second in EXT3 formats.

At first Link2SD does not recognise any ext partition present and if I try to recreate mounting script on it telling it EXT3 format it says something like could not do, directory does not exist or similar.

Then after a reboot Link2sd warning pops up saying the sd card was not mounted at boot and therefore the system did not load apps on it. You have an option to recreate a mounting script (which I did not need to do as did it already previously) and the quick reboot option (which is different from the regular reboot in the way that it only restarts the android interface not the whole hardware) - so I do this reboot and after everything starts you can see the extra partition and use it.

So currently quick reboot is needed after every total shutdown of the tablet - thankfully I almost never shut down the tablet completely unless run out of battery completely or some other rare reason or testing like this one.

Also note that quick reboot sometimes gives a close/wait warning just after it is done - I always chose wait and everything seemed ok after that.

Make sure you give Link2sd superuser permission. I decided to leave out Lib out of the app data I link because I noticed that if I move data back to internal storage link2SD shows that libs are unlinked already/ I know there is an option in link2sd to relink libs at boot but I was not able to confirm if it works and they tend to take little space internally anyway.

Regarding extra partition size I tried less than 1GB and ca 14Gb. With bigger than 1GB partition it seems to recognise its size in link2sd but once you move more than 1gb data to it does not reflect the increase above 1gb but still seems to make the apps I moved before and after that work still.

I wonder if multi mount widget could help when combined with link2SD somehow. My guess best solution would be to make android mount external card early in its boot.

Hope it helps
 

obicom

Senior Member
Nov 9, 2010
283
81
0
Cologne
I tried today several things ....

@ps3taker
that sound a little bit more complicated then my solution with app scripter and the mount command.

I tried today several things to get a "autostart" solution but unfortunately without success:

- App "autostart (root)" don't work on Tablet S
- Change in svold.fstab need sd card eject and insert to be mounted after rboot
- Change in vold.fstab need sd card eject and insert to be mounted after reboot
- Add mount command in init.goldfish.sh don't work
- Startup script tweaks can't work, no "/system/bin/playlogosnow" on Tablet S
(http://forum.xda-developers.com/showthread.php?t=813309)

Someone additional ideas for a autostart option for the mount command? :confused:

-- Edit --

I did a little bit more investigations and find out, that after a reboot it needs a short time before the internal sd card is ready to use. Therefore it is senseless to search a solution during boot time. I guess this is the reason why the change in svold.fstab and vold.fstab didn't work.

That means we need a "autostart" App, as a Widget or a Virus scanner that mount the device and rescan the medias. Who is willing and to do that for us?
 
Last edited:

DooMLoRD

Inactive Recognized Developer
Jul 27, 2010
13,194
39,692
113
Pune
just create an init.d script and symlink the ext_sd folder to the desired folder on sdcard...


check if this device has:
/system/etc/install-recovery.sh

if it doesnt then check if the /init.rc (or other init.*.rc) files contain the text "install-recovery.sh"

if the text exists then just create the file /system/etc/install-recovery.sh which has the following at the top:
Code:
#!/system/bin/sh
followed by the symlink/bind code

and save file and give it 777 permission (chmod 777 /system/etc/install-recovery.sh)

that should automatically run the desired commands at each boot...


if the above is not possible then just create a GScipt script and execute it at startup
 

condi

Senior Member
Feb 13, 2007
743
980
123
just create an init.d script and symlink the ext_sd folder to the desired folder on sdcard...
Hi DooMLoRD,

symlink will not work - because of fat32 sdcard! We've got to use mount -o bind, it works without problem, about autorun thing - thanks - i've got to try it :)

br
condi
 

obicom

Senior Member
Nov 9, 2010
283
81
0
Cologne
@DooMLoRD & Condi

I did exactly this in my tests before, with the "install-recovery.sh".
The file "/system/etc/install-recovery.sh" don't exist but the the "init.rc" files contains the text "install-recovery.sh".

So I created the file "/system/etc/install-recovery.sh" with the commands:

#!/system/bin/sh
mount -o bind /mnt/sdcard2 /mnt/sdcard/external_sd
and give it 777 permission but unfortunately it dosen't work. :(

I guess the reason is the timing problem, that sdcard mount is not ready in this moment. I will try tomorrow add first the mount command for "/mnt/sdcard" in this file and will see what will happen.

Keep you informed.
 

ps3taker

Senior Member
May 4, 2011
512
43
0
London
thank you all for trying.

Could you please summarise what works currently please.
a) Do you manage to link apps to external sd as in rooted gingerbread?
b) or is it just for showing external sd media in the native player in a separate subfolder or something similar
c) do you manage to swap around external and internal sds, i.e. mnt\sdcard is now external as on gingebread and mnt\sdcard2 is the built-in/internal one

I think all of the above is useful but would like to know what's the initial plan.
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone