yashsingh1/xdaforums huggingface dataset:
[Verizon Samsung Galaxy S III] Captain_Throwback:
I'm not using any program to mount my internal storage via UMS. It's an option in CM10.1 (see below):

I didn't get to mess with modifying the framework file. I couldn't get TWRP to show me the partition. I'll have to follow up with TeamWIN about that.

I think a GUI-based app for your script(s) is the next logical step for you. You could set up the ".mounthere" files, view debug output, whatever else makes sense.

I agree there are very few people like me who want multi partition support, but with all large capacity cards coming formatted as exFAT, while HTC bootloaders can still only read FAT, I think there a larger audience/group of people that just don't understand the benefits/advantages of doing this. Having a program that can be an all-in-one stop for partitioning the card and mounting directly on the device would be awesome.
[Verizon Samsung Galaxy S III] spearoid:
I love the work you've done and continue to do. And I have to say the Futurama screenshot is a tremendous additional touch to what is already my favorite thread!
[Verizon Samsung Galaxy S III] david279:
Looks like CM is working towards some ext4 support. It already supports NTFS read only.

http://review.cyanogenmod.org/#/c/31215/
[Verizon Samsung Galaxy S III] Captain_Throwback:
So I got TWRP working mounting my FAT partition! I have all of the SD card partitions mounted in recovery and in CM. Fantastic. The last step would be modifying the framework to try and get MTP to mount both the exFAT and FAT32 external card partitions. But I don't know much about decompiling APKs, though I have done a bit of it in the past. I'll see if I can get APKTool set up and play around with it.

If I make any progress, I'll report back.
[Verizon Samsung Galaxy S III] Captain_Throwback:
###########################################
WARNING: mountpoint -n is behaving badly!
Please report this to XDA!
###########################################

^That's why I'm back, and with a debug log.

This was after mounting my internal storage to the computer in Mass Storage mode. I had to re-run the script to re-mount the exFAT partition, and noticed the warning. I also saw stuff from my android secure folder in there, which I don't think is right.
[Verizon Samsung Galaxy S III] renokim:
im unable to format my microSD card on windows...
[Verizon Samsung Galaxy S III] Psipherious:
Hello everyone. I've just installed this on CM10. Obviously doesn't entirely work out of the box, had to make a few modifications such as hardcoding both SECONDARY_STORAGE and ANDROID_STORAGE into the script at the beginning.

I'm just running an SD Card with a primary FAT32 as partition 1 and EXT4 as partition 2. The script finds the partitions just fine and reads the .mounthere of partition 2 no problem.

Issue is when my system boots up and creates the initial /storage on it's own it makes the file permissions 050 owner: system, group: sdcard_r

Even though I execute the script as root (from su, in terminal) it's unable to autocreate the mmcblk1p1/p2 directories in /storage, and my .mounthere file is set to /storage/sdcardext I can't manually create a directory in /storage for it to mount to that at boot time because the system recreates /storage (deletes everything in it and recreates it) every time the system reboots.

The errors I get are:

mkdir failed for /storage/mmcblk1p1 (and p2), read-only file system.

and then on mount attempt, obviously:

mount: No such file or directory

I don't mind that the script is not 100% fully automated (in the sense that I have to hard code the paths for _STORAGE) but other than that it seems to be at least trying to do it's stuff. Is it normal for /storage to be created with 050 ?

At the moment I'm thinking of just throwing in a chmod to /storage just before the mkdir commands in your script and then chmod it back to 050. Don't know if that's the best way of doing things?

Any suggestions?

UPDATE: I've been researching this more throughout the night. I'm not terribly knowledgeable about Linux file system setups but learning - if I understand correctly all the directories under / are actually just kind of virtual mount points created each system boot? As I noticed / is mounted as rootfs which is some kind of ram filesystem?

Anyway... this I guess explains why when I try to create a folder /custmnt/sdcardext it gets "deleted" at each system boot (same as with creating folders in /storage).

So I suppose I need to remount / as rw and create a folder at each boot before your mount script runs, is this correct?
[Verizon Samsung Galaxy S III] HMkX2:
That is just a warning, you can safely ignore it. Like we figured out earlier, your phone's "mountpoint -n" command behaves differently than how it typically should. I coded in a failsafe to allow the script to continue if it detects mmcblk0 -- and assume that's what /system is.

The android_secure stuff was just reported in the debug chatter, there was nothing mounted out of the ordinary. My script did nothing to it.

Use BOOTICE.EXE or MiniTool Partition Wizard (ext4). Both are free.

INSTRUCTIONS HERE.

