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

Root [International] [Script][4.2.x] Move /sdcard app data to /extSdCard (Wip) [updated 7th Mar]

SUroot

Extreme Android User
May 25, 2010
23,907
5,306
Riddlesden, West Yorkshire, UK
What is this?

Hi all,

This is a script that will allow you (with your 4.2.x ROM) to bind the data from any app or game from /sdcard/Android/data to extSdCard. This means, your internal memory is no longer being filled by 6 Games (and their respective data) on the 16 GB versions of the S3.

Hasn't this been done before?

Yes and no. Back in the 4.0.4, 4.1.1 and 4.1.2 days, we could all use an app called "Directory Bind" but this no longer works in 4.2.x because Google have changed the way this works (Permissions). What happens now, is only the app that creates the bind can see it. For example, if you bind one directory to another using terminal, if you cd to the original location, do an "ls" list command and it will list you the data in the new location. However, browse to the original location in a file manager, it will be empty.

So this script works?

Yes it does. It uses what is unfortunately an "ugly" work around, by hijacking a system processes (debugger daemon) to achieve elevated permissions (Above and beyond that of su).

The script is still very much a "Work in Progress". I would even call it a proof-of-concept at this point. It will be tidied up and made more user friendly as time goes on. Right now though, I'm just happy to have it working.

Is this the only way?

No it is not. There are ways of changing the Dalvik cache or patching init.rc and various other technical methods that have found their way into AOSP / CM based roms. This is a way to achieve that on a stock rooted setup (Touchwiz) without high detail patching that the normal root user may not be in a position to do.

Any limitations?

  • It assumes that for app data, you will have one named directory you bind everything to. For example, I have the default set as /extSdCard/bind. The script creates my new app directories within there, then binds the original over to it.
  • You have to set your defaults on first use before you can bind.
  • It uses script manager to run and manage the scripts.
  • There is not yet a way of reversing a bind through the script. It can be done manually however. Scope for future.
  • The option to select defaults, in the terminal display is not a single column, which makes it tricky to see. You need to go to landscape mode for a better view.
  • Very few games have a hidden folder starting "." - These cannot be bound (copy issue)


How does it work?

We have in the attached zip, 2 scripts. 1 manages the set up of your defaults and mounts. The other does the daemon hijacking. The 1st calls the second script when a new mount is added (although I haven't confirmed this 100% working yet).

Script manager to be used to call the primary script but also it can be used to call the secondary too. The hijack needs to occur at every boot too.


Instructions

Depricated

Keeping my work: http://forum.xda-developers.com/showthread.php?t=2178863
 

Attachments

  • mounter.zip
    2.1 KB · Views: 158
Changes Log

14th March 2013

  • Added "initial install" option which handles all initial debuggerd set up. It also restores an auto-backup debuggered.mnt after a ROM flash
  • Created a "remove all Binds" option which replaces debuggered.mnt with a clean version
  • Finally changed the copy syntax to allow support of hidden files.

-----------------------------------------------------------------------


7th March 2013

  • Added copy function of debuggerd.mnt to script location (to backup if flashing ROM)
  • Expanded main menu to include more options:

1) Set Defaults
2) App Data: End-to-end Bind Wizard
3) App Data: Bind Only (Data already moved)
4) Bind /sdcard/* to /extSdCard/* End-to-end Wizard
5) Bind /sdcard/* to /extSdCard/* (already moved)
6) Quit
 
  • Like
Reactions: D3K17
Upvote 0
Hello.

I just wanted to say THANK YOU so much for this, I have been trying to solve the problem with little to no luck on 4.2.2. I even modded the extSD2InternalSD script which worked, but did not allow me to install applications to the extSD (now main SD).

I tried your scripts and it worked but none of the games I try to launch recognize it. File managers also see it as a different partition and the folders in the binded folder as blank files. I bound my Android folder (which contains my data and obb folder respectively). It shows as an alternately mounted device in file managers (FX Explorer, Total Commander) however upon adbing into the file system it shows that the bind did indeed work. (Root Explorer also shows the bind as working perfectly) These two sources show the bind as it was with DirectoryBind but the others do not and the games don't seem to see it either.

I have tried about 10 games and none of them read the data that is present in the bind, which makes me think there is something else small hindering this from going through. The games also state there is 'no space' left to download the game data when I am prompted to do so. I have successfully done this with DirectoryBind on 4.1 but your solution here is the closest I have come to it in 4.2.

Do you have any clues as to how to solve this or fix this? I have a lot of experience with symbolic links on various Linux distributions, but I am dumbfounded as to how to properly implement it within the Android framework. I really appreciate your hard work here, this is awesome and you should turn it into an app once it's in the state you want it to be in.

I will gladly offer any assistance I can to get this working right, a LOT of people need something like this especially gamers like me! Do you have a donation link? I will gladly send you a nice incentive to put some more time into this !(and to thank you for the work you have already done)

Thanks again :)
 
Upvote 0
You're not on AOKP are you?

Please can you run the remount.sh then can you give me the output of "mount" in a terminal please?

It may be a lot of code, so please do use the code tags in your post (looks like a # button in advanced editing mode)

Or have a look at madmack's posts here:

http://forum.xda-developers.com/showthread.php?t=2178863&page=5

He had to remount his sdcard....
 
  • Like
Reactions: D3K17
Upvote 0
14th March 2013

  • Added "initial install" option which handles all initial debuggerd set up. It also restores an auto-backup debuggered.mnt after a ROM flash
  • Created a "remove all Binds" option which replaces debuggered.mnt with a clean version
  • Finally changed the copy syntax to allow support of hidden files.
 
  • Like
Reactions: D3K17
Upvote 0
I am on AOKP and the issue is exactly as Madmack stated. I did not know the thread over here existed, I will switch over to XDA for future inqueries. My name there is xSoNiCcRaCkErSx.

Thanks so much for this and great update! I felt kind of silly having done all that only to see you have automated the process in the newest verson :)
 
Upvote 0
Sorry for my english)))
I will try to explain.
I have folder 123 with some txt file on my InternalSD and i have created 123 folder on extSdCard, but i have forgotten to move txt file to 123 folder and thought bind works. (I used option 5 in main menu to Bind my folders)
By default settings at option3 I choose /extSdCard, is it right?
 
Upvote 0
Create folder "bind" on extSdCard and set this folder in option 3 of set up menu.

This bind folder is not going to be used for the next step but the script demands it is set anyway.

Back to the main menu.

So if you want, move text file manually using file manager from /sdcard/123 to /extSdCard/123....(because you already created new folder)

Then use main menu option 5.

If you had not created /extSdCard/123 you could have used option 4 to create the folder and move the data... so if you delete extSdCard/123 you can still use option 5...


Now if you already ran option 4 or 5 before moving the data, move data manually to extSdCard then reboot
 
Upvote 0
I have done with option 3, but i delete accidentally debuggerd and debuggerd.bak from system/bin.
Now I get this by initial install:

Unable to chmod /system/bin/debuggerd: No such file or directory
rm failed for /system/bin/debuggerd, No such file or directory
cp: /system/bin/debuggerd.bak: No such file or directory



Initial install.....complete

Mounter folder
https://www.dropbox.com/s/ej3c3raa8bpmevv/mounter.zip
 
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