• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

RW and RO mount shortcuts.

Search This thread

Moon Shadow - NM

Senior Member
Jul 14, 2011
455
502
Albuquerque
Okay, I got sick of typing
Code:
mount -o remount,rw /dev/block/mmcblk0p12 /system
or
Code:
busybox mount -o remount,rw /system
to mount the /system partition in RW mode so I created two very simple scripts that you can run through Script Manager to Mount RW and Mount RO.

I do quite a bit from ADB and I just found it more convenient to tap a shortcut on my home screen to mount the /system partition.

With the help of imchairmanm, I have fixed the scripts to be available globally, so all you have to do is type "mountrw" (without the quotation marks) to mount the /system partition in Read/Write mode, and type "mountro" (again, without the quotation marks) to mount the /system partition in Read Only mode.

So, now it can be run both ways!


Installation:
1. You must be rooted. (See my HowTo: Root your Motorola Droid X2 tutorial.)
2. You must have Busybox installed. If you are rooted, you have busybox installed. I've tested the scripts on BB 1.18.2, 1.19.2 and 1.19.3.
3. Download the mounts.zip file and extract it to a folder on your SDCard (internal or external, it doesn't matter). I use /mnt/sdcard/Scripts/Mounts/.
3. Download Script Manager from the market.
4. Open the Script Manager app and navigate to the folder you put the mount scripts in.
5. Tap the first mount script (mountro).
6. Tap the star and the Android superuser icon next to it. This configures the script as a favorite and to run the script as root.
7. Tap SAVE.
8. Repeat steps 5 through 7 for the second mount script (mountrw)
9. Now you can run each script from within Script Manager, or create shortcuts to them on your home screen.

To create the shortcuts, do the following:
1. Long press a blank area on your home screen and select Widget.
2. In the Choose Widget popup, scroll down to Script Manager Ads (if you have the free version) and tap it.
3. In the list, tap the mountro script. This will place the shortcut on your home screen.
4. Repeat steps 1-3 for the mountrw script.

Now, when you need to mount /system as RW all you need to do is tap the mountrw script, then when you are done, either reboot, or tap the mountro script.

The following is the code for each of the scripts:
mountro:
Code:
#!/system/bin/sh
# This mounts the /system file system as Read Only which is the default when
# Android is booted.
echo "Mounting /system in Read Only mode!"
busybox mount -o remount,ro / 2>/dev/null
busybox mount -o remount,ro rootfs 2>/dev/null
busybox mount -o remount,ro /system 2>/dev/null
echo "Done!"
mountrw:
Code:
#!/system/bin/sh
# This mounts the /system file system as Read Write in order to modify or add
# files to the /system file system.
echo "Mounting /system in Write mode!"
busybox mount -o remount,rw / 2>/dev/null
busybox mount -o remount,rw rootfs 2>/dev/null
busybox mount -o remount,rw /system 2>/dev/null
echo "Done!"
It's simple and no frills... The way I like it. :D


Alternative install:
I didn't realize it, but, I had already made a flashable zip. Just download mount_rw_ro-V1.1.zip and boot into the BSR and flash it from there.

If anyone has any suggestions, I'm open to them! Let me know!

Ciao!
 

Attachments

  • mounts.zip
    595 bytes · Views: 1,077
  • mount_rw_ro-v1.2_signed.zip
    129.5 KB · Views: 1,239
Last edited:

imchairmanm

Member
Sep 17, 2011
31
30
Hm, I was curious since you said you couldn't get your scripts to run globally, so I tried them out by putting them in /system/xbin. After adjusting permissions and making sure owner and group were root, they ran fine and globally as-is. I wonder if the simpler version you started with would have worked or not?
 

Moon Shadow - NM

Senior Member
Jul 14, 2011
455
502
Albuquerque
Hm, I was curious since you said you couldn't get your scripts to run globally, so I tried them out by putting them in /system/xbin. After adjusting permissions and making sure owner and group were root, they ran fine and globally as-is. I wonder if the simpler version you started with would have worked or not?

did you run them from /system/xbin? I put them in /system/xbin and then cd / to get back to root and tried to run them. They are not found.
Code:
# cd /system/xbin
cd /system/xbin
# pwd
pwd
/system/xbin
# ls -l mount*
ls -l mount*
lrwxrwxrwx root     root                        2011-12-05 13:08 mount -> /system/xbin/busybox
lrwxrwxrwx root     root                        2011-12-05 13:08 mountpoint -> /system/xbin/busybox
-rwxrwxrwx root     root                  316 2011-11-06 19:04 mountro
-rwxrwxrwx root     root                  328 2011-11-06 19:04 mountrw
# cd /
cd /
# pwd
pwd
/
# mountro
mountro
mountro: not found
# sh mountro
sh mountro
sh: Can't open mountro
#

That was the problem I was running into. I even tried sh mountro. The error "Can't open mountro" essentially means it can't find it.

If this is what you did, and you had different results, I would love to find out why. Thanks!

Ciao!
 

imchairmanm

Member
Sep 17, 2011
31
30
Yeah, that's what I meant by they are available globally. I can run them from anywhere in the filesystem. I'm not sure what the difference is. Mine have owner and group set to root and the applicable permissions set as well.

It runs through the script correctly, I get all of the echo messages, and if I cd to system afterwards, everything is rw or ro as it should be. I don't know what other information would be helpful for you, but I'll answer whatever other questions you might have. I don't quite understand why it'd ever have a problem with your scripts in the first place. It seems like a strange thing to happen.

Edit: I just ran through and ran the same commands as you did and they were all successful. It sounds like maybe something isn't right in your $PATH? That's the only thing I can think of. What does it say when you type "echo $PATH"? Either that or something with your terminal emulator or rom? Have you tried a different terminal? It shouldn't matter but you never know.
 
Last edited:

Moon Shadow - NM

Senior Member
Jul 14, 2011
455
502
Albuquerque
Yeah, that's what I meant by they are available globally. I can run them from anywhere in the filesystem. I'm not sure what the difference is. Mine have owner and group set to root and the applicable permissions set as well.

It runs through the script correctly, I get all of the echo messages, and if I cd to system afterwards, everything is rw or ro as it should be. I don't know what other information would be helpful for you, but I'll answer whatever other questions you might have. I don't quite understand why it'd ever have a problem with your scripts in the first place. It seems like a strange thing to happen.

Edit: I just ran through and ran the same commands as you did and they were all successful. It sounds like maybe something isn't right in your $PATH? That's the only thing I can think of. What does it say when you type "echo $PATH"? Either that or something with your terminal emulator or rom? Have you tried a different terminal? It shouldn't matter but you never know.

I dunno what is going on. My path shows /system/xbin. Oh, I'm on Eclipse 1.3 (but that shouldn't matter)... Oh well. :confused:
Code:
# echo $PATH
echo $PATH
/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin

It happens from the adb shell and from the terminal program on my DX2.
 

imchairmanm

Member
Sep 17, 2011
31
30
Hm. My $PATH is the same except it also includes /data/local/bin. That shouldn't matter. I'm on eclipse too and running the commands from the terminal in eclipse parts. I don't know why something in the path wouldn't execute. Does "which mountrw" find it? I had a problem earlier where I thought it wasn't finding a script I wrote, but it actually was failing at the first line because I had the wrong path to sh listed. If which finds your scripts I'd say it's more likely something with the script rather than the system. I'd also try writing a little hello world script and seeing if you can get that to execute globally too.
 
  • Like
Reactions: Moon Shadow - NM

Moon Shadow - NM

Senior Member
Jul 14, 2011
455
502
Albuquerque
Hm. My $PATH is the same except it also includes /data/local/bin. That shouldn't matter. I'm on eclipse too and running the commands from the terminal in eclipse parts. I don't know why something in the path wouldn't execute. Does "which mountrw" find it? I had a problem earlier where I thought it wasn't finding a script I wrote, but it actually was failing at the first line because I had the wrong path to sh listed. If which finds your scripts I'd say it's more likely something with the script rather than the system. I'd also try writing a little hello world script and seeing if you can get that to execute globally too.


Aw, CRAP! I've run into this problem when I develop on a Windows machine and try to run it on a linux box... ARGH! Thank GOD I use gvim. I was able to change the file format from DOS to UNIX, then save it and push it back out to /system/xbin. chmod'd it to 777 and ran mountrw/mountro and they work now... How can I be so friggin' dense... I know better than that... :p

Oh, to answer your question on the which command, yes, which finds them both.

What clued me in was you saying that the problem might be with the script. Thanks! It FINALLY works! I've updated the OP with the corrected files.

Also, does anyone want me to make this a flashable zip? Let me know.

Ciao!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Okay, I got sick of typing
    Code:
    mount -o remount,rw /dev/block/mmcblk0p12 /system
    or
    Code:
    busybox mount -o remount,rw /system
    to mount the /system partition in RW mode so I created two very simple scripts that you can run through Script Manager to Mount RW and Mount RO.

    I do quite a bit from ADB and I just found it more convenient to tap a shortcut on my home screen to mount the /system partition.

    With the help of imchairmanm, I have fixed the scripts to be available globally, so all you have to do is type "mountrw" (without the quotation marks) to mount the /system partition in Read/Write mode, and type "mountro" (again, without the quotation marks) to mount the /system partition in Read Only mode.

    So, now it can be run both ways!


    Installation:
    1. You must be rooted. (See my HowTo: Root your Motorola Droid X2 tutorial.)
    2. You must have Busybox installed. If you are rooted, you have busybox installed. I've tested the scripts on BB 1.18.2, 1.19.2 and 1.19.3.
    3. Download the mounts.zip file and extract it to a folder on your SDCard (internal or external, it doesn't matter). I use /mnt/sdcard/Scripts/Mounts/.
    3. Download Script Manager from the market.
    4. Open the Script Manager app and navigate to the folder you put the mount scripts in.
    5. Tap the first mount script (mountro).
    6. Tap the star and the Android superuser icon next to it. This configures the script as a favorite and to run the script as root.
    7. Tap SAVE.
    8. Repeat steps 5 through 7 for the second mount script (mountrw)
    9. Now you can run each script from within Script Manager, or create shortcuts to them on your home screen.

    To create the shortcuts, do the following:
    1. Long press a blank area on your home screen and select Widget.
    2. In the Choose Widget popup, scroll down to Script Manager Ads (if you have the free version) and tap it.
    3. In the list, tap the mountro script. This will place the shortcut on your home screen.
    4. Repeat steps 1-3 for the mountrw script.

    Now, when you need to mount /system as RW all you need to do is tap the mountrw script, then when you are done, either reboot, or tap the mountro script.

    The following is the code for each of the scripts:
    mountro:
    Code:
    #!/system/bin/sh
    # This mounts the /system file system as Read Only which is the default when
    # Android is booted.
    echo "Mounting /system in Read Only mode!"
    busybox mount -o remount,ro / 2>/dev/null
    busybox mount -o remount,ro rootfs 2>/dev/null
    busybox mount -o remount,ro /system 2>/dev/null
    echo "Done!"
    mountrw:
    Code:
    #!/system/bin/sh
    # This mounts the /system file system as Read Write in order to modify or add
    # files to the /system file system.
    echo "Mounting /system in Write mode!"
    busybox mount -o remount,rw / 2>/dev/null
    busybox mount -o remount,rw rootfs 2>/dev/null
    busybox mount -o remount,rw /system 2>/dev/null
    echo "Done!"
    It's simple and no frills... The way I like it. :D


    Alternative install:
    I didn't realize it, but, I had already made a flashable zip. Just download mount_rw_ro-V1.1.zip and boot into the BSR and flash it from there.

    If anyone has any suggestions, I'm open to them! Let me know!

    Ciao!
    1
    Hm. My $PATH is the same except it also includes /data/local/bin. That shouldn't matter. I'm on eclipse too and running the commands from the terminal in eclipse parts. I don't know why something in the path wouldn't execute. Does "which mountrw" find it? I had a problem earlier where I thought it wasn't finding a script I wrote, but it actually was failing at the first line because I had the wrong path to sh listed. If which finds your scripts I'd say it's more likely something with the script rather than the system. I'd also try writing a little hello world script and seeing if you can get that to execute globally too.