[MOD][Howto] Move folders from internal to external sd card - Galaxy S 4 i9500 Android Development

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.

raw235 said:
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.
Click to expand...
Click to collapse
can you plz make a app for this coz its very difficult for ameture like Me.Thanks

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

grgsiocl said:
@palash_6670 Why dont you use the foldermount app from the market
Click to expand...
Click to collapse
I use it
It is amazing ^_^
Sent from my GT-I9500 using Tapatalk 4 Beta

palash_6670 said:
can you plz make a app for this coz its very difficult for ameture like Me.Thanks
Click to expand...
Click to collapse
bhai, use FOlderMount (https://play.google.com/store/apps/details?id=com.devasque.fmount) ! awesome application !

greatricky said:
bhai, use FOlderMount (https://play.google.com/store/apps/details?id=com.devasque.fmount) ! awesome application !
Click to expand...
Click to collapse
Yeah Bro Using it Thanks for the suggestion

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

Pistolaobr said:
Guys, wouldnt be easier to simply edit the root\etc\vold.fstab and change the montpoints of internal memory and external microsd?
Click to expand...
Click to collapse
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.

palash_6670 said:
Yeah Bro Using it Thanks for the suggestion
Click to expand...
Click to collapse
How much space did you save doing that?

drziddo said:
How much space did you save doing that?
Click to expand...
Click to collapse
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]

Hi
Is it possible to find a way through CWM Flash ?

azoojeddah said:
Hi
Is it possible to find a way through CWM Flash ?
Click to expand...
Click to collapse
Probably yes, but it woulb be one for each cwm custom rom or for each custom kernel.

xperia z
pls folder mount doesnt work with xperia z any suggestions pls???

johnemone said:
pls folder mount doesnt work with xperia z any suggestions pls???
Click to expand...
Click to collapse
What does it say?

mw86 said:
What does it say?
Click to expand...
Click to collapse
it shows me d green pin but wen I try to start d game it doesn't start

raw235 said:
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.
Click to expand...
Click to collapse
Nice work...Keep it up
Click to expand...
Click to collapse

Looks Greattttt.....Keep It Up :good:

is this will work on galaxy s3?

Related

[Q] Developers help. Need to mount external SD to /sd

if you have adb and superuser (h**p://forum.xda-developers.com/showpost.php?p=7239659&postcount=3 you need to grand permission from the phone when you type su)
Code:
adb shell
su
mount -o bind /sdcard/external_sd /sdcard/sd
this should last until you reboot.
why don't you just remove the app and reinstall? it's way safer, if you don't know about the previous commands.
I will try this thank you very much for your reply!
I tried to install the app again but there is no difference.
It continues to search for the resource files at /sdcard/sd :S
What is the problem via simply simlinking external_sd
to sd? I.e. using ln -s?
sdcard is vfat, so ln doesn't work

[Howto] mount any directories from extSdCard to under /sdcard/

So I found a million threads asking about why they can't ln -s or mount the /mnt/extSdCard to /mnt/sdcard or various forms of that. The motivation here is to allow certain apps that can't get about /sdcard/ to be able to see the additional 64GB of SDHC.
What helped was this realization that the android mount command supports bind and one of a few dozen other threads, mostly this one:
http://forum.xda-developers.com/showthread.php?t=1825494
So it appears there are a half dozen ways to make mounts, from using /dev/block/vold/179:97 to using the vold.fstab which mentions a serial or parallel sdcard scheme, which they chose parallel, to all these init.rc monitoring scripts that have to unmount on USB mode, and crazy stuff and a million Directory Bind apps, and int2SD binder / linker apps. It appears this app might do what I am suggesting but I don't think /emmc/ works anymore and I haven't looked into the .apk.
Ok....
1) ODIN over a root injected stock ROM, or otherwise get root.
2) (A) Get yourself any Terminal program like Terminal Emulator and if you are smart you will also get Hacker's Keyboard.
or
2) (B) From any of the programs that will run scripts, you can just make a script.
3)
Code:
$ su -
# mkdir /mnt/sdcard/external
# mount -o bind /mnt/extSdCard /mnt/sdcard/external
Now you can name it whatever you want but since the home is /sdcard/ it has to be under that.
Or, instead of mounting the whole thing, just mount Movies and Music directory
Code:
# mkdir /mnt/sdcard/Music/extMusic
# mount -o bind /mnt/extSdCard/Music /mnt/sdcard/Music/extMusic
Etc.
Now for those wanting to make a script or app to sell for $1.99... There may be real problems depending on where a backup program chooses to backup and it could be recursive.
And just FYI, this ends up inheriting all the same properties from the extSdCard mount params,
ie. /dev/block/vold/179:97 /mnt/sdcard/Music/extMusic vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1023,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
Any mounted directory all look identical in mount and the vold must map them out.
Anyways you can write a simple script and hopefully you are mindful of any backups you do if you save backups to the external sdcard and you mount the entire thing. The safest way would be to mount one directory to transfer files or only mount the large media.
It also means you could copy everything from /sdcard/Music to the external and then mount /sdcard/Music to be a directory on the external card. You could remove the ext SDHC and copy files that way and have everything in one place and not worry about wiping it out.
However, I have benchmarked the internal SD appears to be faster on bandwidth benchmarks versus an external Class 10/UHS. On the stock rom the internal is also fuse versus fat32 for the external SDHC (or exFAT for a SDXC card). There is also something in the SD2.0 spec about the 2nd SD only one can have a higher clock bandwidth.
Types in step 3 exactly. But nothing happened
Sent from my SGH-T999 using xda app-developers app
fateownzyou3 said:
Types in step 3 exactly. But nothing happened
Click to expand...
Click to collapse
Did you get an error? There is no output of mount unless there is an error.. Did you look in a file browser to see if that folder is now mounted? This only works until reboot, until someone makes an app or script.
Hi,
@joederp thank you very much ! Your tip in so usefull to me with my galaxy note on CM10 ParanoidAndroid ROM.
The only thing I try now to get work is : automaticaly run the script at phone boot. I'm pretty sure I can get it with Tasker, but did not find the trick.
Just use the directory bind app... It works fine on my galaxy tab 2 7.0
Sent from my SGH-T999 using xda premium
Directory bind is a whole different thing that uses CPU and monitors the system and does who knows what.
You can just use any scripting program or I think edit init.rc and add the extra mount commands. copy init.rc to a .bak and edit it.
Thank to all of you !
I found something more appropriate to my needs in this thread : http://forum.xda-developers.com/showthread.php?t=1593615
Anyway thanks