ANDROID_CACHE=/cache
SECONDARY_STORAGE=/storage/sdcard1
EXTERNAL_STORAGE=/storage/sdcard0
ANDROID_DATA=/data

Standard /storage parameters in CM10.1, it is mounted as writeable:
tmpfs /storage tmpfs [B]rw[/B],relatime,mode=050,gid=1028 0 0

COMMENT OUT line 383-387 to disable "mkdir security":
#	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

Add this line at line 669 to make the /storage writeable:
echo "Creating directory stucture to $mntTARGET"
mount -o rw,remount /storage
mkdir -p "$mntTARGET"
mount -o ro,remount /storage

Those are the only variables you need to hardcode I would think. Check to see which ones already exist by typing 'env' in terminal. And make sure to add the same variables to fixmyfat.sh -- they share some code.

I've also listed the default permissions/state for CM10.1's storage directory above. Type "mount | grep /storage" and report back what it says, so I can compare CM10. In 10.1, it is a tmpfs with rw permissions -- to fix your problem, a simple remount is in order: please see the above code snippet and add it on line 669 if necessary. (chmod isn't the proper solution since it changes PERMISSIONS, not READ-ONLY MOUNTING. As root we have full permissions, so your problem is most likely a RO filesystem.)

I've also given instruction on how to disable the "mkdir security" feature. I put that in in case some noob typed a random directory name in .mounthere, and then complained about it in the thread. (Or, if something maliciously altered the .mounthere file.) In combination with the "remount" above and hard coding those variables, the script should now work fine for you.

Let me know if you have trouble and I will create a backport zip for CM10.
[Verizon Samsung Galaxy S III] Psipherious:
Great thanks for the detailed reply, I'm sure what you've got there should work, I will try those edits later this evening, I doubt you'll have to create a special backport for me.

As for the /storage mount info, here it is:

My system can also be mounted no problem by mounting /dev/block/mmcblk1p1 (and such) diretly instead of those vold/# - I've already mounted this second partition manually a number of times and also mounted the /storage manually as rw and ran your script and it auto mounted the generated /storage/mmcblk1p1 and p2 in there for me.

I will report back later this evening if the script changes work. Do you know if there's an environment variable to ask the system if it's running CM10 or CM10.1? I'm thinking I can construct an if statement to check for CM10 and run those remount commands you listed while still having 10.1 functionality in the script (why? I have no idea... just to make the script more universal? and for fun? ;))

Thanks for your help btw, this script is great and I think is going to help solve a lot of (somewhat unrelated) issues I've been trying to solve, so I thank you very much for your efforts!
[Verizon Samsung Galaxy S III] HMkX2:
if [[ "$myVERSION" < "4.2" ]] ; then
storageREMOUNT=1
#Set your env variables here
echo ""
echo "You are running CM10 / 4.1?"
echo "Hardcoding a couple values for you..."
fi

See line 533, I use it to detect if they are running 4.2.2. It's a string comparison op, so it will break around version 10 but by then who cares. You would merely need to substitute the phrase. [[ $myVERSION" < "4.2" ]]. Just be mindful of spaces -- you need one before AND after the [[ and ]] or it may misread the line.

I will create an 'official' backport later. At least then if something goes wrong it can point back to me. This is just a script, after all. :)
[Verizon Samsung Galaxy S III] Psipherious:
Okay so here's my modifications:

I put this in around line 36 (added a check for not-ICS):

if [[ "$myVERSION" < "4.2" ]] && [[ "$myVERSION" > "4.0" ]] ; then
storageREMOUNT=1
ANDROID_CACHE="/cache"
ANDROID_STORAGE="/storage"
SECONDARY_STORAGE="/storage/sdcard1"
EXTERNAL_STORAGE="/storage/sdcard0"
ANDROID_DATA="/data"
echo ""
echo "You are running CM10 / 4.1?"
echo "Hardcoding a couple values for you..."
fi

And this down around like 395:

echo "Creating directory stucture to $mntTARGET"
mount -o rw,remount /
mount -o rw,remount /storage
mkdir -p "$mntTARGET"
mount -o ro,remount /
mount -o ro,remount /storage

It mounts what I need (my custom .mounthere) and works at system boot. I see that it gets a mount error for mounting /storage/mmcblkp1 however I realize I would just need to add a line in for mount -o rw,remount /storage just before it mounts that.

You can see if there's any other errors worth noting. I've attached my output file:
[Verizon Samsung Galaxy S III] tanc00:
I'm looking for assistance getting this running on my Galaxy S2 GT-I9100. I'm running RR 3.1.3 which includes Android 4.2.1. The kernel is CM10.1

