Remount script for rooted Tecno N3.


Many of the useful things that you can do with a rooted Android phone can be done simply from the command line (Terminal Emulator). Many also involve remounting the /system directory.
The remount command is long enough to be tedious to type, and difficult to remember, so I decided to write a trivial script so I didn't have to think about it. It's not rocket science, but for what it's worth, here it is:
# Mount /system as rw
mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system
echo "remounted read-write"
This one I called rw, and there's another called ro that switches /system back to read-only (saves you from restarting the phone.)
# Mount /system as ro
mount -o ro,remount -t yaffs2 /dev/block/mtdblock1 /system
echo "remounted read-only"
The question then arises as to where these should be put in the Android directory hierarchy. Ideally it should be a directory that is on the default path, but all such directories are read-only. Also, there's the question of how to get it there. I actually created the file on my Ubuntu box, and then used ADB, but you won't necessarily want to install that on your PC. So let's do it on the phone.

Go to Google Play, and install the simple editor Ted. Unlike the various notepad things, this lets you decide where to save your text. Carefully enter the scripts one by one, and save them to /data/rw and data/ro. This will put them in the directory /mnt/sdcard/data.

We can't run them from there, because in general, the sdcard folders don't allow program execution. So now open the Terminal Emulator, and move them to somewhere where they can be executed, as follows:
su                                        ; get root access
mv /mnt/sdcard/data/rw /data/rw           ; move into phone memory
mv /mnt/sdcard/data/ro /data/ro
cd /data                                  ; switch to the /data directory
chmod 700 rw                              ; make the scripts executable
chmod 700 ro
./rw                                      ; test the script
mount                                     ; check output for - /system yaffs2 rw
At this point we hopefully have a /system directory that is read-write. We can take advantage of this by moving our scripts to /system/bin, which is on Android's default executable path. We give them names that don't clash with anything that is normally there:
mv /data/rw /system/bin/sysrw             ; move into /system/bin
mv /data/ro /system/bin/sysro
sysro                                     ; test the script via path
mount                                     ; check output for - /system yaffs2 ro
Thats about it. Now you can tweak things in the /system directory, something like:
cd /system/media
mv power_off.mp3 old_power_of.mp3
This should work with other Android phones if you tweak the mount command appropriately. Run mount without arguments:
/dev/block/mtdblock1 /system yaffs2 ro,relatime 0 0
It will show many lines represented here by the ellipses. The line shown is for an N3. Your /system line may differ. Substitute what you see in columns 1 and 3 (/dev/block/mtdblock1 and yaffs2 here) in the remount command.