Document the Story of Your Social Life with 8tory

The different forms of social media are growing every day. It’s hard to imagine a day … more

Make Calling Your Loved Ones Easier and Cheaper this Diwali

Diwali, or Deepawali as some Indians call it, is the pride and joy of Indian … more

Big Android BBQ 5.0 Recap – XDA TV

This fifth annual Big Android BBQ has come and gone. The speakers have spoke, the sponsors have … more

Microsoft to Counter “OK Google” with Bing Torque

When Microsoft is making apps for Android, users should be aware that something … more
Post Reply

RW and RO mount shortcuts.

OP Moon Shadow - NM

7th December 2011, 09:16 PM   |  #1  
Moon Shadow - NM's Avatar
OP Senior Member
Flag Albuquerque
Thanks Meter: 494
 
448 posts
Join Date:Joined: Jul 2011
Donate to Me
More
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.


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!
Attached Files
File Type: zip mounts.zip - [Click for QR Code] (595 Bytes, 587 views)
File Type: zip mount_rw_ro-v1.2_signed.zip - [Click for QR Code] (129.5 KB, 622 views)
Last edited by Moon Shadow - NM; 20th February 2012 at 04:53 AM.
The Following 3 Users Say Thank You to Moon Shadow - NM For This Useful Post: [ View ]
8th December 2011, 07:20 AM   |  #2  
Member
Thanks Meter: 27
 
31 posts
Join Date:Joined: Sep 2011
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?
9th December 2011, 04:36 AM   |  #3  
Moon Shadow - NM's Avatar
OP Senior Member
Flag Albuquerque
Thanks Meter: 494
 
448 posts
Join Date:Joined: Jul 2011
Donate to Me
More
Quote:
Originally Posted by imchairmanm

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!
9th December 2011, 05:37 AM   |  #4  
Member
Thanks Meter: 27
 
31 posts
Join Date:Joined: Sep 2011
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 by imchairmanm; 9th December 2011 at 05:49 AM.
9th December 2011, 05:14 PM   |  #5  
Moon Shadow - NM's Avatar
OP Senior Member
Flag Albuquerque
Thanks Meter: 494
 
448 posts
Join Date:Joined: Jul 2011
Donate to Me
More
Quote:
Originally Posted by imchairmanm

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.
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.
9th December 2011, 05:30 PM   |  #6  
Member
Thanks Meter: 27
 
31 posts
Join Date:Joined: Sep 2011
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.
The Following User Says Thank You to imchairmanm For This Useful Post: [ View ]
9th December 2011, 06:41 PM   |  #7  
Moon Shadow - NM's Avatar
OP Senior Member
Flag Albuquerque
Thanks Meter: 494
 
448 posts
Join Date:Joined: Jul 2011
Donate to Me
More
Quote:
Originally Posted by imchairmanm

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...

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!

Post Reply Subscribe to Thread

Tags
droid x2, dx2, mount rw, script
Previous Thread Next Thread
Thread Tools
Display Modes