yashsingh1/xdaforums huggingface dataset:
[Verizon Samsung Galaxy S III] Serkenar:
Like I said, it's ok, I'm very happy with what I've got now, many thanks, mate:good:

Woah, that's a neat trick. grepping in the background while running vold to see the logging in real time, that's cool :) But you could just prompt me to look into logcat, I'm not that noobish:laugh:

Yeah, you're right, it's the same deal with a fat32 sd card. I remember I had that option in some other AOSP rom and I didn't think CM would remove the button :)

P.S. though I don't see anything useful, maybe you will, so I've attached the log just in case :)

EDIT: on second thought, there is one error in the log:

E/Vold (19341): Unable to start CommandListener (No such file or directory)

But I don't know whether it matters or not
[Verizon Samsung Galaxy S III] HMkX2:
Cool. At this point, I don't assume anything -- I've dealt with all sorts before. Also, there's all the lurkers who take something out of context, then post about a problem caused by it. :) Sorry if it came across as me talking to just you -- it was directed at the people in the background.

I wish I knew why PowerAmp only sees the Fat32 card and not the NTFS one. That is really, really vexing. Clearly your phone sees it, so PowerAmp should too.
[Verizon Samsung Galaxy S III] Captain_Throwback:
6.1 didn't fix the above problem :(.

I booted to recovery, wiped caches, flashed the new zip, and rebooted, and I was getting phone FC everywhere and the phone wouldn't work. Did a reboot back into recovery, changed permissions on the init.d script to make it non-executable, and phone booted up perfectly. Maybe I need to get a logcat and find out what's happening on boot-up.

