[Q] Mount external sd without -noexec flag - RAZR HD Q&A, Help & Troubleshooting

Hey Guys,
I'm interested in lots of stuff, regarding my phone and so i began writing a skript, which moves files from sdcard0 to sdcard1.
This Skript calls another skript and this Skript calls another one.
Well long story short, of course it doesnt work, because i cant change the permissions of the skript-files to rwx.
How can i change the mount type of my sdcard to -exec, so that i can execute stuff from my sdcard...
Thanks for your help in advance, greetz Esok

AFAIK only linux filesystems "accept" linux permissions,
means format your sd card with ext3 or ext4, than you can change file permissions, but I do not know whether your moto remembers the card

hmmm gotta try this one day.
have read in some forum, that there is some kind of an -noexec flag, which is always set unter android.
Well nevermind, the question i asked is stupid, because it doesnt 100% relate to my problem, as i see right now....
So here is what is wrong:
The scripts are lying on the INTERNAL-sd
The internal Sd doesnt have -noexec flag. This is the external, as i found out using .
Code:
mount | grep sdcard0
mount | grep sdcard1
but within the output of
Code:
mount | grep sdcard0
i found the line:
default_permission,allow_other 0 0
Click to expand...
Click to collapse
, i think this is why i cant change the permissions, isnt it?
I also found, that the filesystem on the internal seems to be "fuse". Anyone knows what this means?
so new question: how to solve this problem? oO
is remounting an option or is there any other way?
As it seems, the sdcard1 doesnt have this "default_permission" line, but it has the -noexec flag set...
Maybe i can do something via external sdcard...
i'll give it a try

esok44 said:
hmmm gotta try this one day.
have read in some forum, that there is some kind of an -noexec flag, which is always set unter android.
Well nevermind, the question i asked is stupid, because it doesnt 100% relate to my problem, as i see right now....
So here is what is wrong:
The scripts are lying on the INTERNAL-sd
The internal Sd doesnt have -noexec flag. This is the external, as i found out using .
Code:
mount | grep sdcard0
mount | grep sdcard1
but within the output of
Code:
mount | grep sdcard0
i found the line: , i think this is why i cant change the permissions, isnt it?
I also found, that the filesystem on the internal seems to be "fuse". Anyone knows what this means?
so new question: how to solve this problem? oO
is remounting an option or is there any other way?
As it seems, the sdcard1 doesnt have this "default_permission" line, but it has the -noexec flag set...
Maybe i can do something via external sdcard...
i'll give it a try
Click to expand...
Click to collapse
Although its been a long time since I had to dive into it, I'm really leaning toward FAT filesytems always being mounted noexec in Linux. Either way though, you can still point the interpreter at the script and it will run; for example if you script is at /storage/sdcard0/script.sh you can run it by doing /system/bin/sh /storage/sdcard0/script.sh or possibly even just sh /storage/sdcard0/script.sh and the same would apply to the external sdcard.
I use an app called smanager to run scripts via shortcuts and theres a plugin for widgets if you use a launcer that doesn't like to do shortcuts. It has selections to run things as root as well but I end up just calling root explicitly, running the script as a normal user and I do the same thing you're talking about where a scripts calls another script.
So for example I have Maps and Facebook frozen and I have a script for both of them but only part of it needs root access. So my Maps script, for example, unfreezes maps using root, starts it using the same user as smanager, then it calls another script that checks every couple of seconds if maps is still open. When I've closed it, the second script ends and the rest of the first script executes which kills maps and freezes it again.
So it looks roughly like this from memory:
Code:
/system/bin/sh /system/xbin/su -c "pm enable com.google.maps"
am start com.google.maps/com.whatever.starts.maps.up
/system/bin/sh /system/xbin/su -c "/script/that/stays/open/till/maps/closes/which/makes/this/script/pause/.sh"
/system/bin/sh /system/xbin/su -c "whatever.I.used.to.kill.all.instances.of.maps"
/system/bin/sh /system/xbin/su -c "pm disable com.google.maps.or.something.like.that"
Note that in the above, if I call the script with /system/bin/sh /location/of/script or even possibly sh /location/of/script , that I probably don't need all the paths that follow; most notably the /system/bin/sh since its already established when we call the script in the first place. It could look more like this (I just happened to write it along the lines of the above when I went about making my scripts):
Code:
/system/xbin/su -c "pm enable com.google.maps"
am start com.google.maps/com.whatever.starts.maps.up
/system/xbin/su -c "/script/that/stays/open/till/maps/closes/which/makes/this/script/pause/.sh"
/system/xbin/su -c "whatever.I.used.to.kill.all.instances.of.maps"
/system/xbin/su -c "pm disable com.google.maps.or.something.like.that"
note that the am start didn't need to be called by its path, for example.
I think, but can't remember, that I needed to call su by abosolute path, though. Also, I used a shebang #!/system/bin/sh at the begining of my scripts but don't know if thats necissary or not if you're going to call it by the interpreter in the first place.
If this was a some other script, like python, then it stands to reason that you can put the shebang as the first line as the path to your python and still call it from the shell and it would work; so if your script was:
Code:
#!/path/to/a/python/interpreter
import something
while this:
do this
print "I'm awesome"
and the script was called pythonscript.py then /system/bin/sh /path/to/pythonscript.py and possibly sh /path/to/pythonscript.py would most likely work and is worth a try.
Try it out and see how you go.
One last thing; if you call root explicity in a script every time you need it then you'lle get a popup for permissions every time it asks for root in the script the first time you run it, but if you use an app to launch that script then once the app has root permissions you won't get hassled at every instance. You'lle want to turn toasts off for the app though, or you'lle see one every time root is called in a script.

