yashsingh1/xdaforums huggingface dataset:
[Verizon Samsung Galaxy S III] HMkX2:
Super! That header is

exactly

what I needed. That is really interesting, look at the last 20 bytes or so -- "00 00 55 aa" is the 'universal' header OK signature. (Other roms use 'ff'.)

For some reason, the Note 2 ROM backfills with 'f4' right up until the header. This is something worth implementing as a test. And I know the reason it is not mounting correctly, it is because it sees the "zram" partitions and thinks you are trying to mount multiple partitions, so your card isn't mounted under /storage/sdcard1 but /storage/mmcblk1p1. There are 2 options: I clean up my code, or you add a '.mounthere' file.

I am doing the first, and will upload 5.7 momentarily. It should work 100% for you. (It seems you are running 5.4, don't let the name scare you -- it's only Experimental for the people on old devices :cyclops: )

Edit: 5.7 is up. It shouldn't have any problems. If you could post a debug.txt if it works, that'd be great.
[Verizon Samsung Galaxy S III] Serkenar:
Flashed 5.7. It mounts something it shouldn't, but that's not a big deal: I fixed it by adding .mounthere file with first line 'skip'. The problem is it doesn't mount exfat sd card anymore. Probably, the culprit is here:

/system/xbin/fixmyexfat.sh[143]: syntax error: 'done' unexpected
[Verizon Samsung Galaxy S III] HMkX2:
Hm.. there's a bug in the code. I am pulling 5.7 until I can fix it. The synonym code isn't working correctly.

This is a major bug. I strongly recommend avoiding using this until I can fix it:

Reasoning: each partition has a UUID to identify it. I had hoped to use it to identify synonym partitions (e.g. vold__:__ = mmcblk__). However, for some dumb reason in Android

system partitions have the same "Unique" UID

. That is REALLY making my head hurt, and could be Very Bad.
[Verizon Samsung Galaxy S III] Serkenar:
You're my hero, HMkX2!

After creating .mounthere file 5.4 now works perfectly!

Thank you SO much!:good::good::)

I'm perfectly happy with v5.4 for now, so take your time with 5.7 :)
[Verizon Samsung Galaxy S III] HMkX2:
5.4 is "stable", but like I said, you shouldn't have to create (two!!) .mounthere's. There are some pretty big issues that it left unresolved. (You don't want to be mounting zram's, and I have

no idea

what mmcblk0p12 was!! I am certain as heckfire you shouldn't make files on it!! Probably should undo that if you can.)

Could you please delete the '.mounthere' s, flash 5.8, post a debug.txt? I completely redid the REGEX I use to detect partitions. It is quite important I get this working correctly, I can take off the "Experimental" tag if it works for you.

By the way, :good::good::good::good::good: for all the debug logs, it may not seem big, but you are helping a lot of lurkers who are having the same issues but aren't posting. (Like the SuperSU issue fixed with your feedback!)
[Verizon Samsung Galaxy S III] Serkenar:
Actually, one '.mounthere' is enough for 5.4. I created the file on mmcblk0p12 only because of 5.7 mounting it. Nothing bad happened of it, but I will follow your advice and delete the file I created.

Flashed 5.8 and it errored out with 'could not find NOGO zone!'

It's nothing, but I glad if I can help making this world a better place :laugh:

UPD: It looks like mmcblk0p12 is mounted on /preload as rw, so me creating a file there shouldn't break anything (though i did delete the file), but 5.7 mounting it was indeed a bug :)
[Verizon Samsung Galaxy S III] Captain_Throwback:
So I used 5.8 with all the experimental bits, and while I was able to get the SD card mounting with the help of a .mounthere file, only my exFAT partition mounted. My FAT and ext4 partition were MIA. My ext partition is actually already being mounted via an init.d script, so I don't know if that's causing a conflict or something.

Also, it looks like the script is trying to mount the other mtd blocks, which is no good. Any/all mtd blocks can be safely excluded as part of the NOGO zone.

Attaching debug log. Definitely some good progress being made here, and I appreciate your willingness to get older devices running newer Android versions supported :).
[Verizon Samsung Galaxy S III] Serkenar:
5.8 doesn't work for me, so for now I'm using 5.4. And I have another question. Is it possible to make apps recognize my ntfs formatted sd card? It shows up in Storage Manager if mounted on /storage/sdcard1, but I can't, e.g., make PowerAmp scan through /storage/sdcard1, it just isn't showed up as an available location. As a temp fix, I mount my sd card to /storage/sdcard0/extSdCard, but this isn't really neat :)