I've installed your files through CWM and I've got an exfat 32gb sdcard formatted and inserted but no joy so far. Attached is my debug.txt output. Any help is greatly appreciated.
[Verizon Samsung Galaxy S III] HMkX2:
Hm... thanks. As I quoted, there is that "mountpoint -n" not resolving synonyms, but it isn't major... yet. (vold___ == mmcblk0) I still have no idea what is causing that, or how to fix it.

Also, you aren't running into it since 4.1 doesn't need the ADB bypass, but technically you need to run any mountpoint altering code (including your remounting /storage) in the adbBypass function. I am really surprised you can't mount into a RO filesystem, I didn't know that!

I

really

need to make an official backport to CM10 / 4.1.

THIS is far more interesting. What are you using to format the card exFat? It seems the header signature is slightly different from what I am used to seeing. You have (2) options:

(1) Format the partition exFat using a different utility

(2) Help everyone else (and me) by showing what the regular header looks like

To do (2), (a) put the card in Windows and run "chkdsk /f" to fix it (b) get BOOTICE.exe from THIS POST HERE (c) Run BOOTICE with the card plugged in, select it from the dropdown box, (d) click "View Sector" in the bottom right then type in sector number "63". If you could copy/paste the text it displays in a .txt document, I'd appreciate it.
[Verizon Samsung Galaxy S III] Captain_Throwback:
So I decided I would try this script on my Supersonic. It's an older device, mtd not emmc, and I think that's a problem for this script as it currently stands.

My internal data partition is on mtdblock6, and my SD card is mounted at mmcblk0p1, which I believe is in your "NOGO" zone. Thus, I can't get the card to mount.

Any ideas on what I can do to get it working?
[Verizon Samsung Galaxy S III] Serkenar:
I9100 CM 10.1 20130301 + Dorimanx 8.0 kernel

Hi!

I tried to use your mod on my SGS2 with CM 10.1 20130301 nightly + Dorimanx 8.0. It ended up with lots of errors. See log attached. Any way to fix this?

Thank you! :)

P.S. I see now that tanc00 has already reported this issue, sorry for making mistake not to read a preceding page before posting this! :)
[Verizon Samsung Galaxy S III] DeathmonkeyGTX:
Op, I can't begin to describe how you are my hero. I've been hunting exfat support for my LG Optimus G E970's sd card (AT&T in the U.S.) in AOSP roms since aosp came out for the device. Thank you very much!!!

Edit:

Flashed it and with zero configuration on my LG Optimus G E970 and it works with my Samsung UHS 1 64GB card absolutely perfectly in synergy's codefirex SR15. It really is quite slick indeed! You are the win!
[Verizon Samsung Galaxy S III] HMkX2:
No worries. Your issue is

different

from tanc00's -- thank you for providing the debug.txt, it told me that immediately.

Two problems for you: one is not that bad (a "warning"), second is bad (an "error"). Warning: you have two 'weird' devices (zzram0 - 2) that are unrecognized. That can be ignored, since my script ignores them.

Error/bigger problem: your BusyBox seems to be out of date. ("BusyBox v1.20.2-cm9 static (2012-07-14 01:52 +0200) multi-call binary.") That is from

CM9

. Tell your ROM maker to update it.

Because your BusyBox is old, the "head" function doesn't support a method I use, "-c <bytes>". (And probably "tail" too.) That causes a chain-reaction of failures in my script, but luckily it errors out before doing anything. Without significantly rewriting my script, or updating the BusyBox on your ROM, there isn't much I can do.

BusyBox v1.20.2-cm9 static (2012-07-14 01:52 +0200) multi-call binary.

Usage: head [OPTIONS] [FILE]...

Print first 10 lines of each FILE (or stdin) to stdout.
With more than one FILE, precede each with a filename header.

-n N[kbm]	Print first N lines [B]<- no -c option is listed[/B]

N may be suffixed by k (x1024), b (x512), or m (x1024^2).

Edit: On second look, I can change it in one line of code. Looks like you are in luck. I normally avoid DD like the plague if I can, but in this case, it is all you can do.

Line 232:
Change
[B]devSIG=`head -c 8 $blockDEV|tail -c 4`[/B]
to
[B]devSIG=`dd if="$blockDEV" conv=notrunc bs=1 count=4 skip=4 2>/dev/null`[/B]
[Verizon Samsung Galaxy S III] HMkX2:
Yes, there is a way you can get it to work -- but I am not going to put it in the public script since on any other device it would cause havoc.

Line 183:
Change [B]NOGO="mmcblk0"[/B] to [B]NOGO="mtdblock"[/B]