Hi again.
I just got execute permissions on my external sdcard. It didn't work on the internal one.
It looked like this after playing with a lot of various things
mount -o remount,rw,noatime,exec /storage/sdcard1
though most likely rw and noatime were not needed, probably just needed
mount -o remount,exec /storage/sdcard1
but would have to restart the phone to be sure.
This was using adb. some apps, for example my titanium backup, have problems in JB writing to the external card and I had it remounting properly to work around this at one point, but left the computer and came back, closed out windows, then forgot what I had done without saving any work and wasn't able to figure it out again. It was an fmask, dmask, or umask.
In any case, assuming you want to run scripts on your internal card (which is mounted using fuse by the way, instead of just vfat, which may be intentional to keep permissions from being messed around with), you can also write one to the external card and then after remounting it (you can create a command in tasker for this that runs on boot) just use it as a helper script, so it would look like this:
Code:
#!/system/bin/sh
/system/bin/sh [email protected]
or you might need to use quotes around [email protected] ... "[email protected]" ... its been a long time and I forget how I did this
So [email protected] is just the arguments you give to a script and if your script is called helper.sh and you say ./helper.sh /sdcard/myscript.sh then it should run the script.
[email protected] is like saying $1 $2 $3... and so on; getting the arguments except getting all of them in one string.
Also, one last thing; with my last phone, Samsung SGS2, I made a tiny fat partition on my external sd and then made the rest ext4. The tiny fat partition got mounted at boot and an extra device file was created along with the files created for sdcard0 and sdcard1, and that enabled me to mount the ext4 partition how I wanted to. It wasn't usable for much because it didn't play well with apps such as media players and ... well alll of them, but if you make a small ext4 partition after the larger fat partition then it may do the same as my Samsung did and provide you with a device file to mount and to put your scripts on. I think its easier to just mount the external drive with the execute option and use a helper script, or use smanager as described in my above post, or use tasker to create an app for your scripts but thats going to make a simple command into a really big app.

Related

Few EXt2 questions

