• 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
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

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
 
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 :)
 
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.
 
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 :)
 
What does depreciated mean in this context mate?
Think its a bit advanced for this forum? :) its had a good few views. Maybe people have just been rude and not thankd
EDIT "DEPRICATED" sorry, dislexya lol
 
I am getting following trouble by Bind /sdcard/* to /extSdCard/* (already moved)

/storage/emulated/0/mounter/mounter.sh[379]: /storage/emulated/0/mounter/mounter_defaults/extdir: can't open $() input
 
Go through the set up menu and set all your defaults...

Follow the link in post 1 to instructions on xda which have been updated.

In the setup menu it appears you skipped option 3.

In the next release I will remove this requirement for this section...
 
Thx SUroot, it works fine.
How can I choose folder InternalSD/android/obb/xx xx xx? The script gives only InternalSD/Android.
 
No worries

I haven't got to obb yet. Not tested. maybe next update? Possibly this weekend sometime but can't promise
 
Sorry, script doesn't work, I just not moved files to extSdCard (have Only created a folder) and I thought it works(((. I don't know what's wrong. I have CM 10.1,I did instruction completely, by option 3 I had chosen /extSdCard

Ps: Can I manually edit debuggerd.mnt to get android / obb/xx xx xx?
 
Wait, what you used the already moved option without moving it? So the data is still on internal?

So you used wrong option? Where is data now?

Talk about obb later. 1 at a time
 
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?
 
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
 
If you only have extSdCard in setup option 3, what on earth did you choose in set up option 2???


Please upload everything in mounter_defaults
 
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
 
Don't worry about errors if you deleted the files.

What is the current status? Because now mounter defaults looks fine!
 
It works fine after wipe system and reflash Rom. But I have some trouble. In explore I can see that my navigon folder is mounted, but navigon app request files.
 
If you can go into /sdcard/whatever in file manager, and can see /extSdCard/whatever/files, then it is working. This assumes you moved the files first.
 
Back
Top Bottom