Thanks :)
[Verizon Samsung Galaxy S III] Psipherious:
Hey there, thanks for your continued efforts. Much appreciated.

I'm happy to continue testing your script(s) on CM10 and reporting back the results.

I just tested 5.8 and it doesn't seem to have read the .mounthere on the second partition and mounted the second partition at all.

In fact I'm not entirely certain it even detected the second partition as it didn't attempt to mount it to the default /storage/mmcblk1p2

Log attached:
[Verizon Samsung Galaxy S III] damgood:
Cheers HMkX2,

Very nice MOD, though I'm not on the S3 device but on the old I9000 (S1) device running CM10.1 nightly 8'th march, I have tested your experimental, yes it's working mounting both exfat / ext4 systems as r/w (if sdcard is only one big partition), tested a 4 partition sdcard all ext4 with different mountpoints - all four partitions mounts - but the mounts of directorys (3pcs) (/sdcard/somedirectory) does not mount as writeable only readable :( the last partition mounts as it should r/w .(the .mounthere works)

Very impressed though with your work.:good:
[Verizon Samsung Galaxy S III] vintagephone:
Running CM10.1 M2 on a AT&T S3. Ran the Experimental 5.8. Worked great for my San Disk 64 GB card. Then this morning (probaby after a reboot or two) the card was unrecognized. My PC had trouble with it too until I re-formatted formatted it with Win 7. Back in the phone all is good again... maybe I did something funny, but I'm not sure the fix is sticking... No logs yet (I'm a noob with this stuff), but if it happens again I'll try and get my act together. But if it doesn't happen again I'll consider it a fluke... or am I missing something obvious?
[Verizon Samsung Galaxy S III] Serkenar:
The next time this happens you should try running

Chkdsk /f <drive:>

in windows. This might fix your card :)
[Verizon Samsung Galaxy S III] HMkX2:
Oh my lord, I need to check more frequently. I'll start working on fixes in-order of posts. Basically, the "sed" command is being a royal pain.

Will post back with fixes as soon as I can test.
[Verizon Samsung Galaxy S III] HMkX2:
You always find such interesting errors! Let me count the ways...

Your busybox is massively out of date. sed is another command I use -- and would work fine if it was updated. (I "pretended" to be your phone and the commands ran fine on my busybox.) I'll have to think how to rework the command if I can't test and find out

what

the outdated busybox is missing!

You are running a MTD phone with no extermal storage. My code caught "mtdblk4" in the code that looks for "mmcblk4p3". One single question mark in a regex did that. I've since fixed it.

You have ext4 partitions with UUIDs that aren't U! UUID stands for

unique

universal identifier. Every partition has one, and it is

supposed

to be randomly generated.

I want to slap whoever did it on Android.

Your SD card and your internal storage share the UUID, so my synonym code thinks they are the same! I'll have to throw out the synonym code at this point, it's beyond useless if the darn UUID is the same on everything.

HOLY SMOKES. This phone has 'mtdblock' devices, AND internal mmcblk0 storage, and mmcblk1 external storage? This is the wost-case scenario for my code. I'm going to have to rewrite the entire partition searching code just because you exist. Thank you for posting, though.

