This is very much a work in progress so would appreciate some input on this please.
For those who have an internal and external sdcard, its a shame that large games download their data to /sdcard/Android/data which is actually the internal SD on devices with both. This is no good as we may have really big microsd cards, but not so much internal SD space and games can be 1 - 1.5 GB in size.
There is an app called Directory Bind on XDA for this, but it doesn't work on 4.2.1 so I am hoping this will work instead. It isn't very elegant though, so would appreciate any input that could make it cleaner.
Yes I know I can use loops etc, but I'm a bash novice so I haven't looked at that yet
So this is "mounter.sh" which can be run via Script manager with the root option
It assumes you want to move stuff FROM /sdcard/Android/data
It gives menu options so you can set the default location of /sdcard, /extSdCard and a default directory to bind all your stuff in (eg /extSdCard/bind).
You can name the new location through the process too. It moves the stuff then mounts it at the end of the process. It also echos that using >> to bind.sh which you have to set in script manager to run as root and at boot.
Instructions
For those who have an internal and external sdcard, its a shame that large games download their data to /sdcard/Android/data which is actually the internal SD on devices with both. This is no good as we may have really big microsd cards, but not so much internal SD space and games can be 1 - 1.5 GB in size.
There is an app called Directory Bind on XDA for this, but it doesn't work on 4.2.1 so I am hoping this will work instead. It isn't very elegant though, so would appreciate any input that could make it cleaner.
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
Main_Menu='Please enter your choice: '
echo "
Main Menu
"
optionsa=("Set Defaults "
"Bind using existing defaults "
"Quit")
select opta in "${optionsa[@]}"
do
case $opta in
"Set Defaults ")
echo "
Set Defaults Menu
"
Defaults_Menu='Please enter your choice: '
optionsb=("Select the ExternalSD Mount point"
"Set Default ExternalSD location (The new location)"
"Select the InternalSD Mount point"
"Return to Main menu")
select optb in "${optionsb[@]}"
do
case $optb in
"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 "
Set Defaults Menu
1) Select the ExternalSD Mount point
2) Set Default ExternalSD location (The new location)
3) Select the InternalSD Mount point
4) Return to Main menu
"
;;
"Set Default ExternalSD location (The new location)")
echo "
Set Default ExternalSD location (The new location)
"
select extldir in $extl/*; do test -n "$extldir" && break; echo ">>> Invalid Selection, please select a number"; done
echo $extldir > $def/extdir
echo -e "
Set Defaults Menu
1) Select the ExternalSD Mount point
2) Set Default ExternalSD location (The new location)
3) Select the InternalSD Mount point
4) Return to Main menu
"
;;
"Select the InternalSD Mount point")
echo "
Select the InternalSD Mount point
"
select intl in /mnt/*; do test -n "$intl" && break; echo ">>> Invalid Selection, please select a number"; done
echo $intl > $def/int
echo -e "
Set Defaults Menu
1) Select the ExternalSD Mount point
2) Set Default ExternalSD location (The new location)
3) Select the InternalSD Mount point
4) Return to Main menu
"
;;
"Return to Main menu")
echo -e "1) Set Defaults
2) Bind using existing defaults
3) Quit"
break
;;
*) echo invalid option;;
esac
done
;;
"Bind using existing defaults ")
echo "
Bind using existing defaults
"
extdirfile=$def/extdir
extfile=$def/ext
intfile=$def/int
ext=$(<"$extfile")
extdir=$(<"$extdirfile")
int=$(<"$intfile")
# Select the App location to move
printf "
Select the directory to move data FROM:
"
select AppO in $int/Android/data/*; do test -n "$AppO" && break; echo ">>> Invalid Selection, please select a number"; done
# Select the location to move to
echo -n "
Create a name for the new directory to move data TO (HINT - Use something descriptive):
"
read AppN
echo -e "
Main Menu
1) Set Defaults
2) Bind using existing defaults
3) Quit
"
# Create the new location
mkdir $extdir/$AppN
# Move the data to the new location
mv $AppO/* $extdir/$AppN/ 2>/dev/null
# Write this data to the bind script.
echo 'mount -o bind '$extdir'/'$AppN' '$AppO'' >> $DIR/bind.sh
sh $DIR/bind.sh
echo -e "
Now use script manager to set bind.sh to run as root on boot
"
;;
"Quit")
break
;;
*) echo invalid option;;
esac
done
Yes I know I can use loops etc, but I'm a bash novice so I haven't looked at that yet
So this is "mounter.sh" which can be run via Script manager with the root option
It assumes you want to move stuff FROM /sdcard/Android/data
It gives menu options so you can set the default location of /sdcard, /extSdCard and a default directory to bind all your stuff in (eg /extSdCard/bind).
You can name the new location through the process too. It moves the stuff then mounts it at the end of the process. It also echos that using >> to bind.sh which you have to set in script manager to run as root and at boot.
Instructions
- Download the script and put it in a (non symlinked, non bound) directory on internal sdcard. Remove .txt from the filename
- Install Script manager
- Browse to your script, press it and press the "SU" button (to run it as root)
- Press "Run"
- Go through the menu to "Set Defaults" and set your default locations (may need to turn into landscape mode here)
- Then go through the Bind menu and set up your binds.
- Set the bind.sh as root and boot