Line 197:
Change
[B]myPARTS=( $(cat /proc/partitions|grep -v -e "$NOGO" -e mmcblk0 -e dm- -e loop|tail -n+3|tr -s ' ') )[/B]
to
[B]myPARTS=( $(cat /proc/partitions|grep -v -e "$NOGO" -e dm- -e loop|tail -n+3|tr -s ' ') )[/B]
or, for permissive listing
[B]myPARTS=( $(cat /proc/partitions|grep -e mmcblk0 -e mmcblk1|tr -s ' ') )[/B]

One term you can use is "mmcblk0p1$" -- the $ is important, otherwise it will match mmcblk0p10 as well.
You can delete the mmcblk1 if not desired.
[Verizon Samsung Galaxy S III] Serkenar:
Thank you very much for your reply and a fix :) This workaround did fix the issue with 'head' busybox applet.

Unfortunately, it still doesn't work. Maybe there's something wrong with the fs? The card was formatted by Galaxy Note 2 rom as exfat and is properly recognized by my PC as well as my NAS (using fuse-exfat 1.0.1, btw).

Log attached :)

EDIT:the card was corrupted. [ROM] [ZERO]BUG ROM v5.1 GALAXY NOTE 2 MINI (a rom for I9100 based on sammy Galaxy Note 2 rom) I tried (since it has exfat support) recently crashed and seized booting (restored CM10.1 from backups afterwards). Probably, it corrupted the sd card fs when crashed. I reformatted it on my PC and gave it another try. Script appearingly ran fine. Supersu prompted for root access and I gave it. Then rom reported that there was an sd card and it had to be formatted. I rebooted then and lost root access. su binary just did nothing, it gave no root rights, even after updating it and reflashing the kernel. I had to restore my backups via cwm. Tell me how I can get you some info that would help, and I can try it again :)

EDIT 2: another strange thing is that after this happened the card was corrupted again, my PC failed to recognize it and I had to have it formatted once more.

EDIT 3: ok, I tried the same process on a different 4.2.2 AOSP rom (JellyBam 6.5.0, based on CM 10.1, AOKP and Paranoid). Once again, after granting root privileges to ADB Shell, su binary doesn't work anymore. And there's a notification saying that SD card is corrupted and has to be formatted. After reboot this message is gone. Had to restore backups again. As well as to reformat the sd card.

EDIT 4: it looks like I loose root even without granting root privileges to ADB Shell. I attached the log "debug2.txt". Tried with ntfs this time around. btw, if I DO grant those permissions, the card IS mounted, but it is neither appearing in Store Manager nor recognized as sd card by any apps.
[Verizon Samsung Galaxy S III] HMkX2:
From what you describe, there are a couple issues.

(1) Losing SU access. I have no idea what is causing this.See Edit 2 Nothing I do touches the SU binaries. I did notice something weird with where your ADB keys are stored. I will investigate further.

(2) Script cannot repair your exFat header. I need to see what your exFat header looks like. Please do the following and report back:

To do (2), (a) format exFat card, put working card in Windows(b) get HxD from HERE (c) Run HxD with the working card plugged in (d) click "Extras menu -> Open Disk" and select your exFat card "F:" or whatever. If you could copy/paste the text it displays until offset 0200 (0240 to be safe) in a .txt document, I'd appreciate it.​

of if you have Linux

Run this command in Linux:

dd if=<your exFat partition> bs=512 count=1|hexdump -vC > header.txt​

I will re-state one thing: CM10.1 corrupts exFat as soon as it sees it. The script attempts to iterate through all known good header signatures. The reason it REMAINS corrupted after my script is run is that I don't have a full list yet. That is why I am asking for that .txt, so I can add one more in. Until I have that, once CM10.1 corrupts it, the card will remain corrupted -- my script has no way of fixing it.

You do not need to reformat every time. Run "Chkdsk /f <drive:>" in windows.

The ROMs you are testing on are behaving very oddly. I am going to try using SuperSU and seeing if I get the same problems on CM10.1. If you deny "ADB Shell" root access, it will wreak havoc in my script. Half the commands will fail and I have no error checking for that type of user-generated error.

Edit: It seems I may have found the issue. Try unticking the "Respect CM10.1 root settings" option in SuperSU or going into "Settings -> Developer Options -> Root Access" and setting it to Apps (at least). That is a quick fix, but let me know if it works.

Edit 2: Yep, that's it. That is one extremely wacky error. Apprently, since you were on a "fresh" install, your system property "persist.sys.root_access" was unset (did not even exist). My script creates that if necessary, but due to a fluke of Android coding, there is no such thing as "unsetprop" command -- so when my script is done it merely "blanks" (e.g. ' ') the variable -- but it exists now. SuperSU sees the blanked variable, assumes it means "NO ROOT EVAR" and acts up.

I need to find a way to "unset" a System Property from command line to fix this. Like I said, this is a REALLY wacky error. I think I'll have to create my own solution. (Also, all your flashing/wiping was pointless... disabling root was a single setting in Dev Options!)
[Verizon Samsung Galaxy S III] Captain_Throwback:
It seems that it won't even get far enough for those lines to kick in.

I get an error about Secondary Storage not being defined, and a possible need to hard code it. Is it because my only SD card is actually mounted at /storage/sdcard0, and automatically linked to /sdcard? Will I need to hard code that somewhere for the script to even run?

P.S. You could add some logic into the script to look for proc/emmc or proc/mtd, and depending on which one exists, run the specific code for each. Just an idea to make the script a little more universal for older devices that may also be able to support exFAT on newer Android versions.
[Verizon Samsung Galaxy S III] Serkenar:
header.txt attached. I run windows, since I don't have sufficient internal hdd storage on my laptop, so I can't dualboot and I need windows for my studies. Bootice showed zeros on block 63, I guessed that was wrong and so I used virtualbox to get the header.

Sorry, I wasnt' reading the OP attentively enough.

You're 100% right, that's due to "persist.sys.root_access" being unset before launching the script. However, quick fix you suggested doesn't help. I tried setting "Settings -> Developer Options -> Root Access" to Apps or Apps+adb. Also tried ticking/unticking the "Respect CM10.1 root settings" option in SuperSU. (the only Developer option in SuperSU, btw, is "Enable permission warning" and obviously that won't help). The only fix I found was issuing `setprop persist.sys.root_access "3"` in the terminal before or immediately after (while I'm still root) you script is run for the first time.

To sum up, now I have my root and your script mounting my SD card (ntfs for now) when being run. However, it isn't mounted automatically on boot, isn't displayed in Storage Manager and isn't recognized as an SD card by apps. Any ideas how to fix that? Would another log help? :)

Thank you for your assistance and effort! :)
[Verizon Samsung Galaxy S III] Captain_Throwback:
There is no "Internal Storage" on this device. There is only /data, and my SD card, which gets mounted at /storage/sdcard0 in Android. I think that's where the confusion is.

So I don't know what that storage should be called. I believe it's External Storage. It is certainly not Secondary Storage, as it is literally the only card in the device. I think it's the script's handling of those monikers that is causing the issue here. In Psipherious's example, both are still being defined, whereas in my case, I only have sdcard0 (which means that is the "last link"). Can anything be done about that?

EDIT: Maybe I can try setting both as sdcard0?
[Verizon Samsung Galaxy S III] HMkX2:
Bingo, that would be my bet. What version of Android is it running? And could you paste me the "debug.txt"? I will see if I can add support for MTDblock devices.

Confirmation: your "plug-in" (/dev/block/mmcblk0p1) sd-card is mounted at /storage/sdcard0, (/dev/block/mtdblock6) is /data? That is weird. So your phone has no built-in media storage!
[Verizon Samsung Galaxy S III] Captain_Throwback:
That is correct! The device is 3 years old after all, but it's running Android 4.2.2. So no media storage built in, just internal data, and SD card.

Very short debug.txt attached.
[Verizon Samsung Galaxy S III] HMkX2:
I've uploaded an experimental version of 5.5. It is a hack rewrite on devices I have not tested, and uses a bunch of algorithms on blind faith, but it might help with your problem.

Supports CM10 (hopefully) with Psipherious's intel

MTDblock devices with no external SD card (hopefully)

Synonym checking to get rid of the "mountpoint -n is behaving badly" error (or set your phone on fire)

If you use 5.5, post a Debug.txt so I can tell if it is working correctly.
[Verizon Samsung Galaxy S III] Serkenar:
Yes, I know how to access developer options and I did all that yesterday. At least I thought I did. Tried that today and it worked. So, yes, your fix works just fine, regardless of the "Respect CM" SuperSU option.

Reflashed the Note 2 MINI ROM and formatted the card to get the header. See attached :)

I've uploaded a log of ntfs card being mounted ok (though I suppose it isn't of any use to you). Also, I tried issuing `vold` command manually: it triggers "Preparing SD card" notification, but the card isn't still recognized afterwards.

Tell me if I can get any more info that might help :)

Thank you :)

P.S. Yes, the script is launched on boot time and mounts the card, but it isn't recognized

P.P.S.

No need for an updated debug.txt here. Sorry for misguiding you, your script fixes and mounts card with "the newer" header (formatted by windows) just fine :)