Is it possible to veiw the files in the EXt2 partition from our G1 terminal? If so, can we also delete files? If so, someone explain how, thanks.
asuming is mounted on /system/sd
just
cd /system/sd
ls -la /system/sd
to list the files
is their a way to erase those files
There are commands for deleting files on Android. Look up the Linux Command prompt commands for performing those functions.
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
god, i hate how rude people are. I grew up with DOS, so dir, and del come more naturally to me than linux commands. So just ease up on the ppl that don't know linux. I didn't know linux til i started to IRC and wanted to run an eggdrop bot. Not like everyone has irc'd or compiled, or whatever. Heck, it has been so long now, I could not write an irc script or egg addon, and I think i was the first to develop some scripts in IRC 20 years ago. So all I can say is chill.
Shaggy
??huh??
whats the beef all about?
you can google the command and linux and probably have a ton of sites that list and explain the usage and stuff like that for *nix commands unix is a very old OS linus torvalds just woke up 1 day at age 15 or sumthin and said im gonna make a unix kernal that runs on my intel based pc and then instead of selling it and making a fortune I'll give it away and still make a fortune.
LINUS is the greatest man of our time, when the other OS was charging BIG $ to run Apache web servers in the .com boom (even more so now) linux was FREE and gave better throughput on the same hardware
Now if you want a pretty box booklet and packaging as you have become accustomed they have them to, some just feel better if they pay for it, free must not be as good as the one that costs right?
why did I bother just rambling, please ignore the babbling lunatic in the corner he is harmless
bhang
beartard said:
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
Click to expand...
Click to collapse
if you dontknow how to be polite to the noobz then dont say anything at all. let someone else answer their questions.
Hi Beartard,
Thanks for the info.
This site has such a wealth of information, that it can be overwhelming to many members.
Can you tell me how to copy my apps-private from my ext2 partition to my sd card partition so I can back them up?
Thanks
beartard said:
If you've rooted your phone and don't know the commands already, you haven't been paying attention to the instructions.
ls = directory listing
cp = copy
mv = move/rename
rm = remove
Those are the very basics. Remember that Unix-like operating systems are case-sensitive and file.txt is different from File.txt or file.TXT.
If you're using wildcards to delete everything, take a precaution and use the dot-slash. It could save you a lot of trouble by ensuring you're only deleting files in the current working directory. To remove all text files in a directory, for example, you'd type rm ./*.txt
Click to expand...
Click to collapse
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Hi Nitro .
I tried it both ways and it says operation not permitted.
-------------------
Update:
But wait, I connected my phone to the computer and the app-private is copied to the sdcard.
Your procedure worked!
I erased the folder that was copied to test it again.
Then I used just this set of commands and it worked again:
busybox cp -a /system/sd/app-private /sdcard/app-private
So you still get the same error, but it works.
Thanks alot Nitro!!!
Nitro212 said:
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
u tried it as root? what error u got?
well glad it worked.
Hi,
The error says:
"cannot preserve ownership of ... cannot preserve permissions of ... operation not permitted"
for every file it tries to transfer.
But then when you look in your sdcard the app-private is there.
So it is a false error.
Thanks again.
Nitro212 said:
uh you wan't to copy your "app-private" folder as a backup in to yoru sdcard correct? well try this
busybox cp -a /system/sd/app-private /sdcard/app-private
if it don't allows you to copy do this command to re mount the system as read-write
mount -oremount,rw /dev/block/mtdblock3 /system
Click to expand...
Click to collapse
It's not working for me...
My error is this:
cp: cannot stat '/system/sd/app-private': No such file or directory
Hi,
Use terminal emulator jf 1.41 or better
type su enter
then the busybox commands
Connect your phone to your computer and look on your memory card.
app-private is there
Proxin said:
It's not working for me...
My error is this:
cp: cannot stat '/system/sd/app-private': No such file or directory
Click to expand...
Click to collapse
bestwebs said:
Hi,
Use terminal emulator jf 1.41 or better
type su enter
then the busybox commands
Connect your phone to your computer and look on your memory card.
app-private is there
Click to expand...
Click to collapse
hey guys need some help here i have the same problem, (as far as the error saying 'no such file or dir') and i tried your suggestion about typing su first then the busybox commands.
i have the most current terminal emulator, unfortunately i still continue to get the same error every time i try to run the busybox commands. it just simply say 'no such file or directory"
you guys have any suggestions for me to try ?
any help would be great.
the error i get is "cannot preserve permissions of" i think that error is not something harmful im n o *nix expert but is just saying it wont save the permision of that folder i think...
Code:
# mkdir /sdcard/bk
mkdir /sdcard/bk
# busybox cp -rf /data/app-private/ /sdcard/bk
busybox cp -rf /data/app-private/ /sdcard/bk
cp: cannot preserve permissions of '/sdcard/bk/app-private': Operation not permi
tted
# ls /sdcard/bk
ls /sdcard/bk
app-private
thats what i did.. worked for me.. moved the app-private in to a folder named bk inside the sdcard
Hi,
We are assuming that you have already moved your apps and caches to the memory in a ext2 partition, correct?
Otherwise this will not work.
I 1st followed all the instructions in this post:
http://forum.xda-developers.com/showthread.php?t=468959
All this has to be done 1st including the 2 step 13's
onikus said:
hey guys need some help here i have the same problem, (as far as the error saying 'no such file or dir') and i tried your suggestion about typing su first then the busybox commands.
i have the most current terminal emulator, unfortunately i still continue to get the same error every time i try to run the busybox commands. it just simply say 'no such file or directory"
you guys have any suggestions for me to try ?
any help would be great.
Click to expand...
Click to collapse
nitro all i can say is thank you very much, i was looking through a 15 yr old unix book looking up commands, and it's just been so damn long ago i couldn't put it together.
thanks a ton. i'm sure you saved me at least a few hours.
@bestwebs ya i have done everything else including moving things to the ext2 partition i was just stuck on a few comands here and there.
but again thanks to both of you, and i'm all setup up now.
Hi,
Nitro is a real blast!
Glad it's working.

