FORUMS
Remove All Ads from XDA

[MOD][Howto] Move folders from internal to external sd card

50 posts
Thanks Meter: 14
 
By raw235, Member on 9th June 2013, 08:59 PM
Post Reply Email Thread
Here is the script i use to mount folders from my external sd card over folders on the internal one. This makes it possible to transfer the most space consuming files off the internal memory, so you have more space for installing other applications.

this method requires some basic linux skills, if you dont know how to use the linux command line, you better try the foldermount app. as always, use this method on your own risk.

this works with the mount --bind command, nothing new, similar scripts are documented for the galaxy s3, galaxy tab and also used by the foldermount app. one advantage over the foldermount app is, that this script is launched by init.d very early in the boot process, so no app is started at the time of mounting (not finding the files they expect).

1. you need a kernel with init.d support. tested with adam 1.3.2 and perseus alpha1. (alpha0 did not work for me).
2. get a root command promt on your phone, i recommend adb shell, a local terminal emulator will work too.
3. you may need to type "su" in the console to get a root shell
4. create the init directory by typing "mkdir /etc/init.d" and "chmod 777 /etc/init.d"
5. create the file "/etc/init.d/02mountbind" by using your favorite text editor. you may also create it on sdcard first and then copy it over. make sure to do a "chmod 777 /etc/init.d/02mountbind" on it.
6. the content of the script depends on your requirements. also, it does not move any files, you have to do that yourself. I recommend to test with the first mount -o bind test line. then comment in the other two lines after you have moved the files over to your external sdcard.
Code:
#!/system/bin/sh
echo "started mount script" >/data/local/tmp/init.d_log.txt
#start the volume manager
vold
#mount the external sd card, its not there at boot time
mount -t vfat -o umask=0000,uid=1000,gid=1023 /dev/block/vold/179\:9 /storage/extSdCard/ 2>&1 >> /data/local/tmp/init.d_log.txt

#this is a test, you can use it to confirm everything is working before you start to move files. if all is fine, you can write files to the folder "test" on your internal sdcard and see the changes on the external one.
mount -o bind /storage/extSdCard/test/ /data/media/0/test 2>&1 >> /data/local/tmp/init.d_log.txt

#mount the Android directory of the extSdCart to the internal one. Move all files from your internal sdcard to the external one first
#mount -o bind /storage/extSdCard/Android/ /data/media/0/Android 2>&1 >> /data/local/tmp/init.d_log.txt

#also mount the obb directory. its not on the "internal sdcard" but also on your internal storage. it holts the most data of games like gta3, max payne and so on.
#mount -o bind /storage/extSdCard/Android/obb /data/media/obb/ 2>&1 >> /data/local/tmp/init.d_log.txt

echo "done mount script" >> /data/local/tmp/init.d_log.txt
after placing the script and making it chmod 777, try to reboot and see if it works. if not, check the file /data/local/tmp/init.d_log.txt for log informations.

i have some games installed, had a full internal memory and were able to free up 6Gb space on my using this method.

Feedback welcome.
The Following 8 Users Say Thank You to raw235 For This Useful Post: [ View ] Gift raw235 Ad-Free
 
 
9th June 2013, 09:47 PM |#2  
palash_6670's Avatar
Senior Member
Flag Dhaka
Thanks Meter: 24
 
More
Quote:
Originally Posted by raw235

Here is the script i use to mount folders from my external sd card over folders on the internal one. This makes it possible to transfer the most space consuming files off the internal memory, so you have more space for installing other applications.

this method requires some basic linux skills, if you dont know how to use the linux command line, you better try the foldermount app. as always, use this method on your own risk.

this works with the mount --bind command, nothing new, similar scripts are documented for the galaxy s3, galaxy tab and also used by the foldermount app. one advantage over the foldermount app is, that this script is launched by init.d very early in the boot process, so no app is started at the time of mounting (not finding the files they expect).

1. you need a kernel with init.d support. adam kernel has it, others may have it too.
2. get a root command promt on your phone, i recommend adb shell, a local terminal emulator will work too.
3. you may need to type "su" in the console to get a root shell
4. create the init directory by typing "mkdir /etc/init.d" and "chmod 777 /etc/init.d"
5. create the file "/etc/init.d/02mountbind" by using your favorite text editor. you may also create it on sdcard first and then copy it over. make sure to do a "chmod 777 /etc/init.d/02mountbind" on it.
6. the content of the script depends on your requirements. also, it does not move any files, you have to do that yourself. I recommend to test with the first mount -o bind test line. then comment in the other two lines after you have moved the files over to your external sdcard.

Code:
#!/system/bin/sh
echo "started mount script" >/data/local/tmp/init.d_log.txt
#start the volume manager
vold
#mount the external sd card, its not there at boot time
mount -t vfat -o umask=0000,uid=1000,gid=1023 /dev/block/vold/179\:9 /storage/extSdCard/ 2>&1 >> /data/local/tmp/init.d_log.txt

#this is a test, you can use it to confirm everything is working before you start to move files. if all is fine, you can write files to the folder "test" on your internal sdcard and see the changes on the external one.
mount -o bind /storage/extSdCard/test/ /data/media/0/test 2>&1 >> /data/local/tmp/init.d_log.txt

#mount the Android directory of the extSdCart to the internal one. Move all files from your internal sdcard to the external one first
#mount -o bind /storage/extSdCard/Android/ /data/media/0/Android 2>&1 >> /data/local/tmp/init.d_log.txt

#also mount the obb directory. its not on the "internal sdcard" but also on your internal storage. it holts the most data of games like gta3, max payne and so on.
#mount -o bind /storage/extSdCard/Android/obb /data/media/obb/ 2>&1 >> /data/local/tmp/init.d_log.txt

echo "done mount script" >> /data/local/tmp/init.d_log.txt
after placing the script and making it chmod 777, try to reboot and see if it works. if not, check the file /data/local/tmp/init.d_log.txt for log informations.

i have some games installed, had a full internal memory and were able to free up 6Gb space on my using this method.

Feedback welcome.


can you plz make a app for this coz its very difficult for ameture like Me.Thanks
The Following 3 Users Say Thank You to palash_6670 For This Useful Post: [ View ] Gift palash_6670 Ad-Free
10th June 2013, 05:57 AM |#3  
grgsiocl's Avatar
Senior Member
Flag Kurnool, Andhra Pradesh
Thanks Meter: 4,557
 
More
@palash_6670 Why dont you use the foldermount app from the market
The Following 5 Users Say Thank You to grgsiocl For This Useful Post: [ View ] Gift grgsiocl Ad-Free
10th June 2013, 08:34 AM |#4  
Senior Member
Thanks Meter: 11
 
More
Quote:
Originally Posted by grgsiocl

@palash_6670 Why dont you use the foldermount app from the market

I use it
It is amazing ^_^

Sent from my GT-I9500 using Tapatalk 4 Beta
10th June 2013, 04:46 PM |#5  
Member
Chittagong
Thanks Meter: 7
 
Donate to Me
More
Quote:
Originally Posted by palash_6670

can you plz make a app for this coz its very difficult for ameture like Me.Thanks

bhai, use FOlderMount (https://play.google.com/store/apps/d...evasque.fmount) ! awesome application !
The Following User Says Thank You to greatricky For This Useful Post: [ View ] Gift greatricky Ad-Free
10th June 2013, 09:18 PM |#6  
palash_6670's Avatar
Senior Member
Flag Dhaka
Thanks Meter: 24
 
More
Quote:
Originally Posted by greatricky

bhai, use FOlderMount (https://play.google.com/store/apps/d...evasque.fmount) ! awesome application !

Yeah Bro Using it Thanks for the suggestion
13th June 2013, 12:26 PM |#7  
Pistolaobr's Avatar
Senior Member
Flag Brasil MG Araxá
Thanks Meter: 61
 
Donate to Me
More
Guys, wouldnt be easier to simply edit the root\etc\vold.fstab and change the montpoints of internal memory and external microsd?
13th June 2013, 03:27 PM |#8  
OP Member
Thanks Meter: 14
 
More
Prompt
Quote:
Originally Posted by Pistolaobr

Guys, wouldnt be easier to simply edit the root\etc\vold.fstab and change the montpoints of internal memory and external microsd?

i have tried that, there is no mount point for the internal one in vold.fstab. instead i have modified the init.rc config (by repacking the kernel) to mount the external one in place of the internal one and ignore the external moint point, but that caused the camera application to hang (i think it checks for both sdcards). also, my script does not only mount the large Android folder from one sd to the other, it is also able to mount the /data/media/obb folder, which neither on the internal nor on the external sdcard, to the external sdcard. simple mountpointswapping would'nt make this possibe. that obb folder was 3,5GB large for me, containing the most data of my games.
The Following 2 Users Say Thank You to raw235 For This Useful Post: [ View ] Gift raw235 Ad-Free
17th June 2013, 01:44 PM |#9  
drziddo's Avatar
Senior Member
Thanks Meter: 52
 
More
Quote:
Originally Posted by palash_6670

Yeah Bro Using it Thanks for the suggestion

How much space did you save doing that?
17th June 2013, 04:03 PM |#10  
palash_6670's Avatar
Senior Member
Flag Dhaka
Thanks Meter: 24
 
More
Quote:
Originally Posted by drziddo

How much space did you save doing that?

u can put the game file on sd card[OBB,game files] and mount it.it will work like as a Mobile memory. [sorry for the english]
18th June 2013, 02:15 AM |#11  
azoojeddah's Avatar
Senior Member
Flag ▂ ▃ ▅ ▆ █
Thanks Meter: 25
 
Donate to Me
More
Hi
Is it possible to find a way through CWM Flash ?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes