Default [MOD] ro / rw scripts to remount your /system

I did not write these scripts. I claim zero credit for them. I pulled them from somewhere (another ROM or a mod for another phone, I can't remember.) I am simply passing on the information.

Here is a way you can add two scripts to change your /system from read-only to read-write and visa-versa. I am not going to hold your hand through this one. If you don't understand it, then don't do it. This is only for those that want a command line script to set their system filesystem to RW and back to RO in a simple way. This is only for people that are comfortable with the command prompt and adb shell to begin with. I am not responsible if you brick your phone.

I'll say it again. I am not responsible if you brick your phone.

Save a text file called: ro that contains:
Code:
#!/system/bin/sh
fs=`mount | grep system | awk '{print $5}'`
mount -t $fs -o remount,ro /dev/block/stl9 /system
Save a text file called: rw that contains:
Code:
#!/system/bin/sh
fs=`mount | grep system | awk '{print $5}'`
mount -t $fs -o remount,rw /dev/block/stl9 /system

Then open a command prompt and change directory to where you have the ro and rw files located. Notice that the ro and rw files DO NOT have any file extension on them. These should NOT show up as text files with Notepad icons when using Windows Explorer. If they do, then you need to take the .txt off the end of the filename. If you can't see it, then you have to be sure to show the hidden extensions.

The following steps assumes that you either have adb.exe and related files in the same directory as your rw and ro scripts OR you have added adb.exe to the PATH environment variable on your computer system.

When you are ready do this:

Code:
adb push rw /data/local/tmp/rw
adb push ro /data/local/tmp/ro
adb shell chmod 0755 /data/local/tmp/rw
adb shell
/data/local/tmp/rw
cp /data/local/tmp/rw /system/xbin/rw
cp /data/local/tmp/ro /system/xbin/ro
chmod 0755 /system/xbin/ro
chmod 0755 /system/xbin/rw
/system/xbin/ro
reboot
Notice that the last command will reboot your phone. This is only necessary if you want these scripts to be usable immediately. When you have rebooted, you should be able to type the command: rw to set your /system to read-write and ro to set your /system to read-only

Personally, I skip that last "reboot" command and I just run /system/xbin/ro manually until the next time I reboot my phone anyway.

These two scripts should be compatible with what ever file system you have on /system since if you read the script it actually checks the file system type first and then uses that response in the next line.

Use at your own risk, though.

EDIT: On Gingerbread, I had to use /dev/block/stl10 instead of /dev/block/stl9 above.