[Q] Developers help. Need to mount external SD to /sd - Galaxy S I9000 Android Development

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

Related

[FIX] ext4 for JPM/JP6

Hi,
in case that anybody of you was using Mimocan fix (ext4 on the external SD), here I have attached libs for enabling ext4 on JP6/JPM (without modifying kernel).
I'm personally using ext4 partition on external SD, and loopback file on this partition formatted in ext2.
That way I'm getting 2000 in Quadrant, and the phone is working fast.
Here is my userinit:
Code:
insmod /data/local/fs_jpm/slow-work.ko
insmod /data/local/fs_jpm/jbd2.ko
insmod /data/local/fs_jpm/fscache.ko
insmod /data/local/fs_jpm/mbcache.ko
insmod /data/local/fs_jpm/ext4.ko
busybox mount -t ext4 -o noatime,nodiratime,errors=continue /dev/block/mmcblk1p2 /data/sdcard_ex2_mnt
busybox mknod /dev/loop0 b 7 0
busybox losetup /dev/loop0 /data/sdcard_ex2_mnt/linux.ex2
mount -t ext2 -o noatime,nodiratime,errors=continue /dev/loop0 /data/ext2data
busybox mount -o bind /data/ext2data/data /data/data;
busybox mount -o bind /data/ext2data/app /data/app;
busybox mount -o bind /data/ext2data/dalvik-cache /data/dalvik-cache;
P.S. Thanks for darkbyt3, for making slow_work module!
P.S. 2. Also in the archive is NILFS2 support for those who like experiments , and CIFS by darkbyt3.
thanks for the info.
linux noob question, but where does the userinit file live?
im used to editing scripts in /system/init.d but that was on a custom rom.
/system/bin/userinit.sh
kanemari said:
thanks for the info.
linux noob question, but where does the userinit file live?
im used to editing scripts in /system/init.d but that was on a custom rom.
Click to expand...
Click to collapse
Sorry for being even more of a noob, but can you tell me how to apply the mimocan fix for JPM/JP6 step by step please, I would love to be able to use it.
I have tried all the lag fixes and nothing comes close to what I had with the mimocan fix, even though you get better scores none of them were as smooth as mimocan fix.
Thanks a lot really appreciate the help.
milan2008 said:
Sorry for being even more of a noob, but can you tell me how to apply the mimocan fix for JPM/JP6 step by step please, I would love to be able to use it.
I have tried all the lag fixes and nothing comes close to what I had with the mimocan fix, even though you get better scores none of them were as smooth as mimocan fix.
Thanks a lot really appreciate the help.
Click to expand...
Click to collapse
Like u did i tried many lagfix, feel less lag with voodoo or mimocan compare others, but least lag with combo of voodoo or mimocan with minfree (autokiller preset aggressive). Give it a try...
Hi, sorry for the questions:
How i can do this fix?
Thanks
vitalij said:
Hi,
in case that anybody of you was using Mimocan fix (ext4 on the external SD), here I have attached libs for enabling ext4 on JP6/JPM (without modifying kernel).
I'm personally using ext4 partition on external SD, and loopback file on this partition formatted in ext2.
That way I'm getting 2000 in Quadrant, and the phone is working fast.
Here is my userinit:
Code:
insmod /data/local/fs_jpm/slow-work.ko
insmod /data/local/fs_jpm/jbd2.ko
insmod /data/local/fs_jpm/fscache.ko
insmod /data/local/fs_jpm/mbcache.ko
insmod /data/local/fs_jpm/ext4.ko
busybox mount -t ext4 -o noatime,nodiratime,errors=continue /dev/block/mmcblk1p2 /data/sdcard_ex2_mnt
busybox mknod /dev/loop0 b 7 0
busybox losetup /dev/loop0 /data/sdcard_ex2_mnt/linux.ex2
mount -t ext2 -o noatime,nodiratime,errors=continue /dev/loop0 /data/ext2data
busybox mount -o bind /data/ext2data/data /data/data;
busybox mount -o bind /data/ext2data/app /data/app;
busybox mount -o bind /data/ext2data/dalvik-cache /data/dalvik-cache;
P.S. Thanks for darkbyt3, for making slow_work module!
P.S. 2. Also in the archive is NILFS2 support for those who like experiments , and CIFS by darkbyt3.
Click to expand...
Click to collapse
Isn't there aversion without debug information? 3mb for a kernel module is huge
sztupy said:
Isn't there aversion without debug information? 3mb for a kernel module is huge
Click to expand...
Click to collapse
Maybe, the size is irrelevant for this kind of using these modules - anyway I copy them to /data where I have plenty of space.
Ext4 is working fine, however if used separately without loop device it doesn't produce speed increase, differently from eclair builds.
Sent from my GT-I9000 using XDA App
tanoxxx said:
Hi, sorry for the questions:
How i can do this fix?
Thanks
Click to expand...
Click to collapse
I did it manually, and it have lots of steps. Probably if you were not using mimocan's fix - this lagfix is not for you. You need to repartition sd card, format it, create loop device, and then manually copy data there.
milan2008 said:
Sorry for being even more of a noob, but can you tell me how to apply the mimocan fix for JPM/JP6 step by step please, I would love to be able to use it.
I have tried all the lag fixes and nothing comes close to what I had with the mimocan fix, even though you get better scores none of them were as smooth as mimocan fix.
Thanks a lot really appreciate the help.
Click to expand...
Click to collapse
Well It may contain errors, but I am doing like this:
1) Create second primary partition on the external SD card and make it EXT4 (easiest to do it in external card reader, using PARAGON or GPARTED). And format it of cause. Choose size, for example 1Gb
Remember that first primary partition must remain FAT32
2) Put the card back to phone.
3) You need root and terminal (adb or any terminal on phone)
4) copy modules from my first post to /data/local/fs_jpm/
5) run following commands:
Code:
insmod /data/local/fs_jpm/slow-work.ko
insmod /data/local/fs_jpm/jbd2.ko
insmod /data/local/fs_jpm/fscache.ko
insmod /data/local/fs_jpm/mbcache.ko
insmod /data/local/fs_jpm/ext4.ko
mkdir /data/sdcard_ex2_mnt
busybox mount -t ext4 -o noatime,nodiratime,errors=continue /dev/block/mmcblk1p2 /data/sdcard_ex2_mnt
busybox dd if=/dev/zero of=/data/sdcard_ex2_mnt/linux.ex2 bs=1024 count=800000
Change 800000 to any size of loopback file you want (here it is 800Mb)
Code:
busybox mknod /dev/loop0 b 7 0
busybox losetup /dev/loop0 /data/sdcard_ex2_mnt/linux.ex2
busybox mkfs.ext2 /dev/loop0
mkdir /data/ext2data/
mount -t ext2 -o noatime,nodiratime,errors=continue /dev/loop0 /data/ext2data
cp -rp /data/data /data/ext2data/
cp -rp /data/app /data/ext2data/
cp -rp /data/dalvik-cache /data/ext2data/
mv /system/bin/playlogos1 /system/bin/playlogosnow
copy files from attached system_bin.zip archive, to /system/bin.
Code:
busybox chmod +x /system/bin/userinit
busybox chmod +x /system/bin/playlogos1
then just reboot.
After reboot you can check that correct mounts are used with
Code:
mount
command.
wolfiett said:
/system/bin/userinit.sh
Click to expand...
Click to collapse
i put a script there but it doesnt work... and the script runs fine if i run it from the terminal prompt.
how can i check what the issue is?
vitalij said:
Well It may contain errors, but I am doing like this:
1) Create second primary partition on the external SD card and make it EXT4 (easiest to do it in external card reader, using PARAGON or GPARTED). And format it of cause. Choose size, for example 1Gb
Remember that first primary partition must remain FAT32
2) Put the card back to phone.
3) You need root and terminal (adb or any terminal on phone)
4) copy modules from my first post to /data/local/fs_jpm/
5) run following commands:
Code:
insmod /data/local/fs_jpm/slow-work.ko
insmod /data/local/fs_jpm/jbd2.ko
insmod /data/local/fs_jpm/fscache.ko
insmod /data/local/fs_jpm/mbcache.ko
insmod /data/local/fs_jpm/ext4.ko
mkdir /data/sdcard_ex2_mnt
busybox mount -t ext4 -o noatime,nodiratime,errors=continue /dev/block/mmcblk1p2 /data/sdcard_ex2_mnt
busybox dd if=/dev/zero of=/data/sdcard_ex2_mnt/linux.ex2 bs=1024 count=800000
Change 800000 to any size of loopback file you want (here it is 800Mb)
Code:
busybox mknod /dev/loop0 b 7 0
busybox losetup /dev/loop0 /data/sdcard_ex2_mnt/linux.ex2
busybox mkfs.ext2 /dev/loop0
mkdir /data/ext2data/
mount -t ext2 -o noatime,nodiratime,errors=continue /dev/loop0 /data/ext2data
cp -rp /data/data /data/ext2data/
cp -rp /data/app /data/ext2data/
cp -rp /data/dalvik-cache /data/ext2data/
mv /system/bin/playlogos1 /system/bin/playlogosnow
copy files from attached system_bin.zip archive, to /system/bin.
Code:
busybox chmod +x /system/bin/userinit
busybox chmod +x /system/bin/playlogos1
then just reboot.
After reboot you can check that correct mounts are used with
Code:
mount
command.
Click to expand...
Click to collapse
Thanks a lot, I am going to try it now.
Update: it keeps failing, I am getting `Failed (Operations not permitted)`. I don't know if anyone can help.
I tried it with Tayutama's latest rom.
milan2008 said:
Thanks a lot, I am going to try it now.
Update: it keeps failing, I am getting `Failed (Operations not permitted)`. I don't know if anyone can help.
I tried it with Tayutama's latest rom.
Click to expand...
Click to collapse
At which point are you getting the error? Maybe you /system partition is read-only? try
Code:
su
busybox mount -o remount,rw /system
Or you do not have a root
wolfiett said:
/system/bin/userinit.sh
Click to expand...
Click to collapse
Actually it should be
Code:
/system/bin/userinit

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

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?

[Q] Need help to execute script to switch internal memory with 64GB card for Note 2

Hi,
I have a Samsung Galaxy Note 2 (SGH-T889). I found a script online which had instruction to execute with script manager (SManager). The file is called app2sdNote2.bin. When I run SManager and located the script, I select Su and Boot. When I select Run, SManager just hangs forever until I kill the process. The grant message never appears. I would like to run the script to use my 64 GB memory card as the default storage. Any help is greatly appreciated.
#!/system/bin/sh
#extsd2internalsd is a modification that allows to switch internal sd to external sd and viceversa. With this you can use default internal sd only for app storage #and the external sd to store all apps resource and all others stuff. The resut is a very big increase of installable apps on gs3
#All credits to Mattiadj of xda forum for the idea and script and to mike1986 for the cmw zip.
#xda thread url at
#Script Modified for U.S. Galaxy S3/Note 2 by Zedomax at GalaxyS3Root.com and GalaxyNote2Root.com to be compatible when sdcard is not inserted.
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:17 /mnt/sdcard
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:17 /mnt/sdcard
if busybox mount | busybox grep vold/179:17; then
busybox mount -o bind /data/media /mnt/extSdCard
fi
comicrage said:
Hi,
I have a Samsung Galaxy Note 2 (SGH-T889). I found a script online which had instruction to execute with script manager (SManager). The file is called app2sdNote2.bin. When I run SManager and located the script, I select Su and Boot. When I select Run, SManager just hangs forever until I kill the process. The grant message never appears. I would like to run the script to use my 64 GB memory card as the default storage. Any help is greatly appreciated.
#!/system/bin/sh
#extsd2internalsd is a modification that allows to switch internal sd to external sd and viceversa. With this you can use default internal sd only for app storage #and the external sd to store all apps resource and all others stuff. The resut is a very big increase of installable apps on gs3
#All credits to Mattiadj of xda forum for the idea and script and to mike1986 for the cmw zip.
#xda thread url at
#Script Modified for U.S. Galaxy S3/Note 2 by Zedomax at GalaxyS3Root.com and GalaxyNote2Root.com to be compatible when sdcard is not inserted.
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:17 /mnt/sdcard
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:17 /mnt/sdcard
if busybox mount | busybox grep vold/179:17; then
busybox mount -o bind /data/media /mnt/extSdCard
fi
Click to expand...
Click to collapse
Wrong device thread.
comicrage said:
Hi,
I have a Samsung Galaxy Note 2 (SGH-T889). I found a script online which had instruction to execute with script manager (SManager). The file is called app2sdNote2.bin. When I run SManager and located the script, I select Su and Boot. When I select Run, SManager just hangs forever until I kill the process. The grant message never appears. I would like to run the script to use my 64 GB memory card as the default storage. Any help is greatly appreciated.
#!/system/bin/sh
#extsd2internalsd is a modification that allows to switch internal sd to external sd and viceversa. With this you can use default internal sd only for app storage #and the external sd to store all apps resource and all others stuff. The resut is a very big increase of installable apps on gs3
#All credits to Mattiadj of xda forum for the idea and script and to mike1986 for the cmw zip.
#xda thread url at
#Script Modified for U.S. Galaxy S3/Note 2 by Zedomax at GalaxyS3Root.com and GalaxyNote2Root.com to be compatible when sdcard is not inserted.
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:17 /mnt/sdcard
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:17 /mnt/sdcard
if busybox mount | busybox grep vold/179:17; then
busybox mount -o bind /data/media /mnt/extSdCard
fi
Click to expand...
Click to collapse
Script doesn't work on s4. Tried all the known scripts and so far none work.
Sent from my SGH-M919 using Tapatalk 2

[Q] Make Mount Bind Permanent

Hello People,
I have a question regarding mount bind,
I have one directory on ext-sd that I have mount bind with a directory on sdcard to save space on sdcard with the command,
Code:
mount -o bind /storage/extSdCard/WhatsApp /sdcard/WhatsApp
Now the question is how can I make it permanent as I see it gets unmounted after some time and after a device reboot.
As I see there is no /etc/init.d and I am unsure of how and where to make a start-up script, Searching has been unsuccessful so far
Thanks.

How to put /data on external SD

WORD OF WARNING: if you do this, wiping /data from recovery will not actually wipe data. AND if you install a new ROM, via clean or dirty flash, chances are your large /data partition will go all screwy on you. It did for me. If I flashed anything, it tends to cause boot loops or hangs at the boot animation.
If you are dirty flashing anything, I would first get as much off of the large /data as you can to get it to 2 GB or less, then drop it on top of your 2 GB /data partition, then dirty flash, let everything come back up and get stable then repeat these steps starting at step 2 to blow away your large /data and then mirror your 2 GB /data to your large /data.
The problems I had could be related to xposed, but I am not 100% certain on this. It is my best guess from looking at my logcat (doesn't actually indicate a crash in there, but has a lot of stuff related to xposed).
These steps are more for the non-flashaholics amung us OR people who flash new stuff but roll back to nandroid. Once you pop the larger /data onto any ROM, your nandroid will likely not play nice with it anymore as your larger /data is not restored from a nandroid.
And the normal "warranty is now void" and "if things break, it isn't my fault" disclamer stuff too. But I'm running this right now and liking it (except when I go to jump to KK it may not be happy with me... gonna need to do some testing to nandroids work properly AND so I can flash ROMs without blowing everything up... thinking it is just the dalvik that is unhappy, but I am uncertain at this time)
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
chown system:system /data
restorecon /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the next command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
chown system:system /data - This gives system ownership of /data instead of root as is originally done
restorecon /data - we do this just in case the userdata partition has been reset.
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#!/system/bin/bash" > dataswap
echo "if [ -e \"/dev/block/mmcblk1p2\" ]" >>dataswap
echo "then" >> dataswap
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap
echo "chown system:system /data" >> dataswap
echo "restorecon /data" >> dataswap
echo "fi" >>dataswap
chown root:shell dataswap
chmod 777 dataswap
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
EDIT: cleaned up the instructions a little and added in some recommended steps (the chown and restorecon) and removed the waiting to mount /data as that just makes things unhappy long term.
EDIT: added error handling in case mmcblk1p2 does not exist to the startup script. If it does not exist, it will now NOT swap the partitions. So as a failsafe, if your phone gets stuck at the boot animation, you can power it down, remove the SD card and power it back up to boot with your default /data partition. This should not need to be done, but there is a chance that your SD card could die or your new /data partition get corrupted, this will allow you to recover safely and will likely only require you to re-create your data partition and NOT have to re-do your whole ROM due to something going bad on the big /data.
Dang...found a bug: it looks like if you leave it for a few days or reboot our something(have not narrowed it down yet) some apps stop working... investigating it and should have a solution sometime tonight... sorry to all those who have tried this... if you have not done much, I'd suggest switching back to normal /data until I get the bug sorted out. My best guess is that reboot doesn't unmount the partition cleanly but I'm not positive...
bmg002 said:
I was having issues with my /data partition getting full on me after getting new ROMs set up. This was irritating me and I came to the conclusion that 2 GB was just not enough space for some of the larger apps out there. So I went ahead and started investigating and testing how to get /data onto the external SD card.
2 complications arise:
1) it needs to be in ext4 format to preserve permissions
2) it needs to be swapped post boot AFTER the sd card is mounted (potentially, I have not fully tested this).
So this becomes a multi step process. What you need:
1) an external SD card that is at least 2 GB in size if not larger (I recommend larger simply because what is the point of having it on external storage if you aren't gaining any extra space)
2) a SGH-T989D (I do not have an SGH-T989 to test it with BUT I am confident it will work with that one too)
3) some partitioning software on your PC (I recommend EaseUS or AOMEI, but use whatever you are comforatble with)
4) latest version of busybox installed on your phone
So, the steps to do this:
1) partition your external SD card into at least 2 partitions, where your second partition will be used for /data. The first partition automatically mounts to /storage/sdcard1, but partition 2 will NOT auto-mount. You do not need to format this if you do not want to. This is up to you how you do it.
2) Run the following commands from either adb shell OR android terminal:
su
mke2fs /dev/block/mmcblk1p2
mkdir /storage/sdcard1/PARTITION2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard1/PARTITION2
rsync -HpogEvrl /data/* /storage/sdcard1/PARTITION2
busybox umount -l /storage/sdcard1/PARTITION2
mount -o remount,errors=continue /data
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
brief explaination of the above commands:
su - switch user to root
mke2fs - format the block device as ext4
mkdir - make directory
mount -t ext4 - mount a block device of type ext4 from /dev/block/mmcblk1p2 to /storage/sdcard1/PARTITION2
rsync -HpogEvrl - copy files from /data/* to /storage/sdcard1/PARTITION2 preserving all attributes (including owner and group)
busybox umount -l - use the busybox version of umount to do a lazy unmount of /storage/sdcard1/PARTITION2. this will unmount it even if files are locking it
mount -o remount,errors=continue /data - remounts the data partition telling it to continue instead of kernel panic if there is any errors reading or writing to that mount point
and the last command is actually 2:
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
this does a lazy unmount of /data and then mounts /dev/block/mmcblk1p2 to /data with the appropriate parameters for the /data parameter
3) OPTIONAL delete the directory /storage/sdcard1/PARTITION2. This is just cleanup, it is not neccessary to do.
When you reboot your phone, your /data directory will remount to the 2 GB partition as it did originally. To remount it to your newly created /data partition, run the following 2 commands:
su
busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data
Now, you can make this into a nice and easy startup script by following these simple steps from adb shell or android terminal (NOTE this assumes that your ROM supports userinit.d and init.d):
su
cd /data/local/userinit.d
echo "#/sys/bin/bash" > dataswap.sh
echo "while [ \`mount | grep -c sdcard\` -lt 3 ]" >> dataswap.sh
echo "do" >> dataswap.sh
echo "sleep 10" >> dataswap.sh
echo "done" >> dataswap.sh
echo "busybox umount -l /data && mount -t ext4 -o rw,seclabel,errors=continue,user_xattr,acl,barrier=1,data=ordered,noauto_da_alloc /dev/block/mmcblk1p2 /data" >> dataswap.sh
chown root:shell dataswap.sh
chmod 777 dataswap.sh
and now when you reboot your phone you will have your external SD cards partition 2 as your /data directory.
If your phone has init.d support, look in your /system/etc/init.d folder for a script named "90userinit". If it is not there, you will need to either make it and have it run userinit.d OR change the line:
cd /data/local/userinit.d
to
cd /system/etc/init.d
mount -o remount,rw /system
now for the warning stuff:
1) I strongly recommend that you do NOT put this into your /data/local/userinit.d folder until you are 110% certain that it worked on your device with your ROM. The reason for this is if it fails and you don't have it in that folder, simply reboot and your phone is back to using /data from partition 25 on your internal memory
2) I strongly recommend you do a nandroid before you begin. That way in the very slim chance that something goes horridly wrong, you can recover
3) I strongly recommend you back up your external SD card before you begin resizing your partitions. Resizing partitions may result in data loss.
4)I take no responsibility for any data loss
5) I have ONLY tested this on a SGH-T989D running HellyBean (Android 4.3). I cannot make any comments on other ROMS, but as long as the ROM has busybox, root, and init.d support, this should work.
6) If you get ANY ERRORS from ANY of the above commands, stop everything and either post in this thread or start over. I have done this twice on my phone to make sure that the steps are as solid as I know how to make them. The only thing I haven't fully tested is putting it into a startup script.
One thing I notice, sometimes when you unmount and remount /data, any data changes in your currently running apps (ie you get a text message while doing this or you start a game up while /data is being sync'ed) may cause odd data issues when the two swap and may cause your phone to jump back to the boot animation. If this occurs, try waiting approximately 1 minute OR until adb shell drops out; whatever comes first. At that point, something has likely gone sour. Reboot your phone and things will be back how they were prior to step 2 (step 1 is permanent until you change that).
Questions, comments, suggestions? Please leave them in the thread, not in PM. If I get any PM's about this thread, I'll do my best to answer, but I may end up posting your PM in this thread to help others.
Click to expand...
Click to collapse
So found a solution to crashing apps . Load up the play store and update your apps. Worked for me anyways.
Now to fix a potential mounting bug in the op, put any scripts on a different ext4 position such as/system/xbin or/system/etc/init.d.
I'll keep you posted if I find other bugs.
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
Bleh new bug:
When you unplug it from a pc, it gets confused and you get io errors which cause it to crash back to the boot animation and get stuck there... too tired to debug out tonight but I'll poke at it tomorrow... thinking I may need to build a kernel module for this... or a custom kernel
Sent from my SAMSUNG-SGH-T989 using xda app-developers app
So the unplugging issue seems quite intermittent and I am unable to get consistent results with it. So I am not sure if it is a bug or not. I updated the OP to have error handling so you can pull your SD card out to mount the 2 GB /data that your phone normally does instead of your big one in the event that something goes wrong.
Hrm... so my testing and further development with this has taken a temporary pause due to my SD card dying on me. Stupid SD card... haven't even had it a year. Hoping I can find the reciept. But once I get it replaced, I'll be jumping in on this some more. I have a few cool ideas that we can do by moving partitions to external storage...
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
hatememarkz said:
What's the deal with cause this would so help with games but is it possible to maybe if possible extend the internal storage
snt? from? sumthiN 4.4+ ?via a ?T989
Click to expand...
Click to collapse
From my testing it seems to work but puts a heavy load the sd card. And if your sd card fails you will lose some data.
I have not tested this on KitKat yet but that is my plan soon.
Sent from my SM-T310 using xda app-developers app

Categories

Resources