Thanks to everyone for posting. At least now I learned a couple things. If you want me to make a more detailed post highlighting your exact error in the log, I can do it, but it'd just take time. I will post later today with an updated version, but I have some major work to do.
[Verizon Samsung Galaxy S III] Serkenar:
I can confirm that. I have an outdated busybox in /sbin and an up-to-date one in /system/xbin. So, I tried running your script with `PATH=/system/xbin:$PATH fuse-mountdsd.sh` and it worked fine :)
[Verizon Samsung Galaxy S III] vintagephone:
Been there, done that. But the question is, should I expect it to happen again?

My summary:

Loaded CM10.1 M2 on my AT&T S3 and the Sandisk 64GB SD card wouldn't work and was corrupted.

Found this thread.

Fixed SD card with chkdsk.

Ran the Experimental 5.8 fix on my phone. Worked great for my San Disk 64 GB card.

Overnight something went bad and the SD card was corrupted again. CHKDSK had trouble even seeing the card and would not fix it. Formatted card with windows to exFAT.

SD card works again and I posted to this thread (#115 above).

So far so good. After multiple reboots etc the exFAT SD card is still working.

Thank you!

Carl
[Verizon Samsung Galaxy S III] HMkX2:
Great. Try 5.9. I threw out all the synonym code because Psipherous and damgood showed Android is a 'Honey Badger' about UUIDs.

Now your BusyBox version shouldn't matter.

exFat support is still *under development*. There hasn't been an update to the code since Feb 2nd. If you want reliability, use NTFS or something more proven. If your card ever becomes unreadable, just re-run my script. It will try to repair any damage as best it can.

And no, that is atypical.... while I was using exFat I never noticed any random corruption. I will be vigilant now that you mentioned that.

Version 5.9 is up, please use that instead of 5.8. Still experimental, but far less so. It should fix a lot of the problems fringe-cases are having. If you are running 4.2.2 on the GS3, it has always worked.
[Verizon Samsung Galaxy S III] Serkenar:
I tried 5.9. It works, no issues noticed so far. Mounts single partition card to /storage/sdcard1 by default. Great job:good::good::good::good::good::good:

I have one question. Is it possible to make apps recognize my ntfs formatted card as an external sd? The card is displayed in Storage Manager when mounted to /storage/sdcard1 (though there's no unmount option available), but apps don't see it as an SD card. I can't use the card with poweramp this way and es explorer also doesn't see my card as an external sd. For now I created .mounthere with '/storage/sdcard0/extSdCard'. Also had to disable running your script on boot, otherwise it falls back to /storage/sdcard1 (being unable to find '/storage/sdcard0/extSdCard', since internal storage isn't mounted yet when the script is run) and I can't unmount it afterwards. I was thinking, a great solution would be to mount the ext SD card to /storage/sdcard1 and `mount -o bind` it to '/storage/sdcard0/extSdCard'. I can do it manually, but not automatically on boot, since internal storage isn't mounted yet when the init.d scripts are run. So far, I'm stuck with this problem and have to manually launch your script after each reboot :)
[Verizon Samsung Galaxy S III] Captain_Throwback:
Great work. 5.9 is working perfectly on my newest device (EVO 4G LTE) and my oldest device (EVO 4G).

Now to get TWRP working right on my EVO 3D so I can try it on that one ;).
[Verizon Samsung Galaxy S III] Serkenar:
After flashing 5.9 one strange thing happened. At first I thought that was due to my tweaks, but after upgrading from JellyBam 6.4.0 to 6.6.0 I see that this happens right after flashing 5.9. The strange thing is a notification on boot saying YouTube crashed. But, I did find a fix. To those of you who have a similar problem, try doing the following:

1. Delete /system/app/YouTube.apk (you may want to make a backup just in case) using your favorite root explorer.

2. Reboot

3. Install YouTube via Play Market

This should help (hopefully) :)
[Verizon Samsung Galaxy S III] HMkX2:
It should show up. Put a picture (.jpg) on the card, then plug it in and run my script. It should show up in Gallery as "sdcard1". As for seeing it *inside* apps, that may not work. I will quote the Android SDK here: I will emphasize the pertinent line. Also, you CAN eject from Storage Manager -- it should say "Eject SD Card" as an option. Can you tell me what problem you are having ejecting it?

For now I created .mounthere with '/storage/sdcard0/extSdCard'. Also had to disable running your script on boot, otherwise it falls back to /storage/sdcard1 (being unable to find '/storage/sdcard0/extSdCard', since internal storage isn't mounted yet when the script is run) and I can't unmount it afterwards. I was thinking, a great solution would be to mount the ext SD card to /storage/sdcard1 and `mount -o bind` it to '/storage/sdcard0/extSdCard'. I can do it manually, but not automatically on boot, since internal storage isn't mounted yet when the init.d scripts are run. So far, I'm stuck with this problem and have to manually launch your script after each reboot :)​

Open my script, go to line 684, and add a # in front of the line.

if [ -e "$stagingAREA/.mounthere" ] && [ ! -d "$mntTARGET" ] ; then
echo "Invalid directory read from .mounthere file ($mntTARGET)"
echo " SECURITY: if valid dirname, you have to create it first!"
mntTARGET=""
fi

to

if [ -e "$stagingAREA/.mounthere" ] && [ ! -d "$mntTARGET" ] ; then
echo "Invalid directory read from .mounthere file ($mntTARGET)"
echo " SECURITY: if valid dirname, you have to create it first!"
[B]	#	mntTARGET=""[/B]
fi

That will disable directory-security, and it will create the directories as needed at boot time. (As long as they are on a writeable area to begin with.)

To unmount, in addition to Eject in Storage manager (for single partitions), you can also run my script as "fuse-mountsd.sh umount" and it will disconnect everything (multiple partitions).
[Verizon Samsung Galaxy S III] Serkenar:
As you can see on the screemshot, there's no "Eject SD Card" option in Storage Manager. Also, a picture on /storage/sdcard1 doesn't show up in the Gallery. PowerAmp recognizes ordinary fat32 formatted ext card just fine, but not ntfs/exfat.

Creating /storage/sdcard0/extSdCard dir and then having internal storage mounted would mean that original /storage/sdcard0/extSdCard becomes unaccessable after internal storage is mounted. At least, that's the way it is in linux (http://askubuntu.com/questions/29656/does-a-mountpoint-have-to-be-an-empty-directory).

Don't get me wrong, I'm not complaining: you've done a great job and I'm very happy with v5.9. My issues look more like rom-related ones. It's not a big deal for me to run your script manually after each reboot :)

Thank you :)

P.S. I forgot to mention that `fuse-mountsd.sh umount` fails with `Device or resource busy` whenever I try to run it, the very same way `umount /storage/sdcard1` does.
[Verizon Samsung Galaxy S III] Captain_Throwback:
I seem to have similar issues, but I don't understand how the script could be the issue.
[Verizon Samsung Galaxy S III] damgood:
Hi again,

Hope I'm not hijacking the thread with my old device I9000 :confused: , I would like to have the possibilityes fuse-mountsd gives :)

Well gave the 5.9 Experimental a run on the device, produced 3 logs - one with 4pcs ext4 partitions, second a log with no sdcard, third a log with the exfat sdcard from my camera.

Results:

R/W on exfat works :) real nice for posting photos on social services on the net - without the PC.:good:

Same results as 5.8 ""tested a 4 partition sdcard all ext4 with different mountpoints - all four partitions mounts - but the mounts of directorys (3pcs) (/sdcard/somedirectory) does not mount as writeable only readable the last EXT4 partition (/storage/sdcard1)mounts as it should r/w .(the .mounthere works)""

As I understand the solution i bying S3, as its working on this device.

Br henrik
[Verizon Samsung Galaxy S III] Psipherious:
Success!

It works!

