5,605,250 Members 38,471 Now Online
XDA Developers Android and Mobile Development Forum

RW and RO mount shortcuts.

Tip us?
 
Moon Shadow - NM
Old
(Last edited by Moon Shadow - NM; 20th February 2012 at 04:53 AM.)
#1  
Moon Shadow - NM's Avatar
Senior Member - OP
Thanks Meter 489
Posts: 444
Join Date: Jul 2011
Location: Albuquerque

 
DONATE TO ME
Default RW and RO mount shortcuts.

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, 499 views)
File Type: zip mount_rw_ro-v1.2_signed.zip - [Click for QR Code] (129.5 KB, 528 views)


If I helped you, just hit the THANKS button. It's free, and nice to see. If I REALLY helped you, consider donating, or signing up for Dropbox from here and we both receive an extra 250MB of storage!

Also, check out my Motorola Droid X2 tutorials:
HowTo: Root your Motorola Droid X2
HowTo: Perform a SBF ("factory restore") of your Motorola Droid X2
HowTo: Perform a bootstrap (or nandroid) backup and recovery of your Droid X2
The Following 3 Users Say Thank You to Moon Shadow - NM For This Useful Post: [ Click to Expand ]
 
imchairmanm
Old
#2  
Member
Thanks Meter 26
Posts: 31
Join Date: 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?
 
Moon Shadow - NM
Old
#3  
Moon Shadow - NM's Avatar
Senior Member - OP
Thanks Meter 489
Posts: 444
Join Date: Jul 2011
Location: Albuquerque

 
DONATE TO ME
Quote:
Originally Posted by imchairmanm View Post
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!


If I helped you, just hit the THANKS button. It's free, and nice to see. If I REALLY helped you, consider donating, or signing up for Dropbox from here and we both receive an extra 250MB of storage!

Also, check out my Motorola Droid X2 tutorials:
HowTo: Root your Motorola Droid X2
HowTo: Perform a SBF ("factory restore") of your Motorola Droid X2
HowTo: Perform a bootstrap (or nandroid) backup and recovery of your Droid X2
 
imchairmanm
Old
(Last edited by imchairmanm; 9th December 2011 at 05:49 AM.)
#4  
Member
Thanks Meter 26
Posts: 31
Join Date: 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.
 
Moon Shadow - NM
Old
#5  
Moon Shadow - NM's Avatar
Senior Member - OP
Thanks Meter 489
Posts: 444
Join Date: Jul 2011
Location: Albuquerque

 
DONATE TO ME
Quote:
Originally Posted by imchairmanm View Post
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.


If I helped you, just hit the THANKS button. It's free, and nice to see. If I REALLY helped you, consider donating, or signing up for Dropbox from here and we both receive an extra 250MB of storage!

Also, check out my Motorola Droid X2 tutorials:
HowTo: Root your Motorola Droid X2
HowTo: Perform a SBF ("factory restore") of your Motorola Droid X2
HowTo: Perform a bootstrap (or nandroid) backup and recovery of your Droid X2
 
imchairmanm
Old
#6  
Member
Thanks Meter 26
Posts: 31
Join Date: 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: [ Click to Expand ]
 
Moon Shadow - NM
Old
#7  
Moon Shadow - NM's Avatar
Senior Member - OP
Thanks Meter 489
Posts: 444
Join Date: Jul 2011
Location: Albuquerque

 
DONATE TO ME
Quote:
Originally Posted by imchairmanm View Post
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!


If I helped you, just hit the THANKS button. It's free, and nice to see. If I REALLY helped you, consider donating, or signing up for Dropbox from here and we both receive an extra 250MB of storage!

Also, check out my Motorola Droid X2 tutorials:
HowTo: Root your Motorola Droid X2
HowTo: Perform a SBF ("factory restore") of your Motorola Droid X2
HowTo: Perform a bootstrap (or nandroid) backup and recovery of your Droid X2

Tags
droid x2, dx2, mount rw, script
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Cloupload is a Beautiful and Fully Functional CloudApp Client for Android

If you’re a Mac OS X user who frequently uploads screenshots, … more

Microsoft Finally Brings Remote Desktop to Windows Phone

You may recall that back in October of last year, Microsoft released itsofficial … more

SideControl Gains New Powers through Xposed

You may recall that a little overa month ago, we first talked about SideCutsby XDA Forum … more

Leak Points to Windows Start Menu’s Return as Soon as August

About a month ago at this year’s Build conference, Microsoft … more