I still think it's a script conflict, and I'm inclined to try and make the other scripts non-executable and see if any of those make a difference. My thought is still either the mountext script or a2sd (or both).
[Verizon Samsung Galaxy S III] Serkenar:
After upgrading my ROM and re-flashing 6.0, I got back the error message on boot complaining about YouTube crashing :(

In my case, removing YouTube from the rom (deleting /system/app/YouTube.apk), rebooting and installing it via google play seems to help. (Though the last time I had to remove, reboot and re-install it one extra time). I just hope that issues Captain_Throwback reported don't reappear.

That's very wise of you :)

It's not just PowerAmp, ES explorer behaves the same way. My guess is that they scan for mounts supported by system (vfat?) to detect cards and usb devices.

EDIT: I see now that while I was typing this post, Captain_Throwback reported that the problem persists. Too bad :(
[Verizon Samsung Galaxy S III] Captain_Throwback:
Well it doesn't appear to be a script conflict either.

Based on my logcat, the error I'm seeing repeated over and over after the script completes running is:

E/cutils: Failed to chown(/data/media/0, 1023, 1023): Operation not permitted
E/installd: Failed to setup media for user 0
E/installd: Could not create directories; exiting.

Which explains my persistent media force closes.

Is the script doing something to permissions that could be causing this error? It only happens on my MTD device.

UPDATE: I may have been outsmarting myself on this one by mounting my FAT32 partition to /data/media/0, which is a "special" folder. Removing the .mounthere file seems to have fixed that error, and left me with the below.

On another attempt, after removing my .mounthere files, the repetitive error I get is:

E/MediaProvider: Can't obtain external volume ID even though it's mounted.

Which leads to

E/AndroidRuntime: FATAL EXCEPTION: main

I saw in the script output a possible issue identifying my ext partition. It seems to be identified as ext4 in one spot, and ext2 in another. I initially formatted it as ext4, but I'm wondering if a2sd somehow changed it (I think it that before). Could that be causing the issue? I'll throw the card into GParted to see exactly how it's formatted now.

I can post the logcat output of the script for you as well. Maybe that'll help narrow down the issue.

UPDATE: Uploading logcat shortly. GParted confirms that my ext4 partition is now somehow formatted as ext2. Not sure if TWRP did it (doubtful) or the a2sd or "mountext" script did. I should probably reformat the card, delete that script, and see if everything works. I'll look into those scripts a little closer and see what I can figure out.
[Verizon Samsung Galaxy S III] Captain_Throwback:
Well I updated my ROM to the latest 4.2.2 nightly, and now everything is working. I was even able to mount my FAT32 partition at /storage/sdcard1 using a .mounthere file.

Looks like the error/issue was with my ROM, and whatever reformatted my card. I bet if my card gets formatted as ext2 again, it'll break again. I think reformatting my card was what fixed it, actually.

EDIT: Apparently I posted too soon. Now I'm getting the force closes again. I'll see if a reboot helps. I don't understand why this simple little script would be causing this issue. Maybe my card got formatted again?

EDIT 2: Back to the "external volume ID" error. I don't get it.
[Verizon Samsung Galaxy S III] HMkX2:
My script runs e2fsck if it detects an error mounting. Line #607. Change that command to "echo e2fsck" to disable it.

Running e2fsck shouldn't reformat -- it should only check for damage. And e2fsck is MEANT for ext2/3/4. Try running e2fsck manually on the partition and see if it is causing it.

Although -- if you are mucking with /data/media/0, scroll up a couple posts and read what I said about permissions to the other guy. You might have to chown media_rw and chmod 775 like I told him to. Do that AFTER you mount it somewhere.
[Verizon Samsung Galaxy S III] Serkenar:
I found a way to mount on top of internal storage (say, /storage/sdcard0/extSdCard) on boot. You can't do that with an init.d script, since init.d scripts are run before internal storage is mounted (at least on my device; would be nice to hear from someone more knowledgeable whether that's typical or not). A possible reason to do that would be wanting to grant an app that doesn't recognize your exfat/ntfs/ext4 card access to the card.

The solution is simple: use Script Manager.

1. Change /system/etc/init.d/50fuse-mountsd permissions to not executable (like rw-r--r--). You can use Root Explorer or some other app to do that. This will disable automounting on boot using the init.d script.

2. Install Script Manager

3. Using SManager, browse for /system/xbin/fuse-mountsd.sh and tap on it.

4. Press "Su" and "Boot" toggles and then press "Save" to grant the script root rights and run it on boot.

This will launch the script much later on boot, after the home screen is loaded and internal storage is mounted. Now you can create a .mounthere file on your SD card to mount it on top of internal storage. After reboot, it will be automounted there.

This method can also be used by people with rooted ROMs that don't have init.d enabled to enable automounting exfat/ntfs/ext4 cards on boot.

P.S. after installing an updated version of HMkX2's fuse-mountsd script, you only need to repeat step 1 and (maybe) reboot
[Verizon Samsung Galaxy S III] Captain_Throwback:
Well the card didn't get reformatted, so I don't understand the reason for the error. I'll try running that and see if it fixes the problem.

And I thought better of messing around with /data/media. But the external mount ID error persists. If I continue to get the error, I'll just use script manager to run the script after boot is complete. Everything seems to work okay when I do it that way.
[Verizon Samsung Galaxy S III] HMkX2:
I had a chance to read your replies more thoroughly, and I found your issue Captain_Throwback.

FAT doesn't support permissions or ownership metadata. If you try running "chown" or "chmod" on a fat32 fs, of course it will error out. It looks like the "sdcard" command (that takes ext4 /data/media/0 and abstracts it into a "fake vfat" fuse filesystem") expects and

needs

/data/media/0 to be ext4.

...and left me with the below. On another attempt, after removing my .mounthere files, the repetitive error I get is:

E/MediaProvider: Can't obtain external volume ID even though it's mounted.

...

I saw in the script output a possible issue identifying my ext partition.​

My script (rather, the phone) DOES support ext2/ext3, I merely hadn't added in the logic for it. I have corrected that in 6.2.

It seems to be identified as ext4 in one spot, and ext2 in another. I initially formatted it as ext4, but I'm wondering if a2sd somehow changed it (I think it that before). Could that be causing the issue? I'll throw the card into GParted to see exactly how it's formatted now.

...

UPDATE: Uploading logcat shortly. GParted confirms that my ext4 partition is now somehow formatted as ext2. Not sure if TWRP did it (doubtful) or the a2sd or "mountext" script did. I should probably reformat the card, delete that script, and see if everything works. I'll look into those scripts a little closer and see what I can figure out.​

Something is reformatting the card?? That seems rather significant. Some utilities can "convert" ext4 <=> ext2,3. I can offer no support here since I have no idea what is doing it.

If the partition got reformatted at ext2, please try 6.2. I added in rudimentary ext2/3 support, kinda a blind stab. It won't solve the problem of what is format-changing your card, but it might work. :eek:

Excellent instructions! However, the reason I run the script on boot is in case people are mounting directories that need to be read by apps on boot. If the script runs afterwards, certain things may be MIA when they are needed, depending on what you are using it for.

Instead, I strongly suggest running a "directory rebind" utility to bind (/storage/sdcard1 to /sdcard/sdExtBind), after boot-time. (Same instructions, but call the rebind script instead.)

(yes, I know "DirectoryRebind" doesn't work and I'm developing the only working one for 4.2+ -- but I'm getting THIS project working first!)
[Verizon Samsung Galaxy S III] Serkenar:
Originally, I tried to use your init.d mounting to mount my card to the default /storage/sdcard1 location + a little script that had the following command:

mount -o bind /storage/sdcard1 /storage/sdcard0/extSdCard

It appeared to mount ok, however it didn't work properly. I received constant read and write errors some time after the mounting and had to give up this approach. I also tried `busybox mount -o bind /storage/sdcard1 /storage/sdcard0/extSdCard`, but still no go. If it did work as it should, this way would had surely been better.

And sorry, I don't know what you are referring to as "DirectoryRebind". I tried searching forums and googling, but didn't find it. I only found this
[Verizon Samsung Galaxy S III] Captain_Throwback:
So I decided to try this on a stock HTC (Sense) ROM. The script doesn't make it very far because HTC did some weird mappings within the ROM, effectively breaking the stock JellyBean behavior.

The external SD card is mounted at /sdcard2 instead of /storage/sdcard1 (nothing is mounted here), and also symlinked to /sdcard/ext_sd.

Is there any way to modify the script to account for this funky behavior? I'd like to be able to use my card on stock too (if possible). Debug log attached.
[Verizon Samsung Galaxy S III] HMkX2:
Yes. In the OP I added a section saying "some locations are hardcoded in the analyzePhone function as fallbacks". What you are seeing ('Recovered... /directory exists') is that.

Modify the below red/bold parts in lines 342-348 of "fuse-mountsd.sh": the rest should be self-explanatory.

(Again, this is JUST FOR Captain_Throwback. Do not do this unless you are using a HTC Sense whatever.)

if [ -d "[B][COLOR="Red"]/sdcard2[/COLOR][/B]" ] ; then
SECONDARY_STORAGE="[B][COLOR="Red"]/sdcard2[/COLOR][/B]"
echo " Recovered... [B][COLOR="Red"]/sdcard2[/COLOR][/B] exists"
else
echo "ERROR! [B][COLOR="Red"]/sdcard2[/COLOR][/B] does not exist, exiting..."
exit 1
fi

As for the softlink, you might have to create that yourself. It should persist. Or, if that fails, do what everyone else is doing like Syrenkar and run a Rebind script after boot. (I provided a template one that works with 4.2.2 in the OP.)
[Verizon Samsung Galaxy S III] Captain_Throwback:
I guess this HTC kernel lacks exFAT support. It'll only see the FAT partition. I have a kernel dev for my device looking into it, so hopefully it's possible to add.

And I still have the issue on my MTD device with the media FC. It could be a ROM issue I suppose, but I don't recall it happening on the initial Experimental version where only the exFAT partition mounted. That's almost preferable to constant android.media and gapps force closes.

Thanks again for all your help with this.
[Verizon Samsung Galaxy S III] Serkenar:
Sorry for bringing this up again, but I'm out of options here. Is this "DirectoryRebind" you mentioned based on `mount -o bind`? Like I said, `mount -o bind` doesn't work properly on my device for some dumb reason. Softlinks on /storage/sdcard0/ don't work as well (says "Operation not permitted"). So,despite your strong suggestion, I basically see no other options then mounting on /storage/sdcard0/extSd after the system boots.
[Verizon Samsung Galaxy S III] hitittome873:
note 2 i605 works

this worked the first time for me on my galaxy note 2 for verizon sch-i605 with root, unlocked bootloader, and cm10.1 (20130314 Nightly) with android 4.2.2...64gb sandisk SDSDQUA-064G-U46A bought from amazon.
[Verizon Samsung Galaxy S III] HMkX2:
No worries, if it works stick with it. 'Elegant' isn't always 'easiest'. I'll try to explain. (TLDR: Download the "adb-bind example (links ext sd to internal).zip" in the op and manually put the adb-smash.sh on your phone. Let the SD card mount to /storage/sdcard1 like normal. Run ADB-SMASH.SH with script manager to get it to show up in sdcard0!)

Yes, I think DirectoryRebind app works by using "mount -o bind", but the reason it is currently broken is that it does so in UserSpace. Since 4.2, any mounts are local -- so no other app sees it. (If you do it in Terminal, only Terminal will see it, etc.) It's the same reason it "doesn't work properly" for you.

You get "operation not permitted" with symlinks in "/storage/sdcard0" since it is a

user-specific

FAKE VFAT filesystem (of /data/media/0 where 0=your user). Since regular Fat doesn't allow symlinks, the 'fake fat' layer refuses the command. If you did a symlink in /data/media/0 it would probably work, but then the fuse driver would get confused (since symlinks aren't supposed to exist in FAT). Hence BIND is our only option.

I found a way around that by running the commands in ADB RootShell space. That script I pointed to in the OP will run the "mount -o bind" command so that it spreads across the entire device. Scroll to the bottom of the .sh file and look at the only 2 commands it runs: (the rest is fluff)

mkdir -p /data/media/0/external_SD
adbSendCmd "mount -o bind /storage/sdcard1/ /data/media/0/external_SD/"

#[I]<- make the directory if it doesn't exist[/I]
#[I]<- make a mirror image of the directory /storage/sdcard1/ there[/I]
[Verizon Samsung Galaxy S III] Captain_Throwback:
So this is the response I got from a kernel dev:

This indicates that the support is included in the kernel, but for some reason, the Sense ROM only sees the FAT partition when I run the script on it, even with the /sdcard2 hard coded into it. So apparently there's something I'm missing :confused:.
[Verizon Samsung Galaxy S III] HMkX2:
That was my second post in this thread, it is still true. (#3 is now irrelevant.)

The card is mounted and readable+writeable under /sdcard2, correct? (i.e. you can open up ES File Explorer, copy a picture there, and remove the card and it's there on your computer?) That means my script is doing its job.

The issue seems to be kicking vold/storage manager in the head and telling it the /sdcard2 location exists -- to update internally. This happens in CM10.1 by calling 'vold'. HTC Sense ROM must not be able to be "smacked" into working like that. I'm fairly certain there is a solution, but it involves digging in obscure, rom-specific sourcecode or commands. I cannot help there. A good place to start would be /etc/vold.fstab.

If you could post an updated Debug.txt with 6.2, it might help me find where the media FCs are coming from at least. I am mostly certain it is from your attempts to mount to (FAT-only) /storage/sdcard0 instead of (ext4) /data/media/0.
[Verizon Samsung Galaxy S III] Captain_Throwback:
I'm not mounting the FAT partition to /data/media anymore. And I still get the force closes. That FC started AFTER I removed the .mounthere file that was putting it there. I'm now mounting it to /storage/sdcard1, but even when I removed ALL my .mounthere files, I still get that FC. I'll have to attach that debug log when I get home later. That's on my MTD device. The script seems to be mounting everything fine, though.

On my Sense device, the exFAT is not getting mounted anywhere. The FAT partition is getting mounted at /sdcard2, rather than the exFAT. The script doesn't appear to recognize the partition for some reason. I'll attach that log here shortly.

I think you may have been confusing the issues I was having on each device, so I hope that clarifies.
[Verizon Samsung Galaxy S III] Serkenar:
I had to change "/data/media/0/" to "/storage/sdcard0/" and now it works like charm, thank you!

EDIT: it looks like /storage/sdcard0 is not a fake vfat of /data/media/0 on my device, since there's nothing mounted on /data/media/0 or /data/media/*

I take it, it isn't typical, right? Maybe some other location is used? It's not like it matters for me at this point, but I'm curious to find out :) I tried grepping `mount` output for the block device that is mounted on /storage/sdcard0, but it shows only the /storage/sdcard0 mount. Grepping for "media" gave nothing, no matches at all.
[Verizon Samsung Galaxy S III] HMkX2:
Glad it does. But I

strongly suggest

leaving it /data/media/0/external_sd -- why did it need to be changed? Does that directory not exist on your phone? It

should

exist on any devices >4.1 -- it is part of the reference standard of per-user storage. This is concerning as it may lead to permission errors down the road. What are the contents of /data/media?

On a side note, now that the script is stable enough, I am taking a hiatus from the project.

This problem really is better addressed by a GUI app or the CM10.1 source code. I am spinning my wheels when something major needs to be done. Also, this isn't something I can put on a resume: Life™ wins. Feel free to post requesting for aid, but I may not be around to answer as often. I will, however, keep it updated as Android necessitates it.
[Verizon Samsung Galaxy S III] Serkenar:
/data/media had only empty dir 'obb' and some 0 byte archives (e2fsbackup.tar.gz and efsdev-mmcblk0p1.img.gz) before running the script. now it also has the created 0/external_sd dir structure

Thank you for your time and effort, this is really appreciated! All the best with Life™ :)
[Verizon Samsung Galaxy S III] spearoid:
Okay. Time for me to rejoin this thread with an idiotic question. :)

For other reasons I had to leave AOSP. Now I'm using a TW ROM that seems to need a 3rd party kernel like Lean Kernel to avoid certain lagginess issues.

I'm fairy sure this script doesn't work with TW ROMs but is there any hope for it working?
[Verizon Samsung Galaxy S III] JKurtz87:
Exfat problems

So I have been using a i9300 4.2.1 leak and had my card formatted to ex fat then switched back to Root box (latest night lie)and installed this mod and my SD card worked like a charm up until this morning when I was listening to music stored on the card and then I rebooted and in storage settings it said card is blank I've reformatted again to ex fat with same problems any help would be appreciated but for now I'm back to fat32. Also on my Mac when I put the csrd in before I reformatted it it said the card is unreadable at least until I formatted it to ex fat then fat32 (to work on my phone)
[Verizon Samsung Galaxy S III] Psipherious:
Version 6.2 is working beautifully on my CM10 device. Just wanted to say thanks for all your efforts and I will keep watch on this thread and certainly be trying out future versions. Posting a log of my card mounting on LG P990 running CM10 with successful mounting with no adjustments to script whatsoever - seems to be working just right "out of the box":
[Verizon Samsung Galaxy S III] HMkX2:
There are no stupid questions. Only questions asked previously.

TouchWiz already has exFat support, you would only need this for NTFS/ext4 support. Some custom kernels give that. I will look into TouchWiz's mountpoints and let you know if it might work.

As per the OP, please supply a debug.txt. I cannot provide any insight until I have the logs.

Blank as in "empty (64gb free)" or blank as in "Card Damaged"? Re-run my script any time it says "Card Damaged" to repair anything CM10.1 did. My script

does not

reformat or delete data -- please check your ROM.

You said it "still shows as blank". Does this mean you put in a known, working exFat card with files on it to test? Did it say "Card Damaged", or "blank (64gb free)" when you put it in?
[Verizon Samsung Galaxy S III] Captain_Throwback:
Any help on this?

I tried making some minor changes to vold.fstab (mounting /sdcard2 at /storage/sdcard1 instead of /storage/sdcard0/ext_sd) but then the whole system went crazy. The debug log indicates that the exFAT partition isn't recognized. I was told by the kernel dev that fuse is included in the kernel and only the userspace binaries are needed, which I believe are included here, right? So I don't know why the partition isn't being read, and why nothing is mounting at /storage/sdcard1 no matter what I do.

I was hoping the debug.txt I posted would shed some light on the subject, but that was just before you took a hiatus, unfortunately. Which is absolutely fine, of course, as life is more important than this.