FIX: extsd2internalsd broken after Verizon 4.1.2 OTA

Loong time lurker, first time poster. I couldn't post a reply in the development forum, obviously. Maybe someone can link to this in relevant threads over in development.
This is a guide for those who are/were using the extsd2internal to swap storage which no longer works after the 4.1.2 OTA or want to do take advantage of this mod: http://forum.xda-developers.com/showthread.php?t=1849860 OR it MIGHT work for other ROMs which want to use this method for the Galaxy S3.
After the OTA, and getting back up and running, I could not get the script to work correctly with this error: "no such file or directory" and doing some sleuthing, it seems Verizon (in their infinite wisdom) changed the mounts, or maybe it did this because gremlins/gnomes, maybe because Vzw/Samsung knows about the swapping method, who knows. Anyways, here is the fix that worked for me:
PreReqs:
Stock ROM 4.1.2 OTA
Rooted (duh)
BusyBox
SManager ads
Terminal Emulator
Root Explorer in R/W mode
extsd2internalsd mod installed/script in the correct place!
BACKUPS!! Make a nandroid backup before you do ANY tinkering people, and copy it to a safe place like your computer.
Let me be clear, for the love of bits and bytes, do not just keep one copy on the sdcard in the phone!!
1) To find the /dev/block/vold for the external sd card, open Terminal Emulator and run this command. Grant it root access when prompted:
Code:
su ls /dev/block/vold
Write down or make a note of the numbers. (For me there were only 2, 179:32 and 179:33) Now run these commands:
Code:
adb shell
cat /proc/mounts
There will be a whole lot of text that shows up, you are looking for "/dev/block/vold/179:xx" and in the same line there is "/storage/extSDCard"
Alternate method, after you are in shell run command and look for mmcblk1p1:
Code:
cat /proc/partitions
The number in the "minor" column, that's the new number!
Double-check that the blocks are right for the sd card's partition size.
Note: I tried using mmcblk1 and it didn't work, then tried mmcblk1p1 and VIOLA! Yay, trial and error.
2) In SManager, edit the extsd2internal script, and replace the 179:97 to 179:*new number* (again, for me it was 179:33)
3) Reboot or just "run" the script in SManger and wait a few moments, then check Settings>Storage.
Here is what my script looks like:
Code:
#!/system/bin/sh
#extsd2internalsd is a modification that allows to switch internal sd to external sd and viceversa. With this you can use default internal sd only for app storage #and the external sd to store all apps resource and all others stuff. The resut is a very big increase of installable apps on gs3
#All credits to Mattiadj of xda forum for the idea and script and to mike1986 for the cmw zip.
#xda thread url at http://forum.xda-developers.com/showthread.php?t=1772234
#Script Modified for U.S. Galaxy S3s by Zedomax at GalaxyS3Root.com to be compatible when sdcard is not inserted.
busybox mount -o remount,rw /
busybox mount -t vfat -o umask=0000 /dev/block/vold/179:33 /mnt/sdcard
busybox mount -t exfat -o umask=0000 /dev/block/vold/179:33 /mnt/sdcard
if busybox mount | busybox grep vold/179:33; then
busybox mount -o bind /data/media /mnt/extSdCard
fi
If this didn't work for you, I am a complete n00b, so I will do my best, but don't expect much.
Things to double check:
Permissions on the extsd2interal script in Root Explorer should have all the boxes checked EXCEPT the last 3 at the bottom.
SManager script should be set to "Su" and "Boot"
OTA Headaches? Use this guide to keep root and boot unlocked worked PERFECTLY: http://forum.xda-developers.com/showthread.php?t=2186574#8 I did a nandroid restore to pre-OTA since it borked the first go-around, and then used this method.
Take home message: MAKE BACKUPS!
Credits / Current Build of this mod:
http://forum.xda-developers.com/showthread.php?t=1772234
This mod does work, and just replacing the old with the new (still have to add it in SManager) will get the job done. The new script is significantly different, and I am sure there are reasons, but without a changelog...
Forum Community: Created the thread here because I couldn't find another thread specific to this environment with all the relevant information in one place. If anyone has seen any errors of my ways, please, please reply with what's up.

