• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [Guide] Mounting /mnt/sdcard/external_sd back at /mnt/sdcard (version 1)

Sepero

Linux Guru
Aug 26, 2010
963
594
==================================================
A Newer Version of This Guide has been created here:
http://androidforums.com/motion-4g-...d-mnt-sdcard-v2-lg-motion-4g.html#post5346153

This Original Guide will continue to exist for reference purposes.
==================================================



This guide is for moving your REAL sdcard to the location /mnt/sdcard (as GOD INTENDED ;))


REASON:
I prefer to have all possible files stored on the sdcard, as it is a much safer form of storage. If your device is smashed, burned, or gets wet, the OS won't boot- all internal files are lost. Period. (suck it, iFruit users) If your files are on sdcard, just pull sdcard out and put it in another device. Bingo, fully recovered! Also, it leaves a huge internal storage alone for installing as many apps as you want.
(I have contacted the developer of the "directory bind" program to allow this functionality, but they have not yet written back to me.)


REQUIREMENTS:
This guide requires your device is rooted, and the app Script Manager Free (if anyone knows of a smaller open source app that will run a script after boot, please let me know). This should be perfectly safe if you follow the directions well. If you have any problems, just disable the script and reboot your device as normal.

Note: If you are using the directory bind app to do a similar thing, then you should turn it off (unless you know better). This guide is meant to fully replace binding multiple directories to the sdcard.


BEGIN:


  1. Download the script remountsd.sh to your sdcard (/mnt/sdcard/external_sd/)
  2. Start Script Manager
  3. When Script Manager asks for Root Permissions, grant yes allow.
  4. Go to the script file and tap on it to see a menu
  5. Select the icons at the top labeled "Fav" "Su" "Boot" "Ntfy"
  6. On the same screen, make sure "is script" is chosen
  7. Tap "Save" on the top right and exit Script Manager
  8. Reboot your device
  9. On reboot, it should create 2 directories on your sdcard: external_sd and internal_fs

VERIFYING IT WORKED:
The result will have your sdcard mounted at /mnt/sdcard and a mirror at /mnt/sdcard/external_sd. This way if a program tries to access the old location, it's still available.

Your former internal location (/mnt/sdcard) will be at the new location /mnt/sdcard/internal_fs. Just copy over any (all) files and directories to your sdcard as needed.


UNDOING THINGS: (if you change your mind)
If you do any One of these things, and it will stop relocating your sdcard.

  • Open Script Mangager, find the script and unselect the "Boot" icon.
  • OR temporarily rename the script file to remount.shh
  • OR boot your device with sdcard out, then put it in afterwards.
To permanently stop and uninstall it, just delete the script file, and uninstall Script Manager.



GLITCHES:
(Please post comments Confirming or Denying your experience of these glitches, or any you find.)

  • You CANNOT safely unmount your sdcard. To remove it safely, you must turn off your device. Otherwise you risk damaging any files that have been created or changed since you last booted.
  • Files will show twice in apps that automatically search your storage (like mp3 players, or picture viewers).
  • Camera/Camcorder might display, but not take pictures. - Fix by killing the Camera app and restarting it.
  • Setting your ringtone to a file on sdcard may cause it to revert to playing an internal ringtone. - Possible Fix? copy the ringtone to your default internal ringtone directory /system/media/audio/ringtones/
  • Gallery not listing all picture previews. - Fix by going into Apps Settings and erasing the Gallery cache. It will rebuild previews. (This glitch has only appeared to happen once.)
 
This guide is for moving your REAL sdcard to the location /dev/sdcard (as GOD INTENDED ;))

Reason:
I prefer to have all possible files stored on the sdcard, as it is a much safer form of storage. If your device is smashed, burned, or gets wet, the OS won't boot- all internal files are lost. Period. (suck it, iFruit users) If your files are on sdcard, just pull sdcard out and put it in another device. Bingo. Also, it leaves a huge internal storage for installing as many apps as you want.
(I have contacted the developer of the "directory bind" program to allow this functionality, but they have not yet gotten back to me.)


This guide requires your device is rooted, and a open source text editor like Jota, and the app Script Manager Free (if anyone knows of a smaller open source app that will run a script after boot, please let me know). This should be perfectly safe if you follow the directions well. If you have any problems, just disable the script and reboot your device as normal.


  1. Create 2 new directories on your sdcard named this
    /mnt/sdcard/external_sd/external_sd/
    /mnt/sdcard/external_sd/internal_fs/
  2. Use your editor to create a file named /mnt/sdcard/external_sd/remountsd.sh, and put this text in that file (NO TYPOS)
[HIGH]mount -o bind /mnt/sdcard/ /mnt/sdcard/external_sd/internal_fs/
mount -o move /mnt/sdcard/external_sd/ /mnt/sdcard/
mount -o bind /mnt/sdcard/ /mnt/sdcard/external_sd/
[/HIGH]
  1. Start Script Manager
  2. Go to the new file /mnt/sdcard/external_sd/remounsd.sh and click on it
  3. Select the icons at the top labeled "Fav" "Su" "Boot" "Ntfy"
  4. On the same screen, make sure "is script" is chosen
  5. Click "Save" on the top right and exit Script Manager
  6. Reboot your device
  7. When Script Manager asks for Root Permissions, choose yes allow.


The result will have your sdcard mounted at /mnt/sdcard and a mirror at /mnt/sdcard/external_sd. This way if a program tries to access the old location, it's still available.

Your former internal location (/mnt/sdcard) will be at the new location /mnt/sdcard/internal_fs. Just copy over any (all) files and directories to your sdcard as needed.

my only issue with this is....when does it bind it?...does it do it after the OS is booted or after the phone is booted?...

not that it matters much but if it was an init.d script i think it would work better...

