[Script][4.2]Move /sdcard app data to /extSdCard [12th May] TW+CM+AOSPA+AOKP

Status
Not open for further replies.
Search This thread

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Tested with...

Fully working
-TouchWiz based 4.2.x

Experimental*
-CM 10.1 (Nighlies)
-ParanoidAndroid 3+ (Official)
-AOKP (Official)

*requires Siyah, Yank or Devil kernel

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 a handful of Games (and their respective data) on the 16 GB versions of the S3. You can move game or app data from any app that uses the internal sdcard to your external sd card, to save precious space.

We can also use the script to bind folders like DCIM and Downloads.

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. So if you bind in "Directory Bind", only that app can see it, NOT the app that "owns" the data.

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).

Does it work for everyone? Any pre-requsites or requirements?

It should work for most S3 users on 4.2 now. The latest releases have experimental support for CM, AOSPA and AOKP roms as well as full support for TouchWiz roms.

All ROMs must have busybox installed. Non-TouchWiz ROMs may need to change the kernel to Siyah 1.9.1 (CM 10.1 kernel doesn't work)

Any limitations?

  • Some AOSP ROMs mount the extSdCard with fmask=0702,dmask=0702 which doesn't give full access to non-root users (Apps). We can work around this - see EXPERIMENTAL
  • 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.
  • 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.

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

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

***Take a full Nandroid backup before moving forward***

Firstly, create a folder on your internal SD card. Called it something like "mounter".
Download the "mounter.zip" file attached to this post.
Unzip the contents of the zip file and put inside the "mounter" folder you just created

Now you should have:

/sdcard/mounter/mounter.sh
/sdcard/mounter/remount.sh
/sdcard/mounter/remount_delayed.sh
/sdcard/mounter/debuggerd.mnt

Tip > never try to bind this directory

Now, download Script Manager and install it.
Open script manager and go to the /sdcard/mounter directory
Press "mounter.sh" to open up its options. Press the "Su" button (turns green)
Press the run button. You are now running the script.

93aad5ad-8413-4a95-b2d4-1c6ff4606d13.jpg


So first things first, you are presented with the main menu. The first time you run the script, you MUST go into 1) Set-up Menu

a0b8a051-e6a3-4892-a638-c49fb8eedfc5.jpg


In the Set-up Menu, you MUST set the following options before first time use:

1) Initial Install (Choose Either TouchWiz or AOSP, whichever is appropriate)
- This manages all your debuggerd files for you. Puts them in your /system partition, sets permissions etc.

2) Select the ExternalSD mount point
- This tells the script now (and moving forward) where you ExternalSD is.

3) Set Default ExternalSD location (The new location)
- As stated in "limitations", this script assumes you want to keep all your /sdcard/Android/data/game that you bind, in one single folder on extSdCard. This option tells the script what folder that is. This option does not create the folder for you. Personally, I have /extSdCard/bind set as my folder

4) Select the InternalSD Mount point.
- This tells the script now (and moving forward) where you InternalSD is. For me (on the S3) this is /data/media/0 (by default this option lists everything in data/media)

Once all these 4 options are set, you can go back to the main menu where you see the options to actually do the binding:

93aad5ad-8413-4a95-b2d4-1c6ff4606d13.jpg


2) App Data: End-to-End Bind Wizard
- This is a menu that will take you through step-by-step, moving the data files of an app and binding it to the default externalSD folder

3) App Data: Bind only (Data Already Moved)
- Perhaps the data is already where you want it. From another app in the past that no longer works. This will simply add the missing bind

4) Move Obb data (for ALL games) to extSdCard
- This menu takes the obb directory (where all games with obb data keep their obb data) and mounts the entire directory in a folder of your creation (creates during this process)

