[Q&A] Mounts2SD - Storage & Memory Management - Android Software/Hacking General [Developers Only]

Mounts2SD - Storage & Memory Management
The Opening Post (OP) has been moved to a new DevDB Section
This Thread has been assigned as an Q&A.
You should see a new pane above where you can navigate this project.

About dalvik-cache? It remains in phone memory?

Hi I cant understand How to use it ! any guide ?!

denzel09 said:
About dalvik-cache? It remains in phone memory?
Click to expand...
Click to collapse
dalvik-cache remains, so does all of the app related data. Only the APK's is moved.
Taki2011 said:
Hi I cant understand How to use it ! any guide ?!
Click to expand...
Click to collapse
First of all you need a custom rom. If you have a stock rom it will not work since you need a rom that will allow custom scripts during boot.
You will also need to know how to use ADB (An android tool for communicating with your phone. It is used to enter the android shell and also to transfer files to and from the phone, among other things).
And last, you will need at least 2 or 3 partitions on your sdcard (Otherwise it's a waste of time, although the script is build to adapt for these scenarios). One as a regular fat32 sdcard partition, one for the sd-ext and one for the cache. (Use ext2 for the last two. ext3 will eat your card to fast)
Here is the steps (You need to have ADB working on your computer).
Copy/Paste the script content into a file editor and safe the file with the name "99mounts2sd"
Plug your phone to your computer using a usb cable (Select charge only on your phone))
Open a terminal on your computer (In windows use "run" and type "cmd")
Type in shell: "adb shell mount -o remount,rw /system"
Type in shell: "adb push <path to script> /system/etc/init.d/"
Type in shell: "adb shell chmod a+x /system/etc/init.d/99mounts2sd"
Reboot your phone
The first time you boot your phone using the script it will take some time, because the script needs to copy all of your APK's from internal storage to the sd-ext partition.

The script has been rewritten. Better checks and more options has been added.

Great script
Sent from my GT-S5570 using Tapatalk

It didn't work for me, I made the files made sure they were in the right place and rebooted but booted normally. No delay on first boot and still seems to not be using the other two partitions on my sd card. i used cwm4 to partiton my SD card and it is partitioned correctly (3 partitons). I see the script says "log" I don't know where the log is stored or how to view it. Thanks.

To see the log, type in the terminal: "logcat | grep mounts2sd". Download a terminal or use ADB.
Also run the command "df -h" to see what is mounted where.
Sent from my HTC Desire using xda premium

thanks for the share.

#7 @dyehya
It seams that logcat has a very limited lifetime. In order to get the log info, you would have to get it during boot.
Instead I have updated the script to do this itself. Update your script and config file content with the new above code.
In the config file set VAR_DEBUG="yes" and reboot your phone. Now enter a terminal and type "cat /var/mounts2sd.log | grep mounts2sd" which will show you all the messages from the script, and possible errors, if any.

I am not sure what is going on in boot. I just saw your replies and haven't had a chance to update the script and mess with the phone. I do know that when I was playing with it before it kept using the busybox minimal that was in the kernel loaded in sbin I tried copying your version of busybox into bin and xbin (and now reverted back) but it would still use the one in sbin. What I would really like to do and would recommend is you design the script where you can put busybox in a certain location and the script will use that version over any other versions. I am still learning with all this and despite being able to create the files throw them in the correct places I don't know the code well enough to do this myself. Thanks again for all your help.

Ok i have changed the script so that it now forces the usage of /system/xbin/busybox or /system/bin/busybox and ignores /sbin/busybox
Place a full busybox version in one of the system bin folders, update the script and see what happends.
Otherwise paste a copy of "df -h" and "cat /data/mounts2sd.log | grep mounts2sd" here so that I can see what it does during boot.

Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !

virus2013 said:
Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !
Click to expand...
Click to collapse
That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?

dk_zero-cool said:
That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?
Click to expand...
Click to collapse
Sorry, I'm tired... :-\
In fact, I just wanna be sure that the busybox in /system/bin was executable as I pushed it into the rom zip. And as chmod was already used upper, I was thinking it could be a good idea. However, I'm not a script writer! ;-)
Sent from my Desire running ICS

Hello Cool,
trying ICS with your script. Here is the output of logcat an df -h command:
Code:
# cat /data/mounts2sd.log | grep mounts2sd
cat /data/mounts2sd.log | grep mounts2sd
12-14 13:05:12.905 V/mounts2sd( 96): Initiating Mounts2SD (v:1.1.1)...
12-14 13:05:12.985 V/mounts2sd( 101): Including configuration file...
12-14 13:05:14.897 V/mounts2sd( 212): Searching for sdcard...
12-14 13:05:15.277 V/mounts2sd( 231): Searching for sd-ext partition (/dev/block/mmcblk0p2)...
12-14 13:05:16.198 V/mounts2sd( 254): sd-ext partition was mounted successfully...
12-14 13:05:16.728 V/mounts2sd( 278): Moving /data/app to /sd-ext/app...
12-14 13:05:17.049 V/mounts2sd( 297): Moving /data/app-private to /sd-ext/app-private...
12-14 13:05:17.209 V/mounts2sd( 305): Searching for the sd-cache partition (/dev/block/mmcblk0p3)...
12-14 13:05:18.050 V/mounts2sd( 326): sd-cache was mounted successfully...
12-14 13:05:18.280 V/mounts2sd( 335): A device is already mounted at /cache. Umounting it...
12-14 13:05:18.420 V/mounts2sd( 341): Moving /cache to /sd-cache...
12-14 13:05:18.440 V/mounts2sd( 342): Done!
df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 202.9M 32.0K 202.9M 0% /dev
tmpfs 202.9M 0 202.9M 0% /mnt/asec
tmpfs 202.9M 0 202.9M 0% /mnt/obb
/dev/block/mtdblock3 250.0M 165.0M 85.0M 66% /system
/dev/block/mtdblock5 147.6M 62.4M 85.2M 42% /data
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /sd-ext
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /data/app
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /data/app-private
/dev/block/mmcblk0p3 295.9M 168.0K 295.8M 0% /sd-cache
/dev/block/mmcblk0p3 295.9M 168.0K 295.8M 0% /cache
/dev/block/vold/179:1
6.2G 4.6G 1.6G 75% /mnt/sdcard
/dev/block/vold/179:1
6.2G 4.6G 1.6G 75% /mnt/secure/asec
This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?
Thanks for the script though!
Cheers, keep up the good work.

jukyO said:
This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?
Thanks for the script though!
Cheers, keep up the good work.
Click to expand...
Click to collapse
That looks as it should.
The whole /data is not moved to the /sd-ext for that simple reason that there are no hboot out there with 0mb /data.
I have options in my script to move both the .apk files (The applications) and the dalvik-cache which are the biggest things in the /data partition. If I moved everything to sd-ext, there would be nothing using the remaining space available on the internal data which is a waste of good space. It's like having an extra room in your house that is not used for anything at all. If we have to have it, we might as well use it
BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf

dk_zero-cool said:
BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf
Click to expand...
Click to collapse
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.

uzi2 said:
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
Click to expand...
Click to collapse
You don't need a .conf file now - it's not used. You simply install the zip and then use the m2sd commands in terminal to make changes (see instructions in OP - type m2sd help for more info)

uzi2 said:
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
Click to expand...
Click to collapse
The config files is deprecated and replaced with the "m2sd" command, as said above. Settings is saved to /data/.m2sd which means that it keeps your settings when you flash new ROM's as long as you don't wipe data.

Related

[FIXED] full r/w access via overlay filesystem

Hey guys!
Together with some others at android-hilfe.de I'm working on an overlay filesystem for the Desire.
We've chosen aufs (Another Unionfs) to implement our idea.
Basically, two filesystems are combined to a single one.
The first filesystem contains the initial data. The second one is used to overlap it.
Aufs first searches the second for files, then the first. We plan to use a fully writeable filesystem for the second and a secured filesystem for the first.
If you want to modify a file on the first partition, you can put it on the second filesystem and change it there.
So we can get indirect write access to the secured filesystem by mounting the aufs partition to the right path so that the system sees it as the original, secured filesystem.
In theory, a full r/w acces to the all partions on the phone could be possible.
Visit the project site for files and instructions.
that is actually a pretty good idea... and would be awesome if it could be implemented i have no experience in android development and would therefore not be at much help there, but i could help you with testing, as i don't use my phone for any important stuff
antweb said:
Hey guys!
Together with some guys at android-hilfe.de I'm working on an overlay filesystem for the Desire.
We've chosen aufs (Another Unionfs) to implement our idea.
.......
We still could use some help, as for now we are only 2 active developers.
Click to expand...
Click to collapse
Nice thought. Wish i could help
Great idea, and it seems it should work and will obviate the need for a eng-SPL.
Have you tried it ? You seem to have all the necessary bits (you don't really need the utils) so i'm not sure what else you need at this point. This should work with adb in normal mode (ie not recovery) as you should be able to remount the system ontop of itself like so:
adb shell
first to get to your desire root shell. Then do
insmod aufs2
Then create some persistent storage on your sdcard
mkdir /sdcard/sysrw
Then mount the dir
mount -t aufs -o br=/sdcard/sysrw=rw:/system=ro none /system
you should now be able to write to /system, so try doing a
touch /system/foo
If that works, you should be away.
Clearly your modules you provide above will be specific to a certain kernel and with so many ROMS out there i can't say it will work with the one i have so you can try and report back.
Putting the persistent storage on the sdcard means that when it is mounted via usb you will loose access to it and bad things will happen.
Also remember if this works you need to add this to your init scripts
daveba said:
mount -t aufs -o br=/sdcard/sysrw=rw:/system=ro none /system
Click to expand...
Click to collapse
This step fails. All I get is
Code:
mount: No such Device
daveba said:
Clearly your modules you provide above will be specific to a certain kernel and with so many ROMS out there i can't say it will work with the one i have so you can try and report back.
Click to expand...
Click to collapse
Every ROM (with a custom kernel) will need some kernel patches anyways as otherwise many simbols are missing (and sure some other stuff, no clue what the aufs kernel patches do in detail). The attachements include a patched stock kernel. To try it out, you'll have to install the included kernel.
daveba said:
Also remember if this works you need to add this to your init scripts
Click to expand...
Click to collapse
Yep, thats the next step after I get a successful mount.
antweb said:
This step fails. All I get is
Code:
mount: No such Device
Click to expand...
Click to collapse
So it looks like the mount command doesn't accept 'none' as a non-device argument perhaps which i find strange since /proc is one of those also. Are you getting any messages from 'dmesg' or 'logcat' ?
My basic question:
If we use more and more the SD card, i believe we will drain more and more battery.
Apps2sd, system2sd etc
Or it is not draining more battery the extended sd usage?
billias said:
My basic question:
If we use more and more the SD card, i believe we will drain more and more battery.
Apps2sd, system2sd etc
Or it is not draining more battery the extended sd usage?
Click to expand...
Click to collapse
Not much stuff gets written to /system constantly. Just a few changes so you shouldn't see much of a drain.
Ok, so it looks like this actually works. You can't put the rw partition on a VFAT sdcard partiton only. SO in theory if you make a ext{123} partition on your sdcard it should work. For now i tried with the writeable mtd /data partition on my CM nightly and all works. Look:
Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo
-rw-rw-rw- 1 root root 0 Aug 8 20:30 /system/foo
A writeable /system !!!
And here is the real data on /data/rw
Code:
ls -l /data/rw/
-rw-rw-rw- 1 root root 0 Aug 8 20:30 foo
In theory Metamorph, adblock and all the rest that require /system should now work as expected.
daveba said:
Ok, so it looks like this actually works. You can't put the rw partition on a VFAT sdcard partiton only. SO in theory if you make a ext{123} partition on your sdcard it should work. For now i tried with the writeable mtd /data partition on my CM nightly and all works. Look:
Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo
-rw-rw-rw- 1 root root 0 Aug 8 20:30 /system/foo
A writeable /system !!!
And here is the real data on /data/rw
Code:
ls -l /data/rw/
-rw-rw-rw- 1 root root 0 Aug 8 20:30 foo
In theory Metamorph, adblock and all the rest that require /system should now work as expected.
Click to expand...
Click to collapse
could you try metamorph?
finally....
Nice work!! :O
Edit: Ok I tried this but metamorph still gives me an error when trying to set it up.
daveba said:
Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo
-rw-rw-rw- 1 root root 0 Aug 8 20:30 /system/foo
Click to expand...
Click to collapse
cTrox said:
Nice work!! :O
Edit: Ok I tried this but metamorph still gives me an error when trying to set it up.
Click to expand...
Click to collapse
Really ? I just tried it and it worked fine for me...
Could anyone give a step by step guide on doing this?
daveba said:
Really ? I just tried it and it worked fine for me...
Click to expand...
Click to collapse
Oh I just saw, that metamorph is giving me an error because I havn't got enough free space in /system. How much do I need? I have 20MB free.
Ireas said:
Could anyone give a step by step guide on doing this?
Click to expand...
Click to collapse
+1 I'm very interested on this
cTrox said:
Oh I just saw, that metamorph is giving me an error because I havn't got enough free space in /system. How much do I need? I have 20MB free.
Click to expand...
Click to collapse
Where did you put the writeable partition on ? Ensure it has enough space. I'm not sure exactly what checks metamorph does when it runs but it definetly succeeded for me.
shawe_ewahs said:
+1 I'm very interested on this
Click to expand...
Click to collapse
It's exactly as i wrote in the previous page.
You'll need to ROM to have the aufs overlay 'filesystem' built in or as a module. If you're on CM6 you're lucky as it has it builtin (i was suprised it loaded when i did the modprobe myself as i didn't think it was included).
You should see a aufs.ko if it's built in as a module. Try running a jar/grep on your ROM of choice to see if it's included
Code:
jar tvf RoufianosV6.zip |grep aufs
gives no output, but
Code:
jar tvf cm_bravo-08082010-104323.zip |grep aufs
169400 Fri Feb 29 02:33:46 GST 2008 system/lib/modules/2.6.34.2-cyanogenmod/kernel/fs/aufs/aufs.ko
does.
You can do the steps described earlier (via adb) when your desire is fully booted as it doesn't require it at recovery only.
This needs to be pushed out to rom creators as it needs to be included in the startup scripts or else the next time you reboot your desire you'll lose all changes you made while the overlay was active.
daveba said:
This needs to be pushed out to rom creators as it needs to be included in the startup scripts or else the next time you reboot your desire you'll lose all changes you made while the overlay was active.
Click to expand...
Click to collapse
Oh that's why it didn't work I thought I might have to reboot the device to get access
Thanx guys ! Someone tested on 2.2
Sent from my HTC Desire using XDA App

Experiments with GB Kernel

I'm opening this thread to share information about experiments with the new GB kernel with other devs/contributors of M2 community.
Based on the idea of dual-booting I managed today to get my phone running using system directly from an image on /data.
The base system installed is boot/devtree/recovery from signed GB Leak with Mostly Blurless ROM. I created an image from this same system with dd if=/dev/block/system of=/data/blurless.img.
I then edited bootmenu 2nd-int init.rc to:
- comment lines that mount /data and /system
- added the following lines:
Code:
mount ext3 [email protected] /data nosuid nodev noatime nodiratime barrier=0
mount ext3 [email protected]/data/blurless.img /system noatime nodiratime barrier=1
In init.mapphone_umts.rc:
- commented lines that remounts /system
- added following line:
Code:
mount ext3 [email protected]/data/blurless-system.img /system ro noatime nodiratime remount
In /system/bootmenu/scripts/2nd-init.sh:
Code:
#!/sbin/sh
######## BootMenu Script v0.8.6
######## Execute [2nd-init] Menu
export PATH=/sbin:/system/xbin:/system/bin
######## Main Script
rm /*.rc
cp -r -f /system/bootmenu/2nd-init/* /
cp -fp /system/bootmenu/binary/2nd-init /sbin/
chmod 755 /*.rc
#chmod 755 /system/bootmenu/binary/2nd-init
chmod 755 /sbin/2nd-init
umount /acct
umount /mnt/asec
umount /dev/cpuctl
umount /dev/pts
umount /mnt/obb
## sbin cleanup
## move post_bootmenu.sh
#/system/bootmenu/binary/2nd-init
umount -l /system
/sbin/2nd-init
exit
Works fine and system is really mounted on loopback device after boot. Now I want to mount on init.rc /data as a bind fs. Does anyone know how to do that as a init.rc script command?
As a test I tried
mount ext3 [email protected]/data/system /mnt/data
but it didn't work
Ok. I found a way to do that mounting data first as /mnt/data then mounting loopback system. with system ready I can mount bind /data with the following command:
exec /system/xbin/busybox mount -obind /mnt/data/rom/blurless-data /data
I'd like better to mount this with a native init command if anybody knows how to, but for the moment this will do.
It doesn't work because bind is not supported by the original mount command ?
Anyway, may be you can do symlink with the data directory .
But good job allowing us to test img system without breaking existing one !
Trying now to boot MIUI on a second system image I get the following error:
08-26 21:06:40.773 2971 2979 E FramebufferNativeWindow: couldn't open framebuffer HAL (No such device)
I'm not sure if this error was caused by kernel incompatibility or by some special file libsurfaceflinger could not find. Doing strings | grep on libsurfaceflinger.so from miui I could find this references:
/dev/tty0
/sys/android_power/wait_for_fb_sleep
/sys/android_power/wait_for_fb_wake
/sys/class/graphics/fbcon
/sys/power/wait_for_fb_sleep
/sys/power/wait_for_fb_wake
Maybe we can map old devices to new devices (ln -s) at run time and make it work but I don't know exactly how to map them.
Edit: I am unable to create anything in /sys, even mounting it as RW. Does n1 know what I should do?
Yeah! You rule!
r2beta0 said:
Trying now to boot MIUI on a second system image I get the following error:
08-26 21:06:40.773 2971 2979 E FramebufferNativeWindow: couldn't open framebuffer HAL (No such device)
I'm not sure if this error was caused by kernel incompatibility or by some special file libsurfaceflinger could not find. Doing strings | grep on libsurfaceflinger.so from miui I could find this references:
/dev/tty0
/sys/android_power/wait_for_fb_sleep
/sys/android_power/wait_for_fb_wake
/sys/class/graphics/fbcon
/sys/power/wait_for_fb_sleep
/sys/power/wait_for_fb_wake
Maybe we can map old devices to new devices (ln -s) at run time and make it work but I don't know exactly how to map them.
Edit: I am unable to create anything in /sys, even mounting it as RW. Does n1 know what I should do?
Click to expand...
Click to collapse
Ok. for your system find all it needs, you have to "bind" (by anyway i think) /proc and /sys . Like a normal linux when you do a chroot. I don't know the exact order of execution of your script, but before anything else, you must have proper /proc , /sys ,/dev . For example, here it what we need in to do in linux,
#!/bin/bash
mount --bind /dev /répertoire-vers-votre-chroot/dev
mount --bind /dev/pts /répertoire-vers-votre-chroot/dev/pts
mount --bind /dev/shm /répertoire-vers-votre-chroot/dev/shm
mount -t proc none /répertoire-vers-votre-chroot/proc
mount -t sysfs none /répertoire-vers-votre-chroot/sys
As you can't bind them with mount, try the symlink , it might work (i dont see why not) . These directories are created by the kernel , maybe there are other in android , i don't know.
Try that and let me know , it should do the trick !
Edit: i read too fast! It couldnt be that, as you dont change / .
r2beta0 said:
Trying now to boot MIUI on a second system image I get the following error:
08-26 21:06:40.773 2971 2979 E FramebufferNativeWindow: couldn't open framebuffer HAL (No such device)
I'm not sure if this error was caused by kernel incompatibility or by some special file libsurfaceflinger could not find. Doing strings | grep on libsurfaceflinger.so from miui I could find this references:
/dev/tty0
/sys/android_power/wait_for_fb_sleep
/sys/android_power/wait_for_fb_wake
/sys/class/graphics/fbcon
/sys/power/wait_for_fb_sleep
/sys/power/wait_for_fb_wake
Maybe we can map old devices to new devices (ln -s) at run time and make it work but I don't know exactly how to map them.
Edit: I am unable to create anything in /sys, even mounting it as RW. Does n1 know what I should do?
Click to expand...
Click to collapse
Isn't MIUI and CM7 running on top of froyo kernel/dev tree?
I remember I got the same HAL issue when I tried to run unsigned GB on froyo kernel. I assume trying to run froyo based rom's on 2.3.4 kernel will show the same issues.
n3ptun3 said:
Isn't MIUI and CM7 running on top of froyo kernel/dev tree?
I remember I got the same HAL issue when I tried to run unsigned GB on froyo kernel. I assume trying to run froyo based rom's on 2.3.4 kernel will show the same issues.
Click to expand...
Click to collapse
Hm... maybe you're right. The new nightly CM from Defy should work with GB kernel I think.
Sent from my Milestone 2 XDA App
dangpzanco said:
Hm... maybe you're right. The new nightly CM from Defy should work with GB kernel I think.
Sent from my Milestone 2 XDA App
Click to expand...
Click to collapse
I wouldn't bet on it. 2nd-init might be GB ready, but Defy's CM7 is still built over a froyo base. If I have time this weekend I'll experiment on D2G CM7 with GB base.
Just let GB kernel boot CM7. ch-2.2 kernel suck in touch screen.
n3ptun3 said:
I wouldn't bet on it. 2nd-init might be GB ready, but Defy's CM7 is still built over a froyo base. If I have time this weekend I'll experiment on D2G CM7 with GB base.
Click to expand...
Click to collapse
I can't boot CM7 0826 nightly bulid with both ch-2.2.2/GB kernels. Anyone know why? The author has changed the 2nd-init?
Edit: I think I know why. The author delete 2nd-init in /binary. So we need to change the boot method to 2nd-boot. GB kernel isn't suported yet.
Endless7 said:
Edit: I think I know why. The author delete 2nd-init in /binary. So we need to change the boot method to 2nd-boot. GB kernel isn't suported yet.
Click to expand...
Click to collapse
That seems to be a mistake and was fixed in 3e3c820adecf812e3dfea872a184f5f428fd4fbc (Allow 2nd-init support with bootmenu, which is stored in system image). It was caused by heavy restructuring of the motorola common boot-code in the CM7 repository. Just copy my 2nd-init into the binary directory, and you should be fine.
pat972 said:
Ok. for your system find all it needs, you have to "bind" (by anyway i think) /proc and /sys . Like a normal linux when you do a chroot. I don't know the exact order of execution of your script, but before anything else, you must have proper /proc , /sys ,/dev . For example, here it what we need in to do in linux,
#!/bin/bash
mount --bind /dev /répertoire-vers-votre-chroot/dev
mount --bind /dev/pts /répertoire-vers-votre-chroot/dev/pts
mount --bind /dev/shm /répertoire-vers-votre-chroot/dev/shm
mount -t proc none /répertoire-vers-votre-chroot/proc
mount -t sysfs none /répertoire-vers-votre-chroot/sys
As you can't bind them with mount, try the symlink , it might work (i dont see why not) . These directories are created by the kernel , maybe there are other in android , i don't know.
Try that and let me know , it should do the trick !
Edit: i read too fast! It couldnt be that, as you dont change / .
Click to expand...
Click to collapse
It's a good idea, as I can bind filesystems using busybox mount. It needs just some engineering into 2nd-init script like copying busybox to /sbin and forcing umount of /dev /proc and /sys, but it can be done.
How do I clone /sys to some other folder like /data/sys? I tried with 'cp -a' but it doesn't work fine. As I see I have to clone /sys and make some symlinks on this clone. Then I bind it with original /sys on init.rc. Is that right?
r2beta0 said:
It's a good idea, as I can bind filesystems using busybox mount. It needs just some engineering into 2nd-init script like copying busybox to /sbin and forcing umount of /dev /proc and /sys, but it can be done.
How do I clone /sys to some other folder like /data/sys? I tried with 'cp -a' but it doesn't work fine. As I see I have to clone /sys and make some symlinks on this clone. Then I bind it with original /sys on init.rc. Is that right?
Click to expand...
Click to collapse
I would not unmount /dev /proc and /sys, they are closely related to kernel init, in linux desktop it the first thing rc.sysinit does.
I was thinking more to something like "ln -s /sys/ /data/sys" , and one other solution i've just tested, is to do a "mount -n -t sysfs sys /data/sys -o nosuid,noexec,nodev" ! The difference for me is that with the mount command you'll not be able to umount /data/sys until reboot ! With the symlink you can just rm it when you finish.
The bind option is usefull cause when you do a chroot, you don't have access the other part of the system , so i'm not sure the symlink method work in that case. i'll ask and tell you.
Edit : I confirm It's that well about bind and chroot. and it seems to me , you can't create file in /sys , the kernel create them and you can read/change values. If you create one, it will not be taken in account by the kernel.
Also can you light up my lantern, which script in /system is called after the 2nd-init to launch the MIUI ?
pat972 said:
I would not unmount /dev /proc and /sys, they are closely related to kernel init, in linux desktop it the first thing rc.sysinit does.
I was thinking more to something like "ln -s /sys/ /data/sys" , and one other solution i've just tested, is to do a "mount -n -t sysfs sys /data/sys -o nosuid,noexec,nodev" ! The difference for me is that with the mount command you'll not be able to umount /data/sys until reboot ! With the symlink you can just rm it when you finish.
The bind option is usefull cause when you do a chroot, you don't have access the other part of the system , so i'm not sure the symlink method work in that case. i'll ask and tell you.
Edit : I confirm It's that well about bind and chroot. and it seems to me , you can't create file in /sys , the kernel create them and you can read/change values. If you create one, it will not be taken in account by the kernel.
Also can you light up my lantern, which script in /system is called after the 2nd-init to launch the MIUI ?
Click to expand...
Click to collapse
When you use bootmenu to start 2nd-init it will run a script called /system/bootmenu/script/2nd-init.sh. The last line of this script is 2nd-init binary itself. When you call 2nd-init binary it forks init on top of itself causing something like a hot restart. So, what 2nd-init script does is remount / as RW and copy new init.rc, init.mpaphone_umts.rc and init binary to /. Then it calls 2nd-init binary in order to use your custom files instead of stock ones. You can do anything you like on init.rc, as I did to boot MIUI from a loopback device. Unfortunately MIUI was compiled for froyo kernel and can't find some devices it needs to work. Thats why I need to create symlinks inside /sys and I think I already found a way to do that. Will test and explain that later.
Ok thanks !
Even with the new symlinks the system is unable to boot. As I suspected it is far more complicated then just adding links to /sys, too bad. I think the only way we have to boot multi-systems with multi-kernels (like miui on froyo and stock on gb) will be using kexec hack. n1 know if some group already found a way to run kexec on milestone or milestone2?
You can't rebuilt miui over a generic 2.6.32 kernel ? Well i'm a total newb in rom dev, i assume the officiel ginger from google won't work, you must have some specific hardware stuff ! For kexec it seems they have some driver problem, but since you want to boot the moto kernel may be it'll be easier !
pat972 said:
You can't rebuilt miui over a generic 2.6.32 kernel ? Well i'm a total newb in rom dev, i assume the officiel ginger from google won't work, you must have some specific hardware stuff ! For kexec it seems they have some driver problem, but since you want to boot the moto kernel may be it'll be easier !
Click to expand...
Click to collapse
MIUI is closed source, so only team members are able to rebuilt it
Do you know how can I use kexec to boot moto kernel?
r2beta0 said:
MIUI is closed source, so only team members are able to rebuilt it
Click to expand...
Click to collapse
This is illegal - violation of GPL license. If they modified Linux kernel they should give users source code to those modifications.

SGY Bootscript

What is it ?
Bootscript is small modification to SGY's init.rc, to run several shell script on spesific boot event. Right now it's support 5 event :
1. init, before system partition mounted
2. post-system, after system partition mounted
3. post-cache, after cache partition mounted
4. post-data, after data partition mounted
5. done, before service run
Bootscript also have init.d support. init.d run after "done" script running.
Why ?
Originally i write this script to make my dual boot script easier to customise. But then i relize that it can be use to create another cool thing.
How ?
First download and flash Bootscript (Link at bottom of post). Put that file on PDA field if you use Odin or unpack tar file if you use other method. It's modification from DXLC1 boot.img. If you want study my mod, unpack ramfs from boot.img and look at "init.rc" and "sbin/bootscript.sh".
Create folder ".bootscript" in your sdcard (1st,fat partition) root. Put your script there. Your script must have name "init","post-system","post-cache","post-data","done". You don't need all 5 files, use only event you needed.
Before running your script, Bootscript copy all your ".bootscript" content to "/tmp/bootscript". You can add other file(s) beside your script in ".bootscript" folder but keep it small in size because all that file(s) will eat your ram. You can delete "/tmp/bootscript" content in your script, except in "done" script. When "done" running, your root path already become read only. If you need do clean up, do it in "post-data" and use "/data" as your temporary (but make sure you don't delete "done" script).
Bootscript ramfs have build-in busybox. You have to use that for your "init" script interpreter because "init" script run before system partition mounted. Just put in first line of your script
Code:
#!/sbin/busybox.boot sh
What is the drawback ?
Depend on your script, it can slow down your boot process. With Bootscript you can easily mess up your device. Use only if you familiar with android boot process and shell scripting. If you concern about security, if used without care, Bootscript can make your device unsecure because it's put importance boot process on unsecure location (sdcard).
What it can do ?
A lot. Few example :
1. Dual boot
2. Temporary install themes
3. Data2SD
4. Backup your applications
Where I can get it
boot-script-0.1.tar
Dual Boot
Use same partition and and custom rom instalation process as in http://forum.xda-developers.com/showthread.php?t=1598803 . Save this scripts in ".bootscript" in your sdcard
post-system
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p2
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /system
$BUSYBOX mount -t $PART_TYPE $PART_DEV /system
fi
post-cache
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p3
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /cache
$BUSYBOX mount -t $PART_TYPE $PART_DEV /cache
fi
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p4
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /data
$BUSYBOX mount -t $PART_TYPE $PART_DEV /data
fi
Create file "bootsdcard" inside ".bootscript" to boot from sdcard.
Temporary-install themes
Save this scripts in ".bootscript" in your sdcard
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
$BUSYBOX mkdir -p /data/themes
$BUSYBOX rm -r /data/themes/*
$BUSYBOX cp -r /tmp/bootscript/themes/* /data/themes
$BUSYBOX rm -r /tmp/bootscript/themes
$BUSYBOX mount -o bind /data/themes/framework-res.apk /system/framework/framework-res.apk
$BUSYBOX mount -o bind /data/themes/twframework-res.apk /system/framework/twframework-res.apk
$BUSYBOX mount -o bind /data/themes/SystemUI.apk /system/app/SystemUI.apk
Create folder "themes" inside ".bootsdcard" and put your themes (framework-res.apk,twframework-res.apk,SystemUI.apk). Reboot your phone.
Warning, this script have possibility make your phone uncleanly unmounted. I don't have any problem with it, but better to be careful. Use only for test purpose, like when you build your own themes or test downloaded themes before you decide to use. Use when you need small modification to your themes. If you do a lot of modification, use dual boot.
Remember to clean "/data/themes" after you done.
admirable idea! +1
remark to the others: It's a modified kernel image, You can't play custom kernels and this Bootscript at the same time!
Doky73 said:
admirable idea! +1
remark to the others: It's a modified kernel image, You can't play custom kernels and this Bootscript at the same time!
Click to expand...
Click to collapse
thank you, but it's just small script.
you right about custom kernel. but i'm not mod kernel image (zImage) only init.rc inside ramfs and add one script "/sbin/bootscript.sh" and of course busybox binary (busybox.boot). i try to KISS so others can easily integrated to other kernel.
we can use this mod to only use the 4th partition as /data without install a new rom in 2nd partition. sounds nice.
Data2SD
@kurotsugi
Yes, it is possible to make data2sd. Create 2nd partition in your sdcard with type ext3. Save this scripts in ".bootscript" in your sdcard 1st partition
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p2
PART_TYPE=ext3
$BUSYBOX umount /data
$BUSYBOX mount -t $PART_TYPE $PART_DEV /data
Edit PART_DEV if you have different partition block and PART_TYPE if you use different partition type.
something is weird. your bootscript.sh in sbin/ is empty.
kurotsugi said:
something is weird. your bootscript.sh in sbin/ is empty.
Click to expand...
Click to collapse
the file is in "/sbin/". how you open it ?
i send in attachment both bootscript.sh and init.rc. i copy that file directly from my device using scp.
using rootexplorer, view as text. its empty. the init.d script didn't work neither.
---------- Post added at 09:16 PM ---------- Previous post was at 08:50 PM ----------
I've extracted the kernel and check the files. it has exact same script with the one in your attachement. I think my cwm is not work or something. now I can't install any custom kernel into my device.
test speed
irfanbagus said:
Use same partition and and custom rom instalation process as in irfan's "DUAL BOOT" method http://forum.xda-developers.com/showthread.php?t=1598803 .
Save this scripts in ".bootscript" in your sdcard
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p3
PART_TYPE=ext3
if [ -f /tmp/bootscript/bootsdcard ]
then
$BUSYBOX umount /cache
$BUSYBOX mount -t $PART_TYPE $PART_DEV /cache
fi[/code]post-data
Code:
#!/sbin/busybox.boot sh
[/QUOTE]
I suggest to those who run this method: compare speed with /cache on p3 and on NAND-internal. There is no need to use cache on sdcard, I believe !! :cool::cool: its very slow !
putting /cache unecessarily on sd-card is not a good idea. it is improper to do that.
[SIZE=1]---------- Post added at 06:32 PM ---------- Previous post was at 06:03 PM ----------[/SIZE]
[B]
Test Report
[/B]
the file /sdcard/.bootscript/post-data wasn't executed. remember /sdcard/.bootscript is a dir., not a file !
boot-script-0.1.tar includes some stock kernel built on March 7th 2012. boots up nicely.
after reboot /data was still on stl11 acc. to rootexplorer.
/init.rc included mods
/sbin/bootscript.sh seemed empty in rootexplorer (use other file manager, then its OK) . after editing, was empty again after reboot. s.th. is deleting stuff from /sbin ....
clarification: your scripts naming scheme:
file path : /sdcard/.bootscript
in there, file name : "post-data" (no extension!) or some of the other mentioned names.
in post #7 irfan there is mentioning of the /sdcard/bootsdcard flagging file. it only applies for full DUAL ROM, not with /data from sd only.
but even with it, still no luck !
Click to expand...
Click to collapse
in theory we can have triple or quad boot on this thing...
mai77 said:
I suggest to those who run this method: compare speed with /cache on p3 and on NAND-internal. There is no need to use cache on sdcard, I believe !! its very slow !
putting /cache unecessarily on sd-card is not a good idea. it is improper to do that.
---------- Post added at 06:32 PM ---------- Previous post was at 06:03 PM ----------
Test Report
the file /sdcard/.bootscript/runme.sh wasnt executed. remember /sdcard/,bootscript is a dir., not a file !
boot-script-0.1.tar includes some stock kernel built on March 7th 2012. boots up nicely.
after reboot /data was still on stl11 acc. to rootexplorer.
/init.rc included mods
/sbin/bootscript.sh seemed empty in rootexplorer (use other file manager, then its OK) . after editing, was empty again after reboot. s.th. is deleting stuff from /sbin ....
clarification: your scripts naming scheme:
file path : /sdcard/.bootscript
in there, file name : "post-data" (no extension!) or some of the other mentioned names.
in post #7 irfan forgot to mention the /sdcard/bootsdcard flagging file. without it, no mounting of /data !
but even with it, still no luck !
Click to expand...
Click to collapse
Irfan work very awesome even little script but have big impact..
I use all his work with little modification and u can do with ur style.. For me cache still use internal coz 1 partition on external can use for link2sd/a2sd..
could you just clearly state whether the download worked immediatly or did it not work.
yes
or
no
mai77 said:
could you just clearly state whether the download worked immediatly or did it not work.
yes
or
no
Click to expand...
Click to collapse
If im not wrong this is 1st mod fro irfan but he finish it with dualboot kernel (he say beta but for me its final).. Then I play with his work to my kernel with modification..
the problem is: -t ext3
ext2
works better.
maybe missing ext3 module ...
test result: the download does not work unless you take further preparation. if you use ext2 fs for /data directory, then it works.
mai77 said:
the problem is: -t ext3
ext2
works better.
maybe missing ext3 module ...
test result: the download does not work unless you take further preparation. if you use ext2 fs for /data directory, then it works.
Click to expand...
Click to collapse
I prefer ext4
Working well with cm7/9 on 2nd rom with my kernel..
I tried savie kernel many times with all tricks. it never booted up over here...
---------- Post added at 09:15 PM ---------- Previous post was at 09:02 PM ----------
so, irfan's BOOTSCRIPT is quite nice. but the above .tar download does not contain the kernel that I want.
so s.o. needs to zip up a current kernel into a boot.img
---------- Post added at 09:28 PM ---------- Previous post was at 09:15 PM ----------
irfanbagus said:
@kurotsugi
Yes, it is possible to make data2sd. Create 2nd partition in your sdcard with type ext3. Save this scripts in ".bootscript" in your sdcard 1st partition
post-data
Code:
#!/sbin/busybox.boot sh
BUSYBOX=/sbin/busybox.boot
PART_DEV=/dev/block/mmcblk0p2
PART_TYPE=ext3
$BUSYBOX umount /data
$BUSYBOX mount -t $PART_TYPE $PART_DEV /data
Edit PART_DEV if you have different partition block and PART_TYPE if you use different partition type.
Click to expand...
Click to collapse
stock rom users dont have ext3 available, they should use ext2.
on first boot from sd, expect 3 minutes longer boot time ! SGY is not stuck, it copies /data !
Terminal ide app works only if installed to NAND. Not poss in /data on sd mode
hi all, another great tutorial from irfanbagus, one question can we mount a img file ?
In linux we can mount a image file with -o loop, i have tryed in android but with no sucess so far, is there a way we can mount a image file(img) in android ?
that way we dont need the partitions and we will be able to run more roms.
Just one idea.
hal_2000

[Q] Mount external sd without -noexec flag

Hey Guys,
I'm interested in lots of stuff, regarding my phone and so i began writing a skript, which moves files from sdcard0 to sdcard1.
This Skript calls another skript and this Skript calls another one.
Well long story short, of course it doesnt work, because i cant change the permissions of the skript-files to rwx.
How can i change the mount type of my sdcard to -exec, so that i can execute stuff from my sdcard...
Thanks for your help in advance, greetz Esok
AFAIK only linux filesystems "accept" linux permissions,
means format your sd card with ext3 or ext4, than you can change file permissions, but I do not know whether your moto remembers the card
hmmm gotta try this one day.
have read in some forum, that there is some kind of an -noexec flag, which is always set unter android.
Well nevermind, the question i asked is stupid, because it doesnt 100% relate to my problem, as i see right now....
So here is what is wrong:
The scripts are lying on the INTERNAL-sd
The internal Sd doesnt have -noexec flag. This is the external, as i found out using .
Code:
mount | grep sdcard0
mount | grep sdcard1
but within the output of
Code:
mount | grep sdcard0
i found the line:
default_permission,allow_other 0 0
Click to expand...
Click to collapse
, i think this is why i cant change the permissions, isnt it?
I also found, that the filesystem on the internal seems to be "fuse". Anyone knows what this means?
so new question: how to solve this problem? oO
is remounting an option or is there any other way?
As it seems, the sdcard1 doesnt have this "default_permission" line, but it has the -noexec flag set...
Maybe i can do something via external sdcard...
i'll give it a try
esok44 said:
hmmm gotta try this one day.
have read in some forum, that there is some kind of an -noexec flag, which is always set unter android.
Well nevermind, the question i asked is stupid, because it doesnt 100% relate to my problem, as i see right now....
So here is what is wrong:
The scripts are lying on the INTERNAL-sd
The internal Sd doesnt have -noexec flag. This is the external, as i found out using .
Code:
mount | grep sdcard0
mount | grep sdcard1
but within the output of
Code:
mount | grep sdcard0
i found the line: , i think this is why i cant change the permissions, isnt it?
I also found, that the filesystem on the internal seems to be "fuse". Anyone knows what this means?
so new question: how to solve this problem? oO
is remounting an option or is there any other way?
As it seems, the sdcard1 doesnt have this "default_permission" line, but it has the -noexec flag set...
Maybe i can do something via external sdcard...
i'll give it a try
Click to expand...
Click to collapse
Although its been a long time since I had to dive into it, I'm really leaning toward FAT filesytems always being mounted noexec in Linux. Either way though, you can still point the interpreter at the script and it will run; for example if you script is at /storage/sdcard0/script.sh you can run it by doing /system/bin/sh /storage/sdcard0/script.sh or possibly even just sh /storage/sdcard0/script.sh and the same would apply to the external sdcard.
I use an app called smanager to run scripts via shortcuts and theres a plugin for widgets if you use a launcer that doesn't like to do shortcuts. It has selections to run things as root as well but I end up just calling root explicitly, running the script as a normal user and I do the same thing you're talking about where a scripts calls another script.
So for example I have Maps and Facebook frozen and I have a script for both of them but only part of it needs root access. So my Maps script, for example, unfreezes maps using root, starts it using the same user as smanager, then it calls another script that checks every couple of seconds if maps is still open. When I've closed it, the second script ends and the rest of the first script executes which kills maps and freezes it again.
So it looks roughly like this from memory:
Code:
/system/bin/sh /system/xbin/su -c "pm enable com.google.maps"
am start com.google.maps/com.whatever.starts.maps.up
/system/bin/sh /system/xbin/su -c "/script/that/stays/open/till/maps/closes/which/makes/this/script/pause/.sh"
/system/bin/sh /system/xbin/su -c "whatever.I.used.to.kill.all.instances.of.maps"
/system/bin/sh /system/xbin/su -c "pm disable com.google.maps.or.something.like.that"
Note that in the above, if I call the script with /system/bin/sh /location/of/script or even possibly sh /location/of/script , that I probably don't need all the paths that follow; most notably the /system/bin/sh since its already established when we call the script in the first place. It could look more like this (I just happened to write it along the lines of the above when I went about making my scripts):
Code:
/system/xbin/su -c "pm enable com.google.maps"
am start com.google.maps/com.whatever.starts.maps.up
/system/xbin/su -c "/script/that/stays/open/till/maps/closes/which/makes/this/script/pause/.sh"
/system/xbin/su -c "whatever.I.used.to.kill.all.instances.of.maps"
/system/xbin/su -c "pm disable com.google.maps.or.something.like.that"
note that the am start didn't need to be called by its path, for example.
I think, but can't remember, that I needed to call su by abosolute path, though. Also, I used a shebang #!/system/bin/sh at the begining of my scripts but don't know if thats necissary or not if you're going to call it by the interpreter in the first place.
If this was a some other script, like python, then it stands to reason that you can put the shebang as the first line as the path to your python and still call it from the shell and it would work; so if your script was:
Code:
#!/path/to/a/python/interpreter
import something
while this:
do this
print "I'm awesome"
and the script was called pythonscript.py then /system/bin/sh /path/to/pythonscript.py and possibly sh /path/to/pythonscript.py would most likely work and is worth a try.
Try it out and see how you go.
One last thing; if you call root explicity in a script every time you need it then you'lle get a popup for permissions every time it asks for root in the script the first time you run it, but if you use an app to launch that script then once the app has root permissions you won't get hassled at every instance. You'lle want to turn toasts off for the app though, or you'lle see one every time root is called in a script.
Hi again.
I just got execute permissions on my external sdcard. It didn't work on the internal one.
It looked like this after playing with a lot of various things
mount -o remount,rw,noatime,exec /storage/sdcard1
though most likely rw and noatime were not needed, probably just needed
mount -o remount,exec /storage/sdcard1
but would have to restart the phone to be sure.
This was using adb. some apps, for example my titanium backup, have problems in JB writing to the external card and I had it remounting properly to work around this at one point, but left the computer and came back, closed out windows, then forgot what I had done without saving any work and wasn't able to figure it out again. It was an fmask, dmask, or umask.
In any case, assuming you want to run scripts on your internal card (which is mounted using fuse by the way, instead of just vfat, which may be intentional to keep permissions from being messed around with), you can also write one to the external card and then after remounting it (you can create a command in tasker for this that runs on boot) just use it as a helper script, so it would look like this:
Code:
#!/system/bin/sh
/system/bin/sh [email protected]
or you might need to use quotes around [email protected] ... "[email protected]" ... its been a long time and I forget how I did this
So [email protected] is just the arguments you give to a script and if your script is called helper.sh and you say ./helper.sh /sdcard/myscript.sh then it should run the script.
[email protected] is like saying $1 $2 $3... and so on; getting the arguments except getting all of them in one string.
Also, one last thing; with my last phone, Samsung SGS2, I made a tiny fat partition on my external sd and then made the rest ext4. The tiny fat partition got mounted at boot and an extra device file was created along with the files created for sdcard0 and sdcard1, and that enabled me to mount the ext4 partition how I wanted to. It wasn't usable for much because it didn't play well with apps such as media players and ... well alll of them, but if you make a small ext4 partition after the larger fat partition then it may do the same as my Samsung did and provide you with a device file to mount and to put your scripts on. I think its easier to just mount the external drive with the execute option and use a helper script, or use smanager as described in my above post, or use tasker to create an app for your scripts but thats going to make a simple command into a really big app.

FIX: extsd2internalsd broken after Verizon 4.1.2 OTA

Loong time lurker, first time poster. I couldn't post a reply in the development forum, obviously. Maybe someone can link to this in relevant threads over in development.
This is a guide for those who are/were using the extsd2internal to swap storage which no longer works after the 4.1.2 OTA or want to do take advantage of this mod: http://forum.xda-developers.com/showthread.php?t=1849860 OR it MIGHT work for other ROMs which want to use this method for the Galaxy S3.
After the OTA, and getting back up and running, I could not get the script to work correctly with this error: "no such file or directory" and doing some sleuthing, it seems Verizon (in their infinite wisdom) changed the mounts, or maybe it did this because gremlins/gnomes, maybe because Vzw/Samsung knows about the swapping method, who knows. Anyways, here is the fix that worked for me:
PreReqs:
Stock ROM 4.1.2 OTA
Rooted (duh)
BusyBox
SManager ads
Terminal Emulator
Root Explorer in R/W mode
extsd2internalsd mod installed/script in the correct place!
BACKUPS!! Make a nandroid backup before you do ANY tinkering people, and copy it to a safe place like your computer.
Let me be clear, for the love of bits and bytes, do not just keep one copy on the sdcard in the phone!!
1) To find the /dev/block/vold for the external sd card, open Terminal Emulator and run this command. Grant it root access when prompted:
Code:
su ls /dev/block/vold
Write down or make a note of the numbers. (For me there were only 2, 179:32 and 179:33) Now run these commands:
Code:
adb shell
cat /proc/mounts
There will be a whole lot of text that shows up, you are looking for "/dev/block/vold/179:xx" and in the same line there is "/storage/extSDCard"
Alternate method, after you are in shell run command and look for mmcblk1p1:
Code:
cat /proc/partitions
The number in the "minor" column, that's the new number!
Double-check that the blocks are right for the sd card's partition size.
Note: I tried using mmcblk1 and it didn't work, then tried mmcblk1p1 and VIOLA! Yay, trial and error.
2) In SManager, edit the extsd2internal script, and replace the 179:97 to 179:*new number* (again, for me it was 179:33)
3) Reboot or just "run" the script in SManger and wait a few moments, then check Settings>Storage.
Here is what my script looks like:
Code:
#!/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 http://forum.xda-developers.com/showthread.php?t=1772234
#Script Modified for U.S. Galaxy S3s by Zedomax at GalaxyS3Root.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:33 /mnt/sdcard
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:33 /mnt/sdcard
if busybox mount | busybox grep vold/179:33; then
busybox mount -o bind /data/media /mnt/extSdCard
fi
If this didn't work for you, I am a complete n00b, so I will do my best, but don't expect much.
Things to double check:
Permissions on the extsd2interal script in Root Explorer should have all the boxes checked EXCEPT the last 3 at the bottom.
SManager script should be set to "Su" and "Boot"
OTA Headaches? Use this guide to keep root and boot unlocked worked PERFECTLY: http://forum.xda-developers.com/showthread.php?t=2186574#8 I did a nandroid restore to pre-OTA since it borked the first go-around, and then used this method.
Take home message: MAKE BACKUPS!
Credits / Current Build of this mod:
http://forum.xda-developers.com/showthread.php?t=1772234
This mod does work, and just replacing the old with the new (still have to add it in SManager) will get the job done. The new script is significantly different, and I am sure there are reasons, but without a changelog...
Forum Community: Created the thread here because I couldn't find another thread specific to this environment with all the relevant information in one place. If anyone has seen any errors of my ways, please, please reply with what's up.

Categories

Resources