also for running scripts, you can import and run custom scripts with Rom Toolbox...

(i feel like a salesman for jrummy on this board...but srsly...rom toolbox has pretty much every app you could need as a root user)
 
Upvote 0
@plasticarmyman
You gotta keep up to speed man. We (including you) already talked about this in an earlier thread. :D

Sadly it won't work as an init.d script because that's too early in the boot process. This method does rebinding just seconds after the home screen has appeared.

(BTW, no need to quote the whole OP. :eek: That's a huge wall of text lol. Also, I'll be sure check out Rom Toolbox and see what it's all about)
 
Upvote 0
Just as a warning, I appended a list of glitches to the OP. These have occurred to me since implementing the this old way of mounting. I also put how the glitches can be resolved. If anyone one else notices these, or any new glitches, please let us know. If you have figured out a new fix, be sure to include that too. Cheers
 
Upvote 0
This should solve the problem of having with trying to use Link2SD and it saying "Insufficient_Memory...." correct?

I believe I was asking about something similar in another thread, and it looks like this should work, directory bind has given me a bunch of trouble.

Unless I'm wrong this is going to
1) Boot up the phone
2) Bring up the OS
3) Bind all the internal folders to the SD Card
4) Run the phone thinking the SD card is the internal.
5) Pop out SD Card, put it in another phone, redo the OP and there's all your stuff right back? And using a 32Gig SD gives you a TON OF ROM.

This phone takes up to a 32G SD Card FYI
 
Upvote 0
So I followed the directions, and rebooted. Right after the boot, but before scanning of memory card directory bind started, and binded some things, and I saw that the script we made was executed because it shows in the notification bar.

So it looks like it works, but how can we tell for sure?

I have a 32g SD card, and always have trouble finding out if I'm getting my apps on that or not. When looking through Rom Toolbox or something it usually only shows the memory, and the internal memory.
 
Upvote 0
Good questions!

This should solve the problem of having with trying to use Link2SD and it saying "Insufficient_Memory...." correct?
Absolutely Yes

Also, this method will not replace your ENTIRE internal storage with the sdcard. All the apps you install from the market are saved in /data. In the LG Motion 4G, the /data and /mnt/sdcard are shared internal storage space (they occupy the same space). This method will change /mnt/sdcard to be your sdcard instead of shared internal storage.
Hopefully that answers that question.

This method does not work with the directory bind app, you have to use one or the other. You can tell if you succeeded moving the sdcard by looking into /mnt/sdcard/internal_fs. If you see files in there, then it very likely worked. Save a large file to /mnt/sdcard/, then check your sdcard storage to see if free space decreased.
 
Upvote 0
everyone, plasticarmyman, after testing further, I found that the sdcard CAN be mounted at init.d time (much earlier in the boot process), using "mount -t vfat /dev/block/mmcblk1p1 /mnt/sdcard". This is very exciting and should eliminate all glitches that occur from late binding. I haven't had much time to test using it yet, but it looks promising. Additionally, it would remove the necessity to have Script Manager run every boot (which I am thankful for). Only one problem- I don't think it's possible to rebind the internal to /mnt/sdcard/internal_fs, because it will never get mounted correctly to begin with.

Click "Thanks" if this is something you want.
 
Upvote 0
I'm really thankful for everyone's support on this. I have been racking my brain trying to get this to work earlier in the boot process. Spent many hours on it yesterday and did dozens of tests. Trying to mount the sdcard before it is normally mounted can be done, but something in the normal mounting process forces the sdcard into read-only mode, even when all mounting options appear to still allow writing.

This is bizarre behavior, even to me, and I've used Linux for many years. Perhaps someone smarter than me can figure it out? I can only assume the Android Linux kernel specifically enforces this behavior, or it is an operational error.

The best I can seem to do is relocate the sdcard immediately after normal mount. This is a few seconds earlier than the home screen display, and may be enough to avoid all possible glitches. I'm currently testing it as such. Assuming everything works great, I'm working on scripts to allow this to be easily implemented for everyone.
 
  • Like
Reactions: cubone
Upvote 0
I followed the instructions perfectly (I think!) but now I don't see my actual SD card anywhere. I see the 5 gigs of internal memory, twice. Once in mnt/sdcard/external_sd, and again at mnt/sdcard/external_sd/external_sd. There is no internal_fs folder, although I created one where the guide suggested.


When I connect my phone to my PC I do not even see my 32 Gig card... I only see the 5 Gigs of internal memory...twice.

It almost looks like this killed my 32 Gig card.


ok. After rebooting with the card out i can now put it in and see my 32 gig. Seems like things still arent working though...
 
Upvote 0
@OptimusSlime
I think you may be mistaken with how your setup is being mounted. Because of that, I have attached to this post a script. (It ends in "txt" because forum rules force me to put it that way, but it shouldn't matter for our purposes.)

This script will output a file to tell us exactly how your setup is mounted. What you have to do is put that script on your phone anywhere. Then use Script Manager to run it.

  • Open Script Manager, locate the script, and click on it
  • Select the "Run" icon (it will run very fast)
  • There will be a new file: /mnt/sdcard/current_mounts.txt
Just copy and paste the content of that text file to us. Also, copy and paste the content of your remountsd.sh file, just to be sure :eek:
 

Attachments

  • get_mount_info.txt
    74 bytes · Views: 158
Upvote 0
Q: Should the script be located in the internal memory?
A: Not necessary. Take the directory locations as I gave them. If I put "/mnt/sdcard/external_sd/remountsd.sh" then that means on your sdcard at the top level, not in any folders.

Q: Should I add #!/system/bin/sh as the first line of the script?
A: It probably wouldn't hurt, but it shouldn't be necessary. It runs correctly on my phone without having it.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones