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

Search This thread

raw235

Senior Member
Feb 3, 2009
50
14
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.
 
Last edited:

palash_6670

Senior Member
Aug 8, 2011
137
24
Dhaka
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
 

Pistolaobr

Senior Member
May 16, 2011
272
68
Araxá
Guys, wouldnt be easier to simply edit the root\etc\vold.fstab and change the montpoints of internal memory and external microsd?
 

raw235

Senior Member
Feb 3, 2009
50
14
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.
 

elbildozer

Senior Member
Dec 7, 2012
270
75
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.


Nice work...Keep it up
 

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    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.
    5
    @palash_6670 Why dont you use the foldermount app from the market
    3
    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
    2
    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.
    1
    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/details?id=com.devasque.fmount) ! awesome application !