5) Bind /sdcard/* to extSdCard/* End-to-end Wizard
- This is a menu that will take you though step-by-step taking a folder on /sdcard (Downloads for example) and creating a folder to bind to on the external sd

6) Bind /sdcard/* to extSdCard/* (Already moved)
- As above, but the data is already there.


Once selecting whichever option you want and finishing that menu, the script will tell you to set remount.sh* as "Su" and "Boot" in script manager.

That's it. Done.

Please note, if you do have problems with not being able to manually create / delete files on either sdcard, set remount_delayed.sh to run at boot instead of remount.sh - DO NOT DELETE remount.sh however, it is still required.

Tip > debuggered.mnt is backed up in /sdcard/mounter/mounter_defaults - If you have reflashed your ROM, you can simply do the "Initial Install" option again. The other set up options are not required. The mounts will remain.

How to remove?

1) In Script manager, reset remount.sh to not run at boot.

2) Run mounter.sh and run through Set-up menu > Remove All binds and restart clean

3) Reboot (important)

4) You will manually be responsible for moving your moved data back to where it needs to be.


The Scripts

mounter.sh
Code:
#!/system/bin/sh

# Set Default Script location
DIR="$(dirname "$0")"

if [ ! -d $DIR/mounter_defaults ];
then
    mkdir $DIR/mounter_defaults
fi
def=$DIR/mounter_defaults

# Set vold mount for AOSP based ROMS
VOLD="$(mount | grep -E -o -m 1 ".{0,0}179:.{0,2}")"

Main_Menu='Please enter your choice: '
echo "

=======================================================
********************** Main Menu **********************
=======================================================

"
optionsa=("Set-up Menu                          "
"App Data: End-to-end Bind Wizard         "
"App Data: Bind Only (Data already moved)          "
"Move obb data (for ALL games) to /extSdCard"
"Bind /sdcard/* to /extSdCard/* End-to-end Wizard"
"Bind /sdcard/* to /extSdCard/* (already moved)"
"Quit")
select opta in "${optionsa[@]}"
do
    case $opta in
        "Set-up Menu                          ")
echo "

=======================================================
********************* Set-Up Menu *********************
=======================================================

"
Defaults_Menu='Please enter your choice: '
optionsb=("Initial Install and repair - TW"
"Initial Install and repair - AOSP"
"Select the ExternalSD Mount point" 
"Set Default ExternalSD folder to bind app data" 
"Select the InternalSD Mount point"
"Remove all binds and restart clean"
"Return to Main menu")
select optb in "${optionsb[@]}"
do
    case $optb in
        "Initial Install and repair - TW")
echo -e "


If you have not taken a FULL Nandroid of your device, reboot and do so now.  You have 45 Seconds before this process starts.... Take a Nandroid NOW!!!


"
sleep 60
echo -e "

Initial install or repair starting.  Please be patient whilst magic happens.... This will take several minutes.


"
mount -o remount,rw /system
chmod 777 /system/bin/debuggerd > /dev/null 2>&1
cp -fr /system/bin/debuggerd /system/bin/debuggerd.bak > /dev/null 2>&1
cp -fr /system/bin/debuggerd.bak $DIR/ > /dev/null 2>&1
cp -fr $DIR/mounter_defaults/debuggerd.mnt $DIR/debuggerd.mnt > /dev/null 2>&1
cp -fr $DIR/debuggerd.mnt /system/bin/ > /dev/null 2>&1
cp -fr $DIR/debuggerd.bak /system/bin/ > /dev/null 2>&1
chmod 777 /system/bin/debuggerd.mnt > /dev/null 2>&1
chmod 777 /system/bin/debuggerd.bak > /dev/null 2>&1
sh $DIR/remount.sh


echo -e "


Initial install or repair.....complete

>

=======================================================
********************* Set-Up Menu *********************
=======================================================

1) Initial Install and repair (TouchWiz)
2) Initial Install and repair (AOSP)
3) Select the ExternalSD Mount point
4) Set Default ExternalSD folder to bind app data
5) Select the InternalSD Mount point
6) Remove all binds and restart clean
7) Return to Main menu

"
            ;;
         "Initial Install and repair - AOSP")
echo -e "


If you have not taken a FULL Nandroid of your device, reboot and do so now.  You have 45 Seconds before this process starts.... Take a Nandroid NOW!!!


"
sleep 60
echo -e "

Initial install or repair starting.  Please be patient whilst magic happens.... This will take several minutes.


"
echo 'umount /storage/sdcard1
mount -t vfat -o rw,uid=1023,gid=1023,dmask=0002,fmask=0002 /dev/block/vold/'$VOLD '/storage/sdcard1' >> $DIR/debuggerd.mnt
mount -o remount,rw /system
cp -fr /system/etc/permissions/platform.xml $DIR/mounter_defaults/platform.xml > /dev/null 2>&1
cp -fr $DIR/platform.xml /system/etc/permissions/platform.xml > /dev/null 2>&1
chmod 777 /system/etc/permissions/platform.xml > /dev/null 2>&1
chmod 777 /system/bin/debuggerd > /dev/null 2>&1
cp -fr /system/bin/debuggerd /system/bin/debuggerd.bak > /dev/null 2>&1
cp -fr /system/bin/debuggerd.bak $DIR/ > /dev/null 2>&1
cp -fr $DIR/mounter_defaults/debuggerd.mnt $DIR/debuggerd.mnt > /dev/null 2>&1
cp -fr $DIR/debuggerd.mnt /system/bin/ > /dev/null 2>&1
cp -fr $DIR/debuggerd.bak /system/bin/ > /dev/null 2>&1
chmod 777 /system/bin/debuggerd.mnt > /dev/null 2>&1
chmod 777 /system/bin/debuggerd.bak > /dev/null 2>&1


echo -e "


Initial install or repair.....complete

>

Please now reboot your device


=======================================================
********************* Set-Up Menu *********************
=======================================================

1) Initial Install and repair (TouchWiz)
2) Initial Install and repair (AOSP)
3) Select the ExternalSD Mount point
4) Set Default ExternalSD folder to bind app data
5) Select the InternalSD Mount point
6) Remove all binds and restart clean
7) Return to Main menu

"
            ;;
        "Select the ExternalSD Mount point")
echo "

Select the ExternalSD Mount point

"
            select extl in /mnt/*; do test -n "$extl" && break; echo ">>> Invalid Selection, please select a number"; done
echo $extl > $def/ext

echo -e "

ExternalSD Mount point.....set

=======================================================
********************* Set-Up Menu *********************
=======================================================

1) Initial Install and repair (TouchWiz)
2) Initial Install and repair (AOSP)
3) Select the ExternalSD Mount point
4) Set Default ExternalSD folder to bind app data
5) Select the InternalSD Mount point
6) Remove all binds and restart clean
7) Return to Main menu

"
            ;;
        "Set Default ExternalSD folder to bind app data")
echo "

Set Default ExternalSD folder to bind app data

"
            select extldir in $extl/*; do test -n "$extldir" && break; echo ">>> Invalid Selection, please select a number"; done
echo $extldir > $def/extdir

echo -e "

ExternalSD default bind directory.....set

=======================================================
********************* Set-Up Menu *********************
=======================================================

1) Initial Install and repair (TouchWiz)
2) Initial Install and repair (AOSP)
3) Select the ExternalSD Mount point
4) Set Default ExternalSD folder to bind app data
5) Select the InternalSD Mount point
6) Remove all binds and restart clean
7) Return to Main menu

"
            ;;
        "Select the InternalSD Mount point")
echo "

Select the InternalSD Mount point

"
            select intl in /data/media/*; do test -n "$intl" && break; echo ">>> Invalid Selection, please select a number"; done
echo $intl > $def/int

echo -e "

InternalSD mount.....set

=======================================================
********************* Set-Up Menu *********************
=======================================================

1) Initial Install and repair (TouchWiz)
2) Initial Install and repair (AOSP)
3) Select the ExternalSD Mount point
4) Set Default ExternalSD folder to bind app data
5) Select the InternalSD Mount point
6) Remove all binds and restart clean
7) Return to Main menu

"
            ;;
        "Remove all binds and restart clean")
echo "

Data will NOT be moved back to it's original location.  Only the binds will be removed.

"
echo ' ' > /system/bin/debuggerd.mnt

echo -e "

debuggerd.mnt.....cleaned

>

>



=======================================================
********************* Set-Up Menu *********************
=======================================================

1) Initial Install and repair (TouchWiz)
2) Initial Install and repair (AOSP)
3) Select the ExternalSD Mount point
4) Set Default ExternalSD folder to bind app data
5) Select the InternalSD Mount point
6) Remove all binds and restart clean
7) Return to Main menu

"
            ;;
        "Return to Main menu")
echo -e "

=======================================================
********************** Main Menu **********************
=======================================================

1)  Set Defaults 
2)  App Data: End-to-end Bind Wizard
3)  App Data: Bind Only (Data already moved)
4)  Move obb data (for ALL games) to /extSdCard
5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
6)  Bind /sdcard/* to /extSdCard/* (already moved)
7)  Quit"
break
            ;;
        *) echo invalid option;;
    esac
done
            ;;
        "App Data: End-to-end Bind Wizard         ")
echo "

App Data: End-to-end Bind Wizard

"
extdirfile=$def/extdir
extfile=$def/ext
intfile=$def/int
ext=$( /dev/null 2>&1
rm -rf $AppO/* 

# Write this data to the bind script.
mount -o remount,rw /system
echo 'mount -o bind '$extdir'/'$AppN' '$AppO'' >> /system/bin/debuggerd.mnt
cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
sh $DIR/remount.sh
echo -e "


Operation completed sucessfully!!!!

If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot





=======================================================
********************** Main Menu **********************
=======================================================

1)  Set Defaults 
2)  App Data: End-to-end Bind Wizard
3)  App Data: Bind Only (Data already moved)
4)  Move obb data (for ALL games) to /extSdCard
5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
6)  Bind /sdcard/* to /extSdCard/* (already moved)
7)  Quit

"
           ;;
        "App Data: Bind Only (Data already moved)          ")
echo "

App Data: Bind Only (Data already moved)

"
extdirfile=$def/extdir
extfile=$def/ext
intfile=$def/int
ext=$(> /system/bin/debuggerd.mnt
cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
sh $DIR/remount.sh
echo -e "


Operation completed sucessfully!!!!

If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot




=======================================================
********************** Main Menu **********************
=======================================================

1)  Set Defaults 
2)  App Data: End-to-end Bind Wizard
3)  App Data: Bind Only (Data already moved)
4)  Move obb data (for ALL games) to /extSdCard
5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
6)  Bind /sdcard/* to /extSdCard/* (already moved)
7)  Quit

"
          ;;
        "Move obb data (for ALL games) to /extSdCard")
echo "

Move obb data (for ALL games) to /extSdCard

... This may take several minutes, please be patient....

"
extdirfile=$def/extdir
extfile=$def/ext
intfile=$def/int
ext=$( /dev/null 2>&1
rm -rf /data/media/obb/* 

echo "

obb data moved successfully!

...binding...

"

# Write this data to the bind script.
mount -o remount,rw /system
echo 'mount -o bind '$extdir'/obb /data/media/obb' >> /system/bin/debuggerd.mnt
cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
sh $DIR/remount.sh
echo -e "


Operation completed sucessfully!!!!

If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boott





=======================================================
********************** Main Menu **********************
=======================================================

1)  Set Defaults 
2)  App Data: End-to-end Bind Wizard
3)  App Data: Bind Only (Data already moved)
4)  Move obb data (for ALL games) to /extSdCard
5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
6)  Bind /sdcard/* to /extSdCard/* (already moved)
7)  Quit

"
          ;;
        "Bind /sdcard/* to /extSdCard/* End-to-end Wizard")
echo "

Bind /sdcard/* to /extSdCard/* End-to-end Wizard

"
extfile=$def/ext
intfile=$def/int
ext=$( /dev/null 2>&1
rm -rf $DirO/* 


# Write this data to the bind script.
mount -o remount,rw /system
echo 'mount -o bind '$ext'/'$DirN' '$DirO'' >> /system/bin/debuggerd.mnt
cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
sh $DIR/remount.sh
echo -e "


Operation completed sucessfully!!!!

If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot





=======================================================
********************** Main Menu **********************
=======================================================

1)  Set Defaults 
2)  App Data: End-to-end Bind Wizard
3)  App Data: Bind Only (Data already moved)
4)  Move obb data (for ALL games) to /extSdCard
5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
6)  Bind /sdcard/* to /extSdCard/* (already moved)
7)  Quit

"
          ;;
        "Bind /sdcard/* to /extSdCard/* (already moved)")
echo "

Bind /sdcard/* to /extSdCard/* (already moved)

"
extfile=$def/ext
intfile=$def/int
ext=$(> /system/bin/debuggerd.mnt
cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
sh $DIR/remount.sh
echo -e "


Operation completed sucessfully!!!!

If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot





=======================================================
********************** Main Menu **********************
=======================================================

1)  Set Defaults 
2)  App Data: End-to-end Bind Wizard
3)  App Data: Bind Only (Data already moved)
4)  Move obb data (for ALL games) to /extSdCard
5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
6)  Bind /sdcard/* to /extSdCard/* (already moved)
7)  Quit

"
            ;;
        "Quit")
            break
            ;;
        *) echo invalid option;;
    esac
done

remount.sh
Code:
#!/system/bin/sh

mount -o remount,rw /system
stop debuggerd
sleep 2
rm /system/bin/debuggerd
sleep 2
cp /system/bin/debuggerd.mnt /system/bin/debuggerd
chmod 777 /system/bin/debuggerd
sleep 5
start debuggerd
sleep 2
stop debuggerd
sleep 2
rm /system/bin/debuggerd
sleep 2
cp /system/bin/debuggerd.bak /system/bin/debuggerd
sleep 2
start debuggerd
 

Attachments

  • mounter_restore_19th_Apr.zip
    217.2 KB · Views: 1,868
  • mounter_12th_may.zip
    5.3 KB · Views: 1,830
Last edited:

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Change Log

12th May 2013

EXPERIMENTAL (Bug fix)

  • AOSP - Changed deletion method of old (moved) data in end-to-end wizards, that was leaving hidden folders and files undeleted (taking up space)

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



11th May 2013

EXPERIMENTAL (Bug fix + improvements)

  • AOSP - Fixed bug with platforms.xml that caused both /sdcard and /extSdCard to mount without user permissions (could only be fixed by Full Nandroid restore) as found by @Glebun
  • AOSP - Does not run remount after Initial install / repair. Advises user to reboot device.
  • ALL - Added warning about taking Nandroid before initial install / repair. Inserted delay before process starts to give user chance to take a nandroid if they have not done already
  • ALL - Consistency of "Success" messages after bind operation.
  • ALL - Added Main Menu return after bind operation

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

19th April 2013

EXPERIMENTAL (Minor update)

  • Used sdcard_rw AND media_rw in permissions (A la ParanoidAndroid) to fix permissions issue on both sdcards
  • Removed permissions from flashable restore zip (not needed and wasn't universal)
  • Added remount_delayed.sh - set this as the one to run at boot if you have issues creating files on either sdcard (you still need remount.sh which the mounter.sh script calls). delays by 2 minutes so don't try to do anything in a mounted folder until after 2 minutes.

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

14th April 2013

EXPERIMENTAL

  • Initial install Option for CM/AOSP based ROMs backs up (to mounter_defaults) the existing /system/etc/permissions/platform.xml and replaces it with modified version (in latest zip). No additional requirements / changes to instructions required.
  • Added restore zip which does 2 things:

    1) Restores Changed permissions for AOSP ROMs
    2) Replaced debuggerd with original (on very rare occasions, debuggerd.mnt becomes default debuggerd and makes phone hang)


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

13th April 2013

EXPERIMENTAL

  • New Initial install Option for CM/AOSP based ROMs (using Siyah Kernel Required)

Using the "Initial Install and Repair - AOSP", can remount the external sdcard on AOSP ROMs (Using Siyah Kernel) at boot so works as normal.

I'm not sure if it only works with Siyah, just that it doesn't work with the CM10.1 kernel

Bugs



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

16th March 2013

  • Initial install now repairs missing debuggerd.bak in case of accidental deletion by user
  • Added "Move obb data (for ALL games) to /extSdCard" option
  • Removed the requirement for setting default externalSD folder for /sdcard/* to /extSdCard/* menus that don't use it.
  • Some interface tidying


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

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
 
Last edited:

Glebun

Senior Member
Jun 6, 2010
5,041
1,087
Kyiv
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

I must be doing something wrong.

[Screenshot removed]
 
Last edited:

Glebun

Senior Member
Jun 6, 2010
5,041
1,087
Kyiv
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

Okay, I renamed it to debuggers.bak by mistake. Still doesn't work though
 

Attachments

  • uploadfromtaptalk1362591677707.jpg
    uploadfromtaptalk1362591677707.jpg
    53 KB · Views: 1,873

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

Sorry, just seen the screen shot.

Lets address one at a time.

1. Is there definitely data in that game directory? If its empty, you will get that error.

Note to self, script to create placeholder dummy file in directory to allow mount with no data

Sent from my GT-I9300 using Tapatalk 2
 

Glebun

Senior Member
Jun 6, 2010
5,041
1,087
Kyiv
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

yup
 

Attachments

  • uploadfromtaptalk1362592057265.jpg
    uploadfromtaptalk1362592057265.jpg
    55 KB · Views: 1,949

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

Could it have moved it the first time, but failed to mount? Now it can't move it because it's already moved it, then mounted so your app shows bind data?

Simple test, what's in your new external folder? If anything, its already moved it. You can confirm that by testing create file in new location. Visible in old location?

Sent from my GT-I9300 using Tapatalk 2
 

Glebun

Senior Member
Jun 6, 2010
5,041
1,087
Kyiv
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

I was using a different folder name every time. I deleted all of them and nothing changed. the files are still in internal, and the script doesn't work
 

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

Can you try another game / app for me please?

I just retested and cannot reproduce

Sent from my GT-I9300 using Tapatalk 2
 

Glebun

Senior Member
Jun 6, 2010
5,041
1,087
Kyiv
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

okay, it works with others!
what's the next step?
 
Last edited:

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

You could try manually removing any mount references to that game in debuggerd.mnt as there may be a few now.

Reboot then try again

Sent from my GT-I9300 using Tapatalk 2
 

Glebun

Senior Member
Jun 6, 2010
5,041
1,087
Kyiv
I'll do that later today. The game is Real Racing 3.

Can you just make it mount the whole 0/data folder over to the extSD?
 
  • Like
Reactions: danarama

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Re: [Script][4.2.x] Move /sdcard app data to /extSdCard (WiP)

Its a function I can add later.

You could put the below (and only the below) in debuggerd.mnt then use remount script if you want. You'd have to manually move it all first. I don't know what affect this would have on apps running at boot tho. I don't think it a good idea

#!/system/bin/sh

mount -o bind /mnt/extsdcard/yourdirhere /data/media/0/Android/data

Sent from my GT-I9300 using Tapatalk 2
 

Glebun

Senior Member
Jun 6, 2010
5,041
1,087
Kyiv
Can it be because all the Real Racing's data is in a subfolder .depot, which means it's hidden?
 

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
No it wont. Because i'm using a wildcard with cp -r, it's not expanding hidden files. I'm giving it a rethink. I've not seen any games that use hidden files before. Not sure why they have done this..
 

danarama

Senior Member
Aug 22, 2010
31,277
18,811
Oxenhope, West Yorkshire, UK
Uploaded to post 1:

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
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 29
    Tested with...

    Fully working
    -TouchWiz based 4.2.x

    Experimental*
    -CM 10.1 (Nighlies)
    -ParanoidAndroid 3+ (Official)
    -AOKP (Official)

    *requires Siyah, Yank or Devil kernel

    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 a handful of Games (and their respective data) on the 16 GB versions of the S3. You can move game or app data from any app that uses the internal sdcard to your external sd card, to save precious space.

    We can also use the script to bind folders like DCIM and Downloads.

    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. So if you bind in "Directory Bind", only that app can see it, NOT the app that "owns" the data.

    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).

    Does it work for everyone? Any pre-requsites or requirements?

    It should work for most S3 users on 4.2 now. The latest releases have experimental support for CM, AOSPA and AOKP roms as well as full support for TouchWiz roms.

    All ROMs must have busybox installed. Non-TouchWiz ROMs may need to change the kernel to Siyah 1.9.1 (CM 10.1 kernel doesn't work)

    Any limitations?

    • Some AOSP ROMs mount the extSdCard with fmask=0702,dmask=0702 which doesn't give full access to non-root users (Apps). We can work around this - see EXPERIMENTAL
    • 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.
    • 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.

    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

    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

    ***Take a full Nandroid backup before moving forward***

    Firstly, create a folder on your internal SD card. Called it something like "mounter".
    Download the "mounter.zip" file attached to this post.
    Unzip the contents of the zip file and put inside the "mounter" folder you just created

    Now you should have:

    /sdcard/mounter/mounter.sh
    /sdcard/mounter/remount.sh
    /sdcard/mounter/remount_delayed.sh
    /sdcard/mounter/debuggerd.mnt

    Tip > never try to bind this directory

    Now, download Script Manager and install it.
    Open script manager and go to the /sdcard/mounter directory
    Press "mounter.sh" to open up its options. Press the "Su" button (turns green)
    Press the run button. You are now running the script.

    93aad5ad-8413-4a95-b2d4-1c6ff4606d13.jpg


    So first things first, you are presented with the main menu. The first time you run the script, you MUST go into 1) Set-up Menu

    a0b8a051-e6a3-4892-a638-c49fb8eedfc5.jpg


    In the Set-up Menu, you MUST set the following options before first time use:

    1) Initial Install (Choose Either TouchWiz or AOSP, whichever is appropriate)
    - This manages all your debuggerd files for you. Puts them in your /system partition, sets permissions etc.

    2) Select the ExternalSD mount point
    - This tells the script now (and moving forward) where you ExternalSD is.

    3) Set Default ExternalSD location (The new location)
    - As stated in "limitations", this script assumes you want to keep all your /sdcard/Android/data/game that you bind, in one single folder on extSdCard. This option tells the script what folder that is. This option does not create the folder for you. Personally, I have /extSdCard/bind set as my folder

    4) Select the InternalSD Mount point.
    - This tells the script now (and moving forward) where you InternalSD is. For me (on the S3) this is /data/media/0 (by default this option lists everything in data/media)

    Once all these 4 options are set, you can go back to the main menu where you see the options to actually do the binding:

    93aad5ad-8413-4a95-b2d4-1c6ff4606d13.jpg


    2) App Data: End-to-End Bind Wizard
    - This is a menu that will take you through step-by-step, moving the data files of an app and binding it to the default externalSD folder

    3) App Data: Bind only (Data Already Moved)
    - Perhaps the data is already where you want it. From another app in the past that no longer works. This will simply add the missing bind

    4) Move Obb data (for ALL games) to extSdCard
    - This menu takes the obb directory (where all games with obb data keep their obb data) and mounts the entire directory in a folder of your creation (creates during this process)

    5) Bind /sdcard/* to extSdCard/* End-to-end Wizard
    - This is a menu that will take you though step-by-step taking a folder on /sdcard (Downloads for example) and creating a folder to bind to on the external sd

    6) Bind /sdcard/* to extSdCard/* (Already moved)
    - As above, but the data is already there.


    Once selecting whichever option you want and finishing that menu, the script will tell you to set remount.sh* as "Su" and "Boot" in script manager.

    That's it. Done.

    Please note, if you do have problems with not being able to manually create / delete files on either sdcard, set remount_delayed.sh to run at boot instead of remount.sh - DO NOT DELETE remount.sh however, it is still required.

    Tip > debuggered.mnt is backed up in /sdcard/mounter/mounter_defaults - If you have reflashed your ROM, you can simply do the "Initial Install" option again. The other set up options are not required. The mounts will remain.

    How to remove?

    1) In Script manager, reset remount.sh to not run at boot.

    2) Run mounter.sh and run through Set-up menu > Remove All binds and restart clean

    3) Reboot (important)

    4) You will manually be responsible for moving your moved data back to where it needs to be.


    The Scripts

    mounter.sh
    Code:
    #!/system/bin/sh
    
    # Set Default Script location
    DIR="$(dirname "$0")"
    
    if [ ! -d $DIR/mounter_defaults ];
    then
        mkdir $DIR/mounter_defaults
    fi
    def=$DIR/mounter_defaults
    
    # Set vold mount for AOSP based ROMS
    VOLD="$(mount | grep -E -o -m 1 ".{0,0}179:.{0,2}")"
    
    Main_Menu='Please enter your choice: '
    echo "
    
    =======================================================
    ********************** Main Menu **********************
    =======================================================
    
    "
    optionsa=("Set-up Menu                          "
    "App Data: End-to-end Bind Wizard         "
    "App Data: Bind Only (Data already moved)          "
    "Move obb data (for ALL games) to /extSdCard"
    "Bind /sdcard/* to /extSdCard/* End-to-end Wizard"
    "Bind /sdcard/* to /extSdCard/* (already moved)"
    "Quit")
    select opta in "${optionsa[@]}"
    do
        case $opta in
            "Set-up Menu                          ")
    echo "
    
    =======================================================
    ********************* Set-Up Menu *********************
    =======================================================
    
    "
    Defaults_Menu='Please enter your choice: '
    optionsb=("Initial Install and repair - TW"
    "Initial Install and repair - AOSP"
    "Select the ExternalSD Mount point" 
    "Set Default ExternalSD folder to bind app data" 
    "Select the InternalSD Mount point"
    "Remove all binds and restart clean"
    "Return to Main menu")
    select optb in "${optionsb[@]}"
    do
        case $optb in
            "Initial Install and repair - TW")
    echo -e "
    
    
    If you have not taken a FULL Nandroid of your device, reboot and do so now.  You have 45 Seconds before this process starts.... Take a Nandroid NOW!!!
    
    
    "
    sleep 60
    echo -e "
    
    Initial install or repair starting.  Please be patient whilst magic happens.... This will take several minutes.
    
    
    "
    mount -o remount,rw /system
    chmod 777 /system/bin/debuggerd > /dev/null 2>&1
    cp -fr /system/bin/debuggerd /system/bin/debuggerd.bak > /dev/null 2>&1
    cp -fr /system/bin/debuggerd.bak $DIR/ > /dev/null 2>&1
    cp -fr $DIR/mounter_defaults/debuggerd.mnt $DIR/debuggerd.mnt > /dev/null 2>&1
    cp -fr $DIR/debuggerd.mnt /system/bin/ > /dev/null 2>&1
    cp -fr $DIR/debuggerd.bak /system/bin/ > /dev/null 2>&1
    chmod 777 /system/bin/debuggerd.mnt > /dev/null 2>&1
    chmod 777 /system/bin/debuggerd.bak > /dev/null 2>&1
    sh $DIR/remount.sh
    
    
    echo -e "
    
    
    Initial install or repair.....complete
    
    >
    
    =======================================================
    ********************* Set-Up Menu *********************
    =======================================================
    
    1) Initial Install and repair (TouchWiz)
    2) Initial Install and repair (AOSP)
    3) Select the ExternalSD Mount point
    4) Set Default ExternalSD folder to bind app data
    5) Select the InternalSD Mount point
    6) Remove all binds and restart clean
    7) Return to Main menu
    
    "
                ;;
             "Initial Install and repair - AOSP")
    echo -e "
    
    
    If you have not taken a FULL Nandroid of your device, reboot and do so now.  You have 45 Seconds before this process starts.... Take a Nandroid NOW!!!
    
    
    "
    sleep 60
    echo -e "
    
    Initial install or repair starting.  Please be patient whilst magic happens.... This will take several minutes.
    
    
    "
    echo 'umount /storage/sdcard1
    mount -t vfat -o rw,uid=1023,gid=1023,dmask=0002,fmask=0002 /dev/block/vold/'$VOLD '/storage/sdcard1' >> $DIR/debuggerd.mnt
    mount -o remount,rw /system
    cp -fr /system/etc/permissions/platform.xml $DIR/mounter_defaults/platform.xml > /dev/null 2>&1
    cp -fr $DIR/platform.xml /system/etc/permissions/platform.xml > /dev/null 2>&1
    chmod 777 /system/etc/permissions/platform.xml > /dev/null 2>&1
    chmod 777 /system/bin/debuggerd > /dev/null 2>&1
    cp -fr /system/bin/debuggerd /system/bin/debuggerd.bak > /dev/null 2>&1
    cp -fr /system/bin/debuggerd.bak $DIR/ > /dev/null 2>&1
    cp -fr $DIR/mounter_defaults/debuggerd.mnt $DIR/debuggerd.mnt > /dev/null 2>&1
    cp -fr $DIR/debuggerd.mnt /system/bin/ > /dev/null 2>&1
    cp -fr $DIR/debuggerd.bak /system/bin/ > /dev/null 2>&1
    chmod 777 /system/bin/debuggerd.mnt > /dev/null 2>&1
    chmod 777 /system/bin/debuggerd.bak > /dev/null 2>&1
    
    
    echo -e "
    
    
    Initial install or repair.....complete
    
    >
    
    Please now reboot your device
    
    
    =======================================================
    ********************* Set-Up Menu *********************
    =======================================================
    
    1) Initial Install and repair (TouchWiz)
    2) Initial Install and repair (AOSP)
    3) Select the ExternalSD Mount point
    4) Set Default ExternalSD folder to bind app data
    5) Select the InternalSD Mount point
    6) Remove all binds and restart clean
    7) Return to Main menu
    
    "
                ;;
            "Select the ExternalSD Mount point")
    echo "
    
    Select the ExternalSD Mount point
    
    "
                select extl in /mnt/*; do test -n "$extl" && break; echo ">>> Invalid Selection, please select a number"; done
    echo $extl > $def/ext
    
    echo -e "
    
    ExternalSD Mount point.....set
    
    =======================================================
    ********************* Set-Up Menu *********************
    =======================================================
    
    1) Initial Install and repair (TouchWiz)
    2) Initial Install and repair (AOSP)
    3) Select the ExternalSD Mount point
    4) Set Default ExternalSD folder to bind app data
    5) Select the InternalSD Mount point
    6) Remove all binds and restart clean
    7) Return to Main menu
    
    "
                ;;
            "Set Default ExternalSD folder to bind app data")
    echo "
    
    Set Default ExternalSD folder to bind app data
    
    "
                select extldir in $extl/*; do test -n "$extldir" && break; echo ">>> Invalid Selection, please select a number"; done
    echo $extldir > $def/extdir
    
    echo -e "
    
    ExternalSD default bind directory.....set
    
    =======================================================
    ********************* Set-Up Menu *********************
    =======================================================
    
    1) Initial Install and repair (TouchWiz)
    2) Initial Install and repair (AOSP)
    3) Select the ExternalSD Mount point
    4) Set Default ExternalSD folder to bind app data
    5) Select the InternalSD Mount point
    6) Remove all binds and restart clean
    7) Return to Main menu
    
    "
                ;;
            "Select the InternalSD Mount point")
    echo "
    
    Select the InternalSD Mount point
    
    "
                select intl in /data/media/*; do test -n "$intl" && break; echo ">>> Invalid Selection, please select a number"; done
    echo $intl > $def/int
    
    echo -e "
    
    InternalSD mount.....set
    
    =======================================================
    ********************* Set-Up Menu *********************
    =======================================================
    
    1) Initial Install and repair (TouchWiz)
    2) Initial Install and repair (AOSP)
    3) Select the ExternalSD Mount point
    4) Set Default ExternalSD folder to bind app data
    5) Select the InternalSD Mount point
    6) Remove all binds and restart clean
    7) Return to Main menu
    
    "
                ;;
            "Remove all binds and restart clean")
    echo "
    
    Data will NOT be moved back to it's original location.  Only the binds will be removed.
    
    "
    echo ' ' > /system/bin/debuggerd.mnt
    
    echo -e "
    
    debuggerd.mnt.....cleaned
    
    >
    
    >
    
    
    
    =======================================================
    ********************* Set-Up Menu *********************
    =======================================================
    
    1) Initial Install and repair (TouchWiz)
    2) Initial Install and repair (AOSP)
    3) Select the ExternalSD Mount point
    4) Set Default ExternalSD folder to bind app data
    5) Select the InternalSD Mount point
    6) Remove all binds and restart clean
    7) Return to Main menu
    
    "
                ;;
            "Return to Main menu")
    echo -e "
    
    =======================================================
    ********************** Main Menu **********************
    =======================================================
    
    1)  Set Defaults 
    2)  App Data: End-to-end Bind Wizard
    3)  App Data: Bind Only (Data already moved)
    4)  Move obb data (for ALL games) to /extSdCard
    5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
    6)  Bind /sdcard/* to /extSdCard/* (already moved)
    7)  Quit"
    break
                ;;
            *) echo invalid option;;
        esac
    done
                ;;
            "App Data: End-to-end Bind Wizard         ")
    echo "
    
    App Data: End-to-end Bind Wizard
    
    "
    extdirfile=$def/extdir
    extfile=$def/ext
    intfile=$def/int
    ext=$( /dev/null 2>&1
    rm -rf $AppO/* 
    
    # Write this data to the bind script.
    mount -o remount,rw /system
    echo 'mount -o bind '$extdir'/'$AppN' '$AppO'' >> /system/bin/debuggerd.mnt
    cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
    sh $DIR/remount.sh
    echo -e "
    
    
    Operation completed sucessfully!!!!
    
    If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot
    
    
    
    
    
    =======================================================
    ********************** Main Menu **********************
    =======================================================
    
    1)  Set Defaults 
    2)  App Data: End-to-end Bind Wizard
    3)  App Data: Bind Only (Data already moved)
    4)  Move obb data (for ALL games) to /extSdCard
    5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
    6)  Bind /sdcard/* to /extSdCard/* (already moved)
    7)  Quit
    
    "
               ;;
            "App Data: Bind Only (Data already moved)          ")
    echo "
    
    App Data: Bind Only (Data already moved)
    
    "
    extdirfile=$def/extdir
    extfile=$def/ext
    intfile=$def/int
    ext=$(> /system/bin/debuggerd.mnt
    cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
    sh $DIR/remount.sh
    echo -e "
    
    
    Operation completed sucessfully!!!!
    
    If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot
    
    
    
    
    =======================================================
    ********************** Main Menu **********************
    =======================================================
    
    1)  Set Defaults 
    2)  App Data: End-to-end Bind Wizard
    3)  App Data: Bind Only (Data already moved)
    4)  Move obb data (for ALL games) to /extSdCard
    5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
    6)  Bind /sdcard/* to /extSdCard/* (already moved)
    7)  Quit
    
    "
              ;;
            "Move obb data (for ALL games) to /extSdCard")
    echo "
    
    Move obb data (for ALL games) to /extSdCard
    
    ... This may take several minutes, please be patient....
    
    "
    extdirfile=$def/extdir
    extfile=$def/ext
    intfile=$def/int
    ext=$( /dev/null 2>&1
    rm -rf /data/media/obb/* 
    
    echo "
    
    obb data moved successfully!
    
    ...binding...
    
    "
    
    # Write this data to the bind script.
    mount -o remount,rw /system
    echo 'mount -o bind '$extdir'/obb /data/media/obb' >> /system/bin/debuggerd.mnt
    cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
    sh $DIR/remount.sh
    echo -e "
    
    
    Operation completed sucessfully!!!!
    
    If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boott
    
    
    
    
    
    =======================================================
    ********************** Main Menu **********************
    =======================================================
    
    1)  Set Defaults 
    2)  App Data: End-to-end Bind Wizard
    3)  App Data: Bind Only (Data already moved)
    4)  Move obb data (for ALL games) to /extSdCard
    5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
    6)  Bind /sdcard/* to /extSdCard/* (already moved)
    7)  Quit
    
    "
              ;;
            "Bind /sdcard/* to /extSdCard/* End-to-end Wizard")
    echo "
    
    Bind /sdcard/* to /extSdCard/* End-to-end Wizard
    
    "
    extfile=$def/ext
    intfile=$def/int
    ext=$( /dev/null 2>&1
    rm -rf $DirO/* 
    
    
    # Write this data to the bind script.
    mount -o remount,rw /system
    echo 'mount -o bind '$ext'/'$DirN' '$DirO'' >> /system/bin/debuggerd.mnt
    cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
    sh $DIR/remount.sh
    echo -e "
    
    
    Operation completed sucessfully!!!!
    
    If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot
    
    
    
    
    
    =======================================================
    ********************** Main Menu **********************
    =======================================================
    
    1)  Set Defaults 
    2)  App Data: End-to-end Bind Wizard
    3)  App Data: Bind Only (Data already moved)
    4)  Move obb data (for ALL games) to /extSdCard
    5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
    6)  Bind /sdcard/* to /extSdCard/* (already moved)
    7)  Quit
    
    "
              ;;
            "Bind /sdcard/* to /extSdCard/* (already moved)")
    echo "
    
    Bind /sdcard/* to /extSdCard/* (already moved)
    
    "
    extfile=$def/ext
    intfile=$def/int
    ext=$(> /system/bin/debuggerd.mnt
    cp -fr /system/bin/debuggerd.mnt $DIR/mounter_defaults > /dev/null 2>&1
    sh $DIR/remount.sh
    echo -e "
    
    
    Operation completed sucessfully!!!!
    
    If you have not done so already, please now use script manager to set remount or remount_delayed to run as root on boot
    
    
    
    
    
    =======================================================
    ********************** Main Menu **********************
    =======================================================
    
    1)  Set Defaults 
    2)  App Data: End-to-end Bind Wizard
    3)  App Data: Bind Only (Data already moved)
    4)  Move obb data (for ALL games) to /extSdCard
    5)  Bind /sdcard/* to /extSdCard/* End-to-end Wizard
    6)  Bind /sdcard/* to /extSdCard/* (already moved)
    7)  Quit
    
    "
                ;;
            "Quit")
                break
                ;;
            *) echo invalid option;;
        esac
    done

    remount.sh
    Code:
    #!/system/bin/sh
    
    mount -o remount,rw /system
    stop debuggerd
    sleep 2
    rm /system/bin/debuggerd
    sleep 2
    cp /system/bin/debuggerd.mnt /system/bin/debuggerd
    chmod 777 /system/bin/debuggerd
    sleep 5
    start debuggerd
    sleep 2
    stop debuggerd
    sleep 2
    rm /system/bin/debuggerd
    sleep 2
    cp /system/bin/debuggerd.bak /system/bin/debuggerd
    sleep 2
    start debuggerd
    5
    Change Log

    12th May 2013

    EXPERIMENTAL (Bug fix)

    • AOSP - Changed deletion method of old (moved) data in end-to-end wizards, that was leaving hidden folders and files undeleted (taking up space)

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



    11th May 2013

    EXPERIMENTAL (Bug fix + improvements)

    • AOSP - Fixed bug with platforms.xml that caused both /sdcard and /extSdCard to mount without user permissions (could only be fixed by Full Nandroid restore) as found by @Glebun
    • AOSP - Does not run remount after Initial install / repair. Advises user to reboot device.
    • ALL - Added warning about taking Nandroid before initial install / repair. Inserted delay before process starts to give user chance to take a nandroid if they have not done already
    • ALL - Consistency of "Success" messages after bind operation.
    • ALL - Added Main Menu return after bind operation

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

    19th April 2013

    EXPERIMENTAL (Minor update)

    • Used sdcard_rw AND media_rw in permissions (A la ParanoidAndroid) to fix permissions issue on both sdcards
    • Removed permissions from flashable restore zip (not needed and wasn't universal)
    • Added remount_delayed.sh - set this as the one to run at boot if you have issues creating files on either sdcard (you still need remount.sh which the mounter.sh script calls). delays by 2 minutes so don't try to do anything in a mounted folder until after 2 minutes.

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

    14th April 2013

    EXPERIMENTAL

    • Initial install Option for CM/AOSP based ROMs backs up (to mounter_defaults) the existing /system/etc/permissions/platform.xml and replaces it with modified version (in latest zip). No additional requirements / changes to instructions required.
    • Added restore zip which does 2 things:

      1) Restores Changed permissions for AOSP ROMs
      2) Replaced debuggerd with original (on very rare occasions, debuggerd.mnt becomes default debuggerd and makes phone hang)


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

    13th April 2013

    EXPERIMENTAL

    • New Initial install Option for CM/AOSP based ROMs (using Siyah Kernel Required)

    Using the "Initial Install and Repair - AOSP", can remount the external sdcard on AOSP ROMs (Using Siyah Kernel) at boot so works as normal.

    I'm not sure if it only works with Siyah, just that it doesn't work with the CM10.1 kernel

    Bugs



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

    16th March 2013

    • Initial install now repairs missing debuggerd.bak in case of accidental deletion by user
    • Added "Move obb data (for ALL games) to /extSdCard" option
    • Removed the requirement for setting default externalSD folder for /sdcard/* to /extSdCard/* menus that don't use it.
    • Some interface tidying


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

    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
    5
    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.
    3
    Ok I know i'm pretty much talking to myself here but if nothing else, at least I'm recording my thoughts as I go....and if anyone more knowledgeable can help in the process - all the better.

    So I can work around the writing permissions issue but I'm not sure of any knock on affects. I've not found any YET!

    Scenario sdcard/DCIM is bound to extSdCard/DCIM. I will call these dcims and dcime for short.

    If I mount /sdcard as uid=1023,gid=1023 before bind, I can create and delete files in dcims. dcime will see these changes but cannot create or delete itself.

    If I mount /sdcard as uid=1000,gid=1015 before bind, its the exact opposite. Create and delete in dcime but not in dcims. What a pain.

    I've tried every combination of uid and gid I can think of but I simply cannot find a way for files to be creatable AND deleteable in both locations. With 1023 /extSdCard is not writable AT ALL unless through a bound folder. With 1015, the bound folders are essentially read only.

    So the work around? Change the gid reference in permissions.

    Change:

    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
    <group gid="sdcard_rw" />
    </permission>

    To:

    <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
    <group gid="media_rw" />
    </permission>


    In etc/permissions/platform.xml

    Can anyone can give me a reason why I shouldn't to this?

    I can write and delete including via apps (tested with camera) and nothing appears to be broken.



    Sent from my GT-I9300 using Tapatalk 2
    3
    Following are the commands to get your sdcard mounted correctly if permissions aren't right:

    Code:
    umount /storage/sdcard1
    mount -t vfat -o rw,uid=1023,gid=1023,dmask=0002,fmask=0002 /dev/block/vold*** /storage/sdcard1

    You'll have to run "mount" and figure out what the mount dev and folders are. for some it's /storage/extSdCard for example instead of /storage/sdcard1. I intentionally left the /dev/block/vold** incomplete because you'll have to figure it out from the output of command "mount".