apps to sd card(galaxy S3 mini)

Hi,
How can i put in my Samsung Galaxy S3 mini(android 4.1.2) my apps, to sd card. Step by step pls, if you Know.
Thanks.
kdidie said:
Hi,
How can i put in my Samsung Galaxy S3 mini(android 4.1.2) my apps, to sd card. Step by step pls, if you Know.
Thanks.
Click to expand...
Click to collapse
Also, I need to know how to put my apps to SD Card.
If you found a method please tell me
Link2sd
Sent from the dark side on my GT-I8190
I installed link2sd but when I try to move the app to sd card show me this error.
Sent from my GT-I8190 using xda premium
Follow this guide here http://forum.xda-developers.com/showthread.php?t=2087497
Don't move the apps to sd, just create a 'link'.
You need init.d support and a properly partitioned sd card. This guide will show you how.
Sent from the dark side on my GT-I8190
iKlutz said:
Follow this guide here http://forum.xda-developers.com/showthread.php?t=2087497
Don't move the apps to sd, just create a 'link'.
You need init.d support and a properly partitioned sd card. This guide will show you how.
Sent from the dark side on my GT-I8190
Click to expand...
Click to collapse
Thanks very much for the guide.
Here is an easy method to enable init.d support with an app [http://forum.xda-developers.com/showthread.php?t=1933849]
eduardd- said:
I installed link2sd but when I try to move the app to sd card show me this error.
Sent from my GT-I8190 using xda premium
Click to expand...
Click to collapse
I had the same problem with my S3 Mini, what i did is 1.Install Link2SD. wich created a mount script for the second partition to be mounted to /data/sdext2 at boottime
and then i also got the INSUFFICIENT SPACE error when i tried to move. so i looked for the init.d script at /etc/init.d/ its called link2sd or someting like that and then 2. i manually changed that script to include "mount -o bind" commands so i could link manually my copied data maps on the second partition to the 'local' /sdcard/Android/data or ../obb
it worked but you have to remount the /etc directory to get write acces to be able to change the init scripts and also you are depending on a kernel wich supports init.d scripts.
took me a few days to figure it out but i just got my first android since 2 weeks and only have some linux/unix experience so i get the commands.
dhscholtus said:
I had the same problem with my S3 Mini, what i did is 1.Install Link2SD. wich created a mount script for the second partition to be mounted to /data/sdext2 at boottime
and then i also got the INSUFFICIENT SPACE error when i tried to move. so i looked for the init.d script at /etc/init.d/ its called link2sd or someting like that and then 2. i manually changed that script to include "mount -o bind" commands so i could link manually my copied data maps on the second partition to the 'local' /sdcard/Android/data or ../obb
it worked but you have to remount the /etc directory to get write acces to be able to change the init scripts and also you are depending on a kernel wich supports init.d scripts.
took me a few days to figure it out but i just got my first android since 2 weeks and only have some linux/unix experience so i get the commands.
Click to expand...
Click to collapse
Can you explain better wnat you changed in that file, please?
I menage to find it after all... now i don't know what to change...
THX
#!/system/bin/sh
#added by link2sd
LOG=/data/link2sd-11link2sd.log
echo "$(date) mounting..." > $LOG
mount -t vfat -o rw /dev/block/vold/179:98 /data/sdext2 1>>$LOG 2>>$LOG
mount -t vfat -o rw /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG
mount >> $LOG
echo "$(date) mount finished" >> $LOG
i found one thing...
after root the phone, use "GL to SD"
it will move the games data to sd card, but apps not able...
use directory bind to move data games
maulana98 said:
use directory bind to move data games
Click to expand...
Click to collapse
How , can you explain please
I got a Samsung S3 Mini from AT&T the other day and I can install apps to sd card with the stock rom! here are my phone specs:
Model number: Sumsung-SM-G730A
Android version:
4.2.2
Baseband version:
G730AUCUAMH4
Kernel Version:
3.4.0-1299773
[email protected] #1
Wed Aug 21 13:15:42 KST 2013
Build version:
JDQ39.G730AUCUAMH4
Hi
I use this program and it works very good https://play.google.com/store/apps/details?id=com.slf.ListglApp
1. Install
2. options/move data
3. Select apps to move
4. start, it will work,
5. each time you wanna play or run any app only select mount (the chain in the right side), if you wanna move more apps select unmount and move data again, and that's all.
gafer said:
How , can you explain please
Click to expand...
Click to collapse
Go to: [TOOL] DirectoryBind - move data to external_sd (GameLoft, Shadowgun etc.) ROOT req.
Hey guys,
I think I've tried everything but it doesn't look like this is possible to do.
I tried to do it on an un-rooted I9300 4.1.2 with TouchWiz and had no success.
Now I'm using CM 10.2 and I still I'm trying to find something useful. And again with no success.
iKlutz said:
Follow this guide here http://forum.xda-developers.com/showthread.php?t=2087497
Don't move the apps to sd, just create a 'link'.
You need init.d support and a properly partitioned sd card. This guide will show you how.
Sent from the dark side on my GT-I8190
Click to expand...
Click to collapse
Thanks, it helped me a lot

[Q] Symbolic Links on SM-T210 [Function not implemented error]

Hello,
I'm pretty new here if somebody is wondering.
So my problem is as follows:
I have 32gb Sd Card (Class: 10) and my device internal memory is almost full which means that I'll need more space for my things so I'm trying to setup symbolic link from /sdcard/Android to /storage/extSdCard/Android, but it's failing really badly.
Terminal Log (From adb shell):
Code:
[email protected]:/sdcard # ln -s
ln [-s] <target> <name>
[email protected]:/sdcard # ln -s /storage/extSdCard/Android Android
ln -s /storage/extSdCard/Android Android
link failed Function not implemented
255|[email protected]:/sdcard #
I know that the problem is with Function not being implemented, but how to get it work? Any app2sd apps from Google Play wont work as they detect the internal memory as an sdcard.
Thanks in advance if you have try to help me.
I think that error means the file system doesn't support symlinks.
You could swap the internal and external cards like in this thread:
Folder mount could help, it's in play store but you can mount three apps only but if you bought the premium you can mount unlimited but if you can't buy it, you can swap internal memory to external, go to here and there is a post that has a script for sm-t210 and follow the instructions in post #1
Sent from my SM-T210(R)ocketTab 3.0 $up€[email protected]$T
sb719 said:
I think that error means the file system doesn't support symlinks.
You could swap the internal and external cards like in this thread:
Click to expand...
Click to collapse
Ripshock said:
Folder mount could help, it's in play store but you can mount three apps only but if you bought the premium you can mount unlimited but if you can't buy it, you can swap internal memory to external, go to here and there is a post that has a script for sm-t210 and follow the instructions in post #1
Sent from my SM-T210(R)ocketTab 3.0 $up€[email protected]$T
Click to expand...
Click to collapse
That thread has some comments that it's not working on my device and I don't want to mess up. I'm just wondering WHY it says that error.
Also every app in Google Play that can read SD-card's will most likely read that the device has only ONE SD-card which is the internal one when it needs to detect them both.
Does anybody know the answer that WHY does it say that? I'm advanced user of linux, but that error tells me something about it not being develomented to the script even tough it has the command in.

[Q] Tab 3 Kids SM-T2105 SD Card Directory Structure & Moving Apps to SD

While in Kids Mode, my four-year old outsmarted the security software (not hard to do - kid's security sucks. I'm constantly finding him going where he shouldn't) and reformatted the SD card in his SM-T2105 . I managed to restore the files using PhotoRec, but it dumped the files into directories of like file types - i.e. .jpg's, .pdf's, .icn's etc. Would anyone be willing to share their SD card directory structure so I can recreate his as best as I can? I realize each one will be different, but it'll help. I promise to periodically backup the card from now on.
Also, I've found plenty of questions regarding how to move apps to the SD card, but so far have not found any solutions that work. I'm getting the message "Insufficient storage available" and he doesn't even have that many apps installed. He also has a 16G card that is mostly empty. The inability of the Samsung SM-T2105 to move apps to external storage is bewildering considering the pitifully poor space available.
Thanks.
ChipStewart said:
While in Kids Mode, my four-year old outsmarted the security software (not hard to do - kid's security sucks. I'm constantly finding him going where he shouldn't) and reformatted the SD card in his SM-T2105 . I managed to restore the files using PhotoRec, but it dumped the files into directories of like file types - i.e. .jpg's, .pdf's, .icn's etc. Would anyone be willing to share their SD card directory structure so I can recreate his as best as I can? I realize each one will be different, but it'll help. I promise to periodically backup the card from now on.
Also, I've found plenty of questions regarding how to move apps to the SD card, but so far have not found any solutions that work. I'm getting the message "Insufficient storage available" and he doesn't even have that many apps installed. He also has a 16G card that is mostly empty. The inability of the Samsung SM-T2105 to move apps to external storage is bewildering considering the pitifully poor space available.
Thanks.
Click to expand...
Click to collapse
I would like to Bump this I to have a T2105 I do not have the ability to move any apps to SD it is very frustrating.
---------- Post added at 12:43 PM ---------- Previous post was at 12:23 PM ----------
I received the following from generous fellow user @SGTDude about moving apps to sd. I haven't had time to test it, but I thought I would share it with you guys.
Quote:
Repartition the SD card with two primary partitions.
Format the first partition as FAT32.
Format the second partition as EXT4
mount the ext4 partition somewhere
mount -o rw,nosuid,nodev,noatime,discard,journal_checksum,j ournal_async_commit,noauto_da_alloc,data=ordered -t ext4 /dev/block/mmcblk1p2 /system/sd
Copy several folders over from /data
mkdir /system/sd/app
mkdir /system/sd/app-asec
mkdir /system/sd/data
mkdir /system/sd/media
cp -rp /data/app/* /system/sd/app/
cp -rp /data/app-asec/* /system/sd/app-asec/
cp -rp /data/data/* /system/sd/data/
cp -rp /data/media/* /system/sd/media/
add the following lines to /data/local/userinit.sh
mount -o rw,nosuid,nodev,noatime,discard,journal_checksum,j ournal_async_commit,noauto_da_alloc,data=ordered -t ext4 /dev/block/mmcblk1p2 /system/sd
mount -o bind /system/sd/app /data/app
mount -o bind /system/sd/app-asec /data/app-asec
mount -o bind /system/sd/data /data/data
mount -o bind /system/sd/media /data/media
Note: *"/dev/block/mmcblk1p2" is probably right on any SGT3 7" running Kids Rom, but I'd double-check if I were you.
Sent from my SM-T210R using Tapatalk
Click to expand...
Click to collapse
I saw this on http://forum.xda-developers.com/showthread.php?t=2548241 but i really don't know how to do what it ask and no one ever confirms if it works. So I am at a loss. I can't reply because I am a newb.

Categories

Resources