[GUIDE] Creating and using filesystem images on Android

Hey all, This is my first post on the forum, so I thought I'd make it a guide.
I've run into a few roadblocks with installing some development tools like python and stuff, so I figured I'd try and make a filesystem image to hold all of it, what with Android preventing executables on your SD card from actually executing. You should NOT try and use this for freeing up space by moving apps to it. That just breaks things.
Things to know
A mount point is where you access the contents of a filesystem through.
A filesystem is basically a virtual disk.
I'm not responsible for your phone melting into a pool of acid or anything else you want to blame me for. You executed the commands, not me.
If there's been guides for this already, I didn't find them.
Playing with your system files is dangerous. Be careful
Playing with filesystems is even MORE dangerous. Don't do it unless you know what's going on.
Reversing and then combining two words in a sentence, then calling it a bit more dangerous is incredibly dangerous and can kill you. Don't do it.
As I said earlier: This is not intended to free up internal storage on your phone. It is intended to create extra space to put command-line executables.
This was created for those of us who have older phones that don't have a whole lot of internal storage. (Like the Milestone) This should also work on anything that meets the requirements listed below. I use it on a Motorola Milestone A853 running CyanogenMod 7.2.4f UMTS/SHOLES, and it took some tweaking, but it worked. Commands you put into your shell are marked with `bolded text and surrounded by back-ticks. Leave the back-ticks out. (`)`
Requirements! (obtained using `which <command name>` or a specified command)
Free space on your mSD
losetup (configuring loop devices)
mknod (creating loop devices)
mount (mounting filesystems)
mkdir (making directories)
su (root access)
umount (unmounting)
mke2fs (formatting)
Linux filesystem support (`cat /proc/filesystems | grep ext`)
Here we go!
This assumes you are going to use an ext4-formatted filesystem image mounted on /data/development/, with the image located at /mnt/sdcard/development.img. You WILL need to determine your phone's supported ext<num> filesystems using `cat /proc/filesystems | grep ext`. Choose the highest-numbered one.
Create the mountpoint, the image, and then format the image to ext4.
`mkdir /data/development/`​`dd if=/dev/zero of=/mnt/sdcard/development.img count=409600 bs=1024`​`mke2fs -l /mnt/sdcard/development.img -b 1024 -t ext4`​
Create the block device, set it to point at the image, then mount it.
`mknod /dev/block/loop250 b 7 250`​`losetup /dev/block/loop250 /mnt/sdcard/development.img`​`mount -t ext4 /dev/block/loop250 /data/development`​
Test it to see if it works.
`touch /data/development/testfile;ls /data/development/`​
Use it.
Unmounting (/!\ For connecting to a computer to avoid corruption /!\)
`umount /mnt/sdcard/development.img`​`losetup -d /dev/block/loop250`​
Well, that's all I've got. Suggestions and corrections, as well as good feedback are appreciated.
Some PAQs (Possibly Asked Questions)
Q: I'm getting some errors. Here they are: pastebin.com/some-errors
A: Great, I'll see what I did wrong, and if it's something on your end, I'll try and help you out.
Q: It dun werk
A: Tell me the errors instead of complaining about them. Just saying that does not help me and wastes my time and bandwidth.
Q: "No space left on device"; "Operation not permitted"; "No such file or directory"
A: SD card full; not root (or SD card is full, or something broke); Mount point doesn't exist or (if 'mount' returns that and the point exists) something not cool happened.
Usage guide on Non-Android devices
Some interesting bits of information for use on computers:
There's probably not an easy way to read/write/mount EXT2 filesystems on a Windows machine, so if you have a solution that's stable, go for it.
Linux computers definitely should support this, and I'm not sure about OSX computers, but in theory would work if you had the right things installed. iPhones ... well I have no idea what you'd do with it there.
Linux:
On the device:
THIS PART IS EXTREMELY IMPORTANT, NOT DOING THIS WILL RESULT IN BROKEN FILESYSTEMS!
`umount /mnt/sdcard/development.img`
`losetup -d /dev/block/loop250`​Plug your phone into your computer, making sure that the computer mounts it and reads it as removable media, and that the image is present.
On the computer: (Path of your user folder, and the mount point at which your device's SD is mounted can and very likely will vary from distribution to distribution. Check your paths.)
`mkdir /home/user/android-devtools/`
`mount -o loop /media/user/android-sd/development.img /home/user/android-devtools/`​Now, you can change things within the image as you normally would a file or folder. Be warned, sometimes doing this can create conflicts in the file permissions, so running the right commands on the phone to change the permissions as root (use `chmod` for the permissions) can save you boatloads of trouble getting things to work, or editing files.
Mac OSX might or might not be the same, but seeing as I haven't picked up an Apple computer since maybe 5 years ago, let alone attempted filesystem management, I just don't know.

[GUIDE] How to mount ext4 formatted MicroSD card on Android 4.2.2 Phone/Tablet.

Why?
MicroSD cards are traditionally formatted using ExFAT filesystem. The trouble is that while universally compatible, ExFAT is rather primitive filesystem prone to data loss, and poor speed. Linux ext4 on the contrary is highly reliable and very fast.
Trouble is that, and I quote, "Android supports devices with external storage, which is defined to be a case-insensitive and permissionless filesystem." (see http://source.android.com/devices/tech/storage/)
Well that pretty much narrows it down to dumb stuff like ExFAT.
Note: As of JB (Android 4.1) default umask is 077, which means that files created by apps on the ext4 formatted SD card will only be readable by the same apps, unless you manually update permissions. See this thread for more: http://forum.xda-developers.com/showthread.php?t=889471&page=5​
The good news is that Android has Linux at its core, which naturally supports ext4, and actually all of the internal storage is (or will be in near future) formatted this way. The design limitation mentioned above is somewhat artificial and is enforced by
restricted functionality of funky little daemon, called vold. The sole purpose of vold is not monitor external storage,
detect filesystem on it, mount it as specified in /etc/vold.fstab (or vold.xxx in Android 4.3), and then report to the Volume Manager.Volume Manager in turn notifies the MTP application, and all other apps, displays icons and handles rest of user-visible stuff.
Stock Android vold only supports ExFAT/vfat filesystem. It has been improved in Cyanogenmod to support ext4 and NTFS filesystems, but for those of us stuck with OEM Android this goodness in unavailable. In my experience simply re-building vold from CM as part of AOSP,
while yields an executable, this executable results in a boot loop for an unclear reason.
All hope lost seemingly, yet there is a silver lining.
Silver Lining?
If MicroSD card is mounted manually in the way that vold can see it, re-running vold will properly report it to the Volume Manager and it will be recognized and utilized by apps.
In theory this is easy to accomplish on any rooted device, in practice there are a number of obstacles:
On a locked device, it is not possible to update init script to run the commands at system bootup.
Since Android 4.2, mount propagation no longer work (as described here http://forum.xda-developers.com/showthread.php?p=36889027),
so if sdcard is mounted in terminal, vold will still not see it. Hence the mount operation has to be done in adb.
Furthermore in Android 4.2.2, running adb on localhost is broken as a result of it loosing its private key.
See here https://code.google.com/p/android/issues/detail?id=48126 for more.
The solution?
Pre-requisites:
Rooted device (don't have to be unlocked) with USB debugging enabled.
MicroSD card formatted as ext4 (inserted)
Terminal app, such as Android Terminal Emulator https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en
Familiarity with adb.
Step 1 - Fix adb localhost.
Open terminal and type the commands:
Code:
su
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
start adbd
HOME=/sdcard adb start-server
adb connect localhost
adb -s localhost:5555 shell
exit
stop adbd
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
start adbd
Step 2 - Install scripts.
Please note that the script msd2.sh has to be modified if your device uses different partition names.
To get list of partition names available run command:
Code:
adb shell cat /proc/partitions
There are 3 (very simple) scripts:
sd.sh is just a convenience so that you don't have to type su everytime.
It calls msd1.sh which takes care of starting localhost adb in a reliable way.
It then executes msd2.sh in adb shell, which actually does the mounting trickery.
To install scripts, download the zip file below, open terminal, unzip the archive and change into msd directory.
Then connect your phone to your PC and run the following commands:
Code:
adb push sd.sh /sdcard/sd.sh
adb push msd1.sh /sdcard/msd1.sh
adb push msd2.sh /sdcard/msd2.sh
adb shell
su
mount -o rw,remount /system
cp sd.sh /system/xbin/
cp msd1.sh /system/xbin/
cp msd2.sh /system/xbin/
chmod 755 /system/xbin/*.sh
mount -o ro,remount /system
exit
exit
Step 3 - Profit.
In terminal app run command:
Code:
sd.sh
There will be some messages in notifications bar and then you will be asked if it is ok to restart MTP application. Click Ok.
That should be it.
Note that this last command will have to be executed every time device reboots (see obstacle #1).
You can automate it using Script Manager app from marketplace. In this case, ask Script Manager to run msd1.sh instead, marking it as Root script.
Disclaimers
I've developed and tested this procedure on Samsung Galaxy S4 Active phone from ATT.
Should work for any other Android 4.2 device.
The steps outlined are non-destructive if done properly and should not affect any other functionality, yet obviously I do not assume any responsibility for you damaging your device in the process.
It is a good idea to read the linked articles before performing the procedure, to get a better understanding of what is actually going on.
Motorola Droid 4 (xt894)
Hello!
if you have a Motorola Droid 4 you need to change the third row in "msd2.sh" from
"mount -t ext4 /dev/block/mmcblk1p1 /storage/extSdCard && sleep 5 && /system/bin/vold" to
"mount -t ext4 /dev/block/mmcblk0p1 /storage/sdcard1 && sleep 5 && /system/bin/vold"
in order to get it to work, thanks for the guide!
Best Regards
/ Rasmus
It works well on TW based MIUI
It works well on TW based MIUI, so many many thanks!!!
But I still have the permission problems mentioned.
AOSP based MIUI is ext4 compatibile out of the box, and without permission problems.
This trick is amazing, but the permission issue make it useless ...
I can not shot a picture and than have to manually change the permission of tehf ile in order to view it on the gallery ...
Is there a definititive solution?
My lg l3 e400..sd card not mounted
to sashavasco:
sir, pls help configuring my phone...the codes u've given at the top part seems to work accordingly..but after when i entered the command
"cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys"
it says: "no such file or directory"
can you point out the problem of the device plss...
i appriciate your response..
my phone s LG L3 E400..CYANOGENMOD 9..external sd wont mount on my device
sashavasko said:
Why?
Step 1 - Fix adb localhost.
Open terminal and type the commands:
Code:
su
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
start adbd
HOME=/sdcard adb start-server
adb connect localhost
adb -s localhost:5555 shell
exit
stop adbd
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
start adbd
Click to expand...
Click to collapse
I am getting an error here: adb -s localhost:5555 shell stating device offline. I've done this 6 times now, and it's always the same error
Galaxy S4 i337 NC1 Rooted
kevp75 said:
I am getting an error here: adb -s localhost:5555 shell stating device offline. I've done this 6 times now, and it's always the same error
Galaxy S4 i337 NC1 Rooted
Click to expand...
Click to collapse
the same for me...
same error "unable to connect to local host:5555"
rooted Asus memo-7 build ME173X_US_user_4.2.404152_20140714 release-keys. But thanks for the heads up on Cyanogenmod.
>>If MicroSD card is mounted manually in the way that vold can see it, re-running vold will properly report it to the Volume Manager and it will be recognized and utilized by apps.
Re-running vold crashes it ("Segmentation fault") if sdcard is already mounted in ext4. If not, it restarts gracefully.
Stock android 4.4.2. AFAIK, vold must inform userspace stuff that sdcard is available, without it, android do not see any sdcard at all...
What can be done here?
p.s. Is there anywhere patched or recompiled vold which supports ext4?
Gigionaytor said:
the same for me...
Click to expand...
Click to collapse
same here too. Please help.
ZeroBubble said:
same here too. Please help.
Click to expand...
Click to collapse
Same error!
I had to modify terminal commands a bit to allow me to connect properly. Only moving the "start adbd" command down because the key needed to be appended to "adb_keys" before starting the service back up.
Code:
su
setprop service.adb.tcp.port 5555
adb kill-server
stop adbd
HOME=/sdcard adb start-server
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
start adbd
adb connect localhost
adb -s localhost:5555 shell
exit
I'm also still dealing with the "msd1.sh" script execution consistently asking about my fingerprint and not remembering it. If I don't press "continue" quick enough it claims the resource is busy, which prompted me to also change the msd1.sh script sleep from 2 to 5. I have gotten the notification that msd2.sh has been elevated, which seems like it ran, but my partition still doesn't get mounted, even though I've got the right one from the /proc/partitions output.
Another note, because I had BusyBox installed, I needed to prepend "busybox" (no quotes) to the mount command in the msd2.sh or else that wouldn't work either.
Anyone have thoughts?
I followed DemisesAngel suggestion. There was no error this time but nothing happens when running any of the 3 scripts. I tried mmcblk1 and mmcblk1p1, also changed microsd path to match, /MicroSD, but nothing works. Even with manual ext4 mount command ...
Clicking mount in settings still results in incompatible storage and file explorer shows no sdcard.
Edit: Set permissions, script will run but nothing mounts unsupported file system ...
Error directory already exist
I folllow the steps but i.think I meaaes up.
When u run through DemiseAngel scripts
At:
car /sdcard/.android/adbkey.pub >> /
Error:tmp-mkish:cant create /:Is a directory
To I attempt to find and rm it, or would that mess something up
Rca RCT677W22
I dont know if this thread is closed but I have one simple question, can I somehow partition sdcard and have a little space for music and other stuff, and to use ext4 partition alongside with this, lets say "visible" partition ( I mean on windows).
WrathBand said:
I dont know if this thread is closed but I have one simple question, can I somehow partition sdcard and have a little space for music and other stuff, and to use ext4 partition alongside with this, lets say "visible" partition ( I mean on windows).
Click to expand...
Click to collapse
First, I have been able to create a formatted partition of less than the full size of an SD card. I did this because my Android seems to have issues with anything larger than 16GB and all I had lying around was a 64GB. I did not try to do anything with the remaining space. Maybe it could work, maybe not. I would have my doubts.
Second, thanks for this discussion. Here is what "kind of" works on my Android 5.1 TV computer:
su -mm -c mount -t ext4 -o noatime /dev/block/mmcblk0p1 /storage/sdcard1 && sleep 5 && /system/bin/vold
chown -R root:sdcard_r /storage/sdcard1
chmod 771 /storage/sdcard1
I say "kind of" because this is still not seen as a true, external storage card by Android or file manager apps (and the like). However, all apps can read/write/traverse the folder tree and do what they need to. You do NOT have to be root except to do this. As things stand for me now, I have to re-issue this upon every re-start of Android. But using Tasker makes this pretty easy to accomplish.
long as a problem remains so do this thread ! . Well i am on 7.x and wonder if the op would post a method or even approach for getting a
Code:
ext4
partitioned sdcard so that vold is well aware of that and will mount sdcardfs on that giving all apps access to the partitions. I have 3 of these on my card .
Is there a method to auto mount ext4 partition on external SD that works on lineageOS 17.1 on S4 i9506?

[Q] [KatKiss 4.4.2 rev 019] Mount bind only running in root env

This "problem" (google claims security measure, but it shouldn't be so hard to disable) exists on at least nexus devices as well. I have found questions posted on small forums elsewhere; however, there were for early, all around buggy builds that had problems galore.
The issue I have is that when following the standard procedure to mount -o bind, the mount is only visible to root, which would be fine and dandy if anyone else could run the mount command.
>su
#mkdir -p /storage/emulated/legacy/Manga
#mount -o bind /storage/sdcard1/Manga /storage/emulated/legacy/Manga/
#mount
spits out everything mounted including the bind
#ls /storage/emulated/legacy/Manga
lists all my manga as it should
#exit
>mount
lists everything except bind
>ls /storage/emulated/legacy/Manga
>
I don't know what the exact terminology is for this, whether it's runlevel or userspace or what, but nothing except for root has privileges to run mount -o bind, and nothing but root can see it if it does.
This is not detrimental in this circumstance as I just don't want to lose all of my Perfect Viewer completed marks, but there are some instances where this could be quite necessary.
I read it could be an SELinux issue, so I disabled the <insert unpleasant word describing a nagging hinderance>, and it didn't affect much.
I'm not sure what to try from here, an alternative to cross-fs linking on a multi-application scope would be fine but symlinking isn't it.
I found out this is not a KatKiss problem, but a supersu problem. SuperSU has a wip multiuser implementation, and it has a mount master argument, which commonly is quite unstable. So my problem is now (on rev 23) that KatKiss seems to refuse letting superuser change apps (chainfire -> chainsdd).
KatKiss has many startup scripts that handle SuperSU. I gave up on trying to switch apps. What I have figured out is that due to the way 4.4 works with the sdcard as an emulated disk (whatever that means) and doesn't actually have direct access to it, but instead it routes it through a daemon binary that controls the sdcard. So until that is configurable somehow, mounting anything inside /sdcard reliably appears to be impossible. For an extra bit of "usefulness" as Operation Iron Fist calls it, I'll attach an init.d script for 4.4 that recreates the stock /Removable directory system. Just remove the ".txt" and place it in /system/etc/init.d, if you don't have the directory, use ROM Toolbox or SManager to run it as root on startup.

Categories

Resources