I had to comment out the safety check lines (below) before it would create/mount my .mounthere file, but I assume this is still intended to remain in place as a safety and I will have to comment this out on each script update?

#if [ -e "$stagingAREA/.mounthere" ] && [ ! -d "$mntTARGET" ] ; then
#	echo "Invalid directory read from .mounthere file ($mntTARGET)"
#	echo " SECURITY: if valid dirname, you have to create it first!"
#	mntTARGET=""
#fi

I have attached my successful debug in case you wish to review it, but it looks good to me.
[Verizon Samsung Galaxy S III] Serkenar:
Drat, my quick fix doesn't work, the notification re-appeared :( I noticed that if you disable mountsd init.d script, it doesn't appear...
[Verizon Samsung Galaxy S III] Captain_Throwback:
I'm thinking there's a conflicting init.d script in the ROM. The particular ROM I'm using has an existing script to mount the ext partition of my sd card. I think there is also a script for a2sd, which moves apps to that partition automatically. Between the three scripts, I think it's confusing my device.
[Verizon Samsung Galaxy S III] Serkenar:
Since YouTube works just fine afterwards, it's more like an annoyance rather then a problem.

Funny thing that if you remove YouTube completely, reboot, install it again, the message seems to disappear. But later on (after some reboots?) it might re-appear again kind of randomly.
[Verizon Samsung Galaxy S III] Captain_Throwback:
In my case it's not YouTube; I get repeated android.media and android.gapps force closes, which don't allow me to do anything. On some flashes, I'm getting phone and system ui FC, which make the device unusable. So in my case it's a little worse than an annoyance :rolleyes:.
[Verizon Samsung Galaxy S III] Serkenar:
To make absolutely sure, have you tried disabling the init.d script? Just make it non-executable, reboot and see if the issues persist.
[Verizon Samsung Galaxy S III] Captain_Throwback:
Good idea; I'll try that now.

EDIT: It's definitely the init.d script. I made it non-executable, and the device booted up perfectly fine. I then ran the script in Terminal, and the card mounted okay.

I'm going to make the script executable again and reboot to confirm.

EDIT 2: Confirmed. On reboot, after making the script executable again, I'm getting constant android.process.media force closes. Is there any way to resolve this?

EDIT 3: Weird. I changed permissions and the force closes immediately stopped (I didn't even have to reboot :confused:). Is there something in the script that continually tries to run?
[Verizon Samsung Galaxy S III] HMkX2:
(No Eject button: ) Weird.... very weird. Can you open a terminal as root and type "vold" and tell me what it says, or if that fixes it?

(Not being recognized by apps: ) Can you try running an app like "SD Rescan" and tell me if that makes the contents visible?

Creating /storage/sdcard0/extSdCard dir and then having internal storage mounted would mean that original /storage/sdcard0/extSdCard becomes unaccessable after internal storage is mounted.​

Yes, that is normal behavior. Mounts go on top of existing mounts. Nothing you can do about that.

P.S. I forgot to mention that `fuse-mountsd.sh umount` fails with `Device or resource busy` whenever I try to run it, the very same way `umount /storage/sdcard1` does.​

Type "fuser -m /storage/sdcard1". Then "ps|grep <#'s listed one at a time>". That will tell you what is keeping its foot in the door and preventing the card from being unmounted. Even having a terminal open in that current directory is enough to prevent it.

I disabled autoscanning for media on boot. That was most likely what was causing it. It will now only autoscan for media when the script is run manually (6.0).

You are using the wrong location for .mounthere. "/storage/sdcard1" works, you said -- this is normal, and is where it normally looks.

"/sdcard" is a link to a "fake vfat" filesystem.. The location of the EXT4 filesystem there is "/data/media/0/" or "/data/media", depending on your Android version. (This is MANDATORY -- if you use /sdcard/Download, when an app writes to it, it'll muck up the permissions as "u40_31" or something weird.)

ls -al /sdcard == sdcard -> /storage/emulated/legacy
ls -al /storage/emulated/legacy == /storage/emulated/legacy -> /mnt/shell/emulated/0
mount|grep emulated == /dev/fuse ([I]this is a "fake" vfat filesystem of /data/media)[/I]

Furthermore, you are not setting the correct permissions. Type "ls -al /data/media/0/Download" (or /data/media/0/DCIM or /data/media/0/Android/data/com.spotify.mobile.android.ui/cache/Storage) and you will see "-rw-rw-rw-rw-

root

root

<blah blah blah>".

THIS IS BAD. You need to chown on everything to make it R/W, possibly chmod to make it executable. Run this command:

[B]find /data/media/0/Download -print0 | xargs -0 chown media_rw:media_rw[/B]
[B]chmod 775 /data/media/0/Download[/B]
or some combination thereof. (root:media_rw / root:sdcard_rw, ??)

That will make it writeable. It is not a mount issue, it is a permissions issue.

I made a change to 6.0 for you. At the top of the file, there is a single statement:

dirSECURITY=1

Change that to "dirSECURTY=0" and it will do everything. ALSO, you DO NOT have to do that anymore if the folder you are creating is under "/storage/*" or whatever "$ANDROID_STORAGE" is. So if you had "/storage/mydirectory", it will work without having to disable directory security.

I figure anything under /storage is fair game to mess with. Anything OUTSIDE of that, you have to create it yourself, OR disable 'directory security'.
[Verizon Samsung Galaxy S III] Serkenar:
Issuing `vold` does nothing, no notifications, output or eject option in the Storage manager, it just returns 1 and that's all.

Funny, running SDrescan made the pictures on sd card visible in the Gallery, however poweramp still doesn't detect the card. It's ok, since I found a workaround to make poweramp work: I run a binding script automatically after /storage/sdcard0 is mounted using Script Manager.

As for unomunting, your tip helped :) However, I wasn't really worried about that, since you can't remove microSD card from Galaxy SII without removing the battery, so there isn't really much use to unmounting it. But, in case I get myself a usb otg, this can be really useful, thanks :)

Flashed 6.0. No issues noticed so far, working great. Well done!:victory:
[Verizon Samsung Galaxy S III] HMkX2:
Well, since there is no way for me to test on your phone, and I have no idea where to begin, I'll just leave it as is.

If you want to see what Vold is doing, type these commands in sequence EXACTLY as listed:

logcat -c <enter>
(logcat|grep Vold)& <enter>
vold <enter>
kill %1 <enter>

That will spawn a log viewer, run the command, then kill it after you are done. You should see some text fly by in the background after you type the vold command. Something about "the revenge". On a WORKING device (i.e. mine) it will look like this:

I/Vold ( 5374): Vold 2.1 (the revenge) firing up
D/Vold ( 5374): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 5374): Volume sda state changing -1 (Initializing) -> 0 (No-Media)
D/Vold ( 5374): Volume sdcard state changing 0 (No-Media) -> 2 (Pending)
D/Vold ( 236): Volume sdcard state changing 4 (Mounted) -> 2 (Pending)
D/Vold ( 5374): Volume sdcard state changing 2 (Pending) -> 1 (Idle-Unmounted)
D/Vold ( 236): Volume sdcard state changing 2 (Pending) -> 1 (Idle-Unmounted)
E/Vold ( 5374): Unable to start CommandListener (No such file or directory)
W/Vold ( 236): Volume is idle but appears to be mounted - fixing
D/Vold ( 236): Volume sdcard state changing 1 (Idle-Unmounted) -> 4 (Mounted)

As for unomunting, your tip helped :) However, I wasn't really worried about that, since you can't remove microSD card from Galaxy SII without removing the battery, so there isn't really much use to unmounting it.​

Well, DUH. There's your answer. If there's no way to remove the card without powering off the phone, why would CM ALLOW you to eject the card??

They would simply remove the button!