[MOD] 1-Click Flashable exFAT + NTFS + EXT4 support for CM10.1/AOSP + Partitioned SD!

Search This thread

lordazoroth

Senior Member
Jul 21, 2012
176
80
Phoenix
Just flash the zip. It handles everything and has the NTFS binaries included.

The update-script automatically removes "old" versions of my scripts and places the new ones in their place. It deletes the following extraneous files from the original release, since they don't work; if you actually want the exfat utils (even though they all fail saying "cannot get size"), you have to add them back in manually.
Code:
delete("/system/etc/init.d/50exfat-mountsd"); <- Replaced with  50fuse-mountsd
delete("/system/xbin/exfat-mountsd.sh"); <- Replaced with fuse-mountsd.sh

delete("/system/xbin/dumpexfat"); <- None of these work anyway
delete("/system/xbin/exfatlabel");
delete("/system/xbin/exfatfsck");
delete("/system/xbin/mkexfatfs");

Thank you so much! :D
 

Captain_Throwback

Recognized Developer
Re: [MOD] 1-Click Flashable exFAT + NTFS + EXT4 support for CM10.1 / AOSP (external S

This is an interesting mod. I'm trying the script on my EVO 4G LTE, running CM10.1, Android 4.2.2. The script doesn't detect that I'm running as root, as my Terminal simply identifies me as user 0 (still root). But the script won't continue. Does it matter that I use SuperSU to gain root? Maybe I should try adjusting the script to allow for identifying user 0 as root (how would I do that?)

I only decided to try this because TWRP recovery recently enabled support for exFAT, and the card reads fine there after reformatting. I know the block is set properly, so that's not it. Just the root user recognition appears to be the issue. Can you help?
 

HMkX2

Senior Member
Jan 31, 2010
98
135
This is an interesting mod. I'm trying the script on my EVO 4G LTE, running CM10.1, Android 4.2.2. The script doesn't detect that I'm running as root, as my Terminal simply identifies me as user 0 (still root). But the script won't continue. Does it matter that I use SuperSU to gain root? Maybe I should try adjusting the script to allow for identifying user 0 as root (how would I do that?

I did a pretty basic check for root - it runs "whoami" and looks for the string "root". I have tested my script against Chainfire's SU 1.3 and SuperUser 3.3 - the only difference I noted was Chainfire was a bit slower/laggier due to the popups, and didn't allow ADB shell root access by default - I had to click "ok". Also, the command parameters for an internal command I use (adb shell su -c "blah") were a bit glitchy, and didn't handle escaped strings well.

Could you please run ("whoami" and "id") command and tell me what string it reports? I'll edit the checking in for you and so others can use it. I will look into the proper method to detect root -- but busybox has limited utilities to do so.
 
Last edited:
  • Like
Reactions: Captain_Throwback

Captain_Throwback

Recognized Developer
Re: [MOD] 1-Click Flashable exFAT + NTFS + EXT4 support for CM10.1 / AOSP (external S

I did a pretty basic check for root - it runs "whoami" and looks for the string "root". I have tested my script against Chainfire's SU 1.3 and SuperUser 3.3 - the only difference I noted was Chainfire was a bit slower/laggier due to the popups, and didn't allow ADB shell root access by default - I had to click "ok". Also, the command parameters for an internal command I use (adb shell su -c "blah") were a bit glitchy, and didn't handle escaped strings well.

Could you please run ("whoami" and "id") command and tell me what string it reports? I'll edit the checking in for you and so others can use it. I will look into the proper method to detect root -- but busybox has limited utilities to do so.
Turns out your script is fine. I had a poorly compiled version of CM10.1. I used a more reliable version, and now everything works as intended.

So I'm able to use MTP to view the files in Windows (or mount as Mass Storage in recovery), and now the device is able to read from the external SD with no issues.

The only thing I can't do (this being an HTC device) is use the external SD card to update firmware via the bootloader, because the HTC bootloader can't read the card. However there are ways around that, and I'd rather have the card formatted as it was intended.

Thanks for your work on this! You can add the HTC EVO 4G LTE to your list of working devices (at least on CM10.1/Android 4.2.2).
 

HMkX2

Senior Member
Jan 31, 2010
98
135
The only thing I can't do (this being an HTC device) is use the external SD card to update firmware via the bootloader, because the HTC bootloader can't read the card. However there are ways around that, and I'd rather have the card formatted as it was intended.

You'll be happy with my 5.0 release. I'm currently coding multiple-partition support, and user-customizable dynamic mountpoints. :)
 
  • Like
Reactions: Captain_Throwback

spearoid

Senior Member
Feb 21, 2009
763
166
Re: [MOD] 1-Click Flashable exFAT + NTFS + EXT4 support for CM10.1 / AOSP (external S

I have a long question I want to ask you that is related to this thread but sort of off topic still. I tried to PM you but got a message that either you can't receive PM's yet or you've chosen not to receive them. Shall I post it here?
 

HMkX2

Senior Member
Jan 31, 2010
98
135
I tried to PM you but got a message that either you can't receive PM's yet or you've chosen not to receive them.
PM enabled.

For future reference, I do not check PMs... ever. Please do not consider it an insult if I pretend like I never read it. Chances are I haven't. :eek:
 

HMkX2

Senior Member
Jan 31, 2010
98
135
Major Update: Version 5.0 is out.

Multiple partitions are supported. Also no more probing back and forth for Block Device, it's all automatic. (Word of warning: it blacklists mmcblk0, but does "explore" a little bit. Please inform me if it lists any inappropriate mounts. I may switch it back to manually specifying device.)
 

Captain_Throwback

Recognized Developer
Major Update: Version 5.0 is out.

Multiple partitions are supported. Also no more probing back and forth for Block Device, it's all automatic. (Word of warning: it blacklists mmcblk0, but does "explore" a little bit. Please inform me if it lists any inappropriate mounts. I may switch it back to manually specifying device.)
Wow. My head a-splode.

your_head_a_splode.png


Okay, so in order for my bootloader to have a partition to read, I'm going to need to create a FAT32 partition on my SD card in addition to the current EXT4 & exFAT partitions. If I do it that way, will they all mount automatically? I'm wondering how/if TWRP will be able to see all of them, since it can read the external storage as exFAT with no issues, as well as the EXT4 partition. I assume the .mounthere files will only affect the OS while booted, so it can't really affect what the bootloader sees, forcing me to create multiple partitions. What about when mounting to PC via MTP? Will both the FAT32 and exFAT partitions be mounted (in addition to my internal storage)? Currently I get internal storage and SD card. I would expect a third entry there for the FAT32 partition?

This might be getting more complicated than I can handle :eek:.

EDIT: Okay, upon re-reading the OP, I think I get it. I need to add a FAT32 partition at the beginning of the card for the bootloader to read. Then, on my exFAT partition, I need to add a .mounthere file that tells the OS to mount my large storage partition at /storage/sdcard1. My FAT32 partition will automatically be mounted at /storage/mmcblk1 (or I can create a folder somewhere and a .mounthere file to have it mounted elsewhere). That part I think I now understand.

What I don't know is how/if TWRP will handle the additional partition. I may have to specify the block location of the new partition in the recovery.fstab and compile a custom version myself to get it to mount. Which is fine, if I can get my buildbox running again. But I don't know if TWRP can handle all those partitions by default, and if it can, how/where they would be mounted.
 
Last edited:

HMkX2

Senior Member
Jan 31, 2010
98
135
Okay, so in order for my bootloader to have a partition to read, I'm going to need to create a FAT32 partition on my SD card in addition to the current EXT4 & exFAT partitions. If I do it that way, will they all mount automatically?
Yes, but only with my script. Create Fat32 (p1) and exFAT+ext4 (p2 and p3).

"Dumb" programs that don't support multiple partitions (Windows [!!], bootloader, CM10.1/AOSP roms) will happily look at the FAT32 (p1) as if it is the only one on the drive. (Although, Windows at least recognizes other partitions exist -- and you can toggle some flags using BOOTICE.exe to make them visible.) My script will come along when you run it (or automatically at boot) and mount things as necessary.

I'm wondering how/if TWRP will be able to see all of them, since it can read the external storage as exFAT with no issues, as well as the EXT4 partition. I assume the .mounthere files will only affect the OS while booted, so it can't really affect what the bootloader sees, forcing me to create multiple partitions.​
Bingo. Dumb programs (bootloader/CM10.1) = only see partition1, smarter programs (TWRP/my script) = see everything. ("But it's too late!")

What about when mounting to PC via MTP? Will both the FAT32 and exFAT partitions be mounted (in addition to my internal storage)? Currently I get internal storage and SD card. I would expect a third entry there for the FAT32 partition?​
In short, no. (Not without some serious hacks to the ROM/stuff I don't know how to do.) Whatever is mounted under "/storage/sdcard1" and "/storage/sdcard0 (more properly, "/data/media") will be visible in MTP. Obviously, you can't mount two things there at once -- only two partitions can be visible.

However, people use a trick where they use "mount -o bind" (Directory Binds, see that program) to make a "Portal" (ala Valve) to another part of the filesystem inside a visible one. However, because of a technical bug current utilities will not work. (Why I was so emphatic on my script being able to work around it.) So yes: it is entirely possible, no: existing utilities cannot do it for you because of a bug (e.g. DirectoryBind + 4.2) , and no: I haven't coded for it (yet).

EDIT: Okay, upon re-reading the OP, I think I get it. I need to add a FAT32 partition at the beginning of the card for the bootloader to read. Then, on my exFAT partition, I need to add a .mounthere file that tells the OS to mount my large storage partition at /storage/sdcard1. My FAT32 partition will automatically be mounted at /storage/mmcblk1 (or I can create a folder somewhere and a .mounthere file to have it mounted elsewhere). That part I think I now understand.​
Bingo, that is 100% correct.

What I don't know is how/if TWRP will handle the additional partition. I may have to specify the block location of the new partition in the recovery.fstab and compile a custom version myself to get it to mount. Which is fine, if I can get my buildbox running again. But I don't know if TWRP can handle all those partitions by default, and if it can, how/where they would be mounted.​
I have absolutely no idea. It depends on how robustly TWRP is coded.

You have to remember I wrote this all in *bash/busybox script*. I am pretty much pushing the limits of what Bash is capable of. I know how to code, but not at the level of "unintelligibility" of the CM10.1 codebase -- if I could compile and knew more about kernel programming, gerrit etiquette, and the "politics" behind code review, I just would have have coded exFAT/ext4/NTFS/btfs support for CM10.1 myself by now.

However, Busybox is near-universal, the binaries are portable, and my script will work on any phone you throw it at.
 
Last edited:
  • Like
Reactions: Captain_Throwback

Captain_Throwback

Recognized Developer
So . . . I have my 3 partitions set up:

FAT32
exFAT
ext4

And the .mounthere file is working marvelously on the second two . . . but the FAT32 partition (@ /dev/block/mmcblk1p3 according to /proc/partitions) isn't getting mounted by default under /storage. Any idea why?

And for the record, it seems TWRP overlooks the initial FAT32 partition and just reads the exFAT, which is perfect. I haven't tested bootloader yet, as I only have access to all 3 partitions in Ubuntu currently.
 

HMkX2

Senior Member
Jan 31, 2010
98
135
...the .mounthere file is working marvelously on the second two . . . but the FAT32 partition (@ /dev/block/mmcblk1p3 according to /proc/partitions) isn't getting mounted by default under /storage. Any idea why?
Can you please post a debug.txt using the command posted in the OP? I have a suspicion it will say "device busy", since Vold auto-mounts fat32. (Although, it would be the first time I've heard of it mounting partition #3!).
fuse-mountsd.sh > /sdcard/debug.txt 2>&1​
I coded in something to try to unmount it if it did that, but it seems that isn't working. I need to find out why.
 

Captain_Throwback

Recognized Developer
Can you please post a debug.txt using the command posted in the OP? I have a suspicion it will say "device busy", since Vold auto-mounts fat32. (Although, it would be the first time I've heard of it mounting partition #3!).
fuse-mountsd.sh > /sdcard/debug.txt 2>&1​
I coded in something to try to unmount it if it did that, but it seems that isn't working. I need to find out why.
Looks like the script isn't recognizing the partition type as FAT32 for blk3. Attaching log momentarily.
 

Attachments

  • debug.txt
    30.4 KB · Views: 8
Last edited:
  • Like
Reactions: HMkX2

Captain_Throwback

Recognized Developer
And now, after mounting my internal storage to my computer in Mass Storage mode, I get a "Damaged SD card" error, and it seems my exFAT partition is corrupted (again). Looks like I'll be reformatting and restoring data again.

I do still like this idea, even though I've ended up reformatting my card several times already (once by forgetting to install the script after a system wipe). I can give you the log from the failed repair attempt too, if you'd like.
 

HMkX2

Senior Member
Jan 31, 2010
98
135
Ah, cripes. There's an even bigger problem than that. You see that giant error at the top saying to report it, that it couldn't determine the NO-GO zone? Those DM- devices shouldn't be mounting! I may pull 5.0 until I can fix that problem.

I can give you the log from the failed repair attempt too, if you'd like.​

And yes, the more logs the merrier. I only have 1 Android device to test on -- I need to see what is wigging out on other devices.

And now, after mounting my internal storage to my computer in Mass Storage mode, I get a "Damaged SD card" error, and it seems my exFAT partition is corrupted (again). Looks like I'll be reformatting and restoring data again.
..
I do still like this idea, even though I've ended up reformatting my card several times already (once by forgetting to install the script after a system wipe).

Wait.... what? You formatted your *internal* storage as exFAT?? (Not your SD card/external storage?) My script was never intended to mount anything on the INTERNAL memory!

(Technical explanation:) I explicitly blacklisted anything on mmcblk0 to forestall the possibility of people mounting their modems/system/whatever by accident. I could add that support IN, but to me the risks would be too great without knowing EXACTLY how each+every person's partition table is set up.

Request:

Can you run these commands and give me the outputs?

Code:
dd if=/dev/block/mmcblk1p3 bs=512 count=1 of=/sdcard/dd_mmcblk1p3.bin.rar
-- Will create dd_mmcblk1p3.bin.rar in your SD card, please upload that.
-- This will tell me what the header signature looks like, I'll have to check it

cat /proc/mounts > /sdcard/mounts.txt
cat /proc/partitions > /sdcard/partitions.txt
-- Will create 2 .txt files on your SD card, I can use those to find out what is mounted where on your phone

I need to know more before specifying anything further.
 
Last edited:

Captain_Throwback

Recognized Developer
Ah, cripes. There's an even bigger problem than that. You see that giant error at the top saying to report it, that it couldn't determine the NO-GO zone? Those DM- devices shouldn't be mounting!

I may pull 5.0 until I can fix that problem.

And yes, the more logs the merrier. I only have 1 Android device to test on -- I need to see what is wigging out on other devices.
I did notice that. Good thing I reported it, then (kind of :eek:). And here's my other log, from the partition that couldn't be repaired.

Is it possible, on the first successful mount, to take a snapshot of the partition information, and then use that to restore the damage later, if necessary? I'm not sure how you're doing it now, but I assume it tries to replace the damaged portions with some standard information, and I was wondering if taking the info from the actual device somehow would be better (if it's even possible). Just spitballin' here, of course. I won't purport to know how this works ;).
 
  • Like
Reactions: HMkX2

HMkX2

Senior Member
Jan 31, 2010
98
135
Is it possible, on the first successful mount, to take a snapshot of the partition information, and then use that to restore the damage later, if necessary? I'm not sure how you're doing it now, but I assume it tries to replace the damaged portions with some standard information, and I was wondering if taking the info from the actual device somehow would be better (if it's even possible). Just spitballin' here, of course. I won't purport to know how this works ;).
Not spitballin', that's exactly what I thought at one point. I even mention around Page 2 that I had an option of that and another way, and I chose the other way.

There are a couple problems with "saving" the header from the first time it works. (1) There are large chunks of hex of dubious function (2) Where would I store the header? The card? The phone itself? Chicken and the egg. (3) What would happen if you plugged in a DIFFERENT card? It would overwrite it's header with the wrong one!

May I ask what you are using to format the card exFAT? If you get it to the point exFAT is working can you run this command to dump the header of the exFAT partition? OR flash version 5.2 of my script and give another debug.txt, I turned on full logging -- much, much less legible output for the user, but easier for me to find specific problems.

dd if=/dev/block/mmcblk1p1 bs=512 count=1 of=/sdcard/exfat_header.bin.rar​

PS: You do not need to reformat your SD Card and restore data every time. Simply plug the card into Windows and run Chkdsk /f on the partition. You can toggle which partition is visible using BOOTICE.exe. Run the program, click "Parts Manage", click "ReFormat USB Disk" (ignore its name, it is a poor choice of words), and see if "USB-HDD mode" is selected. (It should be.)

Then use the dropdown box, select which partition you want visible, and click "Set Accessible". Click Cancel button to quit. Windows should see that partition for Chkdsk /f now.
 

Attachments

  • BOOTICE.zip
    145.7 KB · Views: 313
Last edited:

HMkX2

Senior Member
Jan 31, 2010
98
135
And if I didn't say it already, thank you for the logs and testing! This is what I need to try to make the script work for everyone, even the people who lurk and don't comment.
 
  • Like
Reactions: Captain_Throwback

Captain_Throwback

Recognized Developer
Wait.... what? You formatted your *internal* storage as exFAT?? (Not your SD card/external storage?) My script was never intended to mount anything on the INTERNAL memory!

(Technical explanation:) I explicitly blacklisted anything on mmcblk0 to forestall the possibility of people mounting their modems/system/whatever by accident. I could add that support IN, but to me the risks would be too great without knowing EXACTLY how each+every person's partition table is set up.

Request:

Can you run these commands and give me the outputs?

Code:
dd if=/dev/block/mmcblk1p3 bs=512 count=1 of=/sdcard/dd_mmcblk1p3.bin.rar
-- Will create dd_mmcblk1p3.bin.rar in your SD card, please upload that.
-- This will tell me what the header signature looks like, I'll have to check it

cat /proc/mounts > /sdcard/mounts.txt
cat /proc/partitions > /sdcard/partitions.txt
-- Will create 2 .txt files on your SD card, I can use those to find out what is mounted where on your phone

I need to know more before specifying anything further.
Oh, no - sorry for the confusion. It just so happens that after mounting my internal card to the computer, that the EXTERNAL card showed as damaged. I wouldn't dream of formatting my phone's internal memory to a non-native format.

I'll pull this information for you as soon as I can. I'm at work right now, so my options are limited. Oh yeah, and the card is at home.

Not spitballin', that's exactly what I thought at one point. I even mention around Page 2 that I had an option of that and another way, and I chose the other way.

There are a couple problems with "saving" the header from the first time it works. (1) There are large chunks of hex of dubious function (2) Where would I store the header? The card? The phone itself? Chicken and the egg. (3) What would happen if you plugged in a DIFFERENT card? It would overwrite it's header with the wrong one!

May I ask what you are using to format the card exFAT? If you get it to the point exFAT is working can you run this command to dump the header of the exFAT partition? OR flash version 5.2 of my script and give another debug.txt, I turned on full logging -- much, much less legible output for the user, but easier for me to find specific problems.

dd if=/dev/block/mmcblk1p1 bs=512 count=1 of=/sdcard/exfat_header.bin.rar​

PS: You do not need to reformat your SD Card and restore data every time. Simply plug the card into Windows and run Chkdsk /f on the partition. You can toggle which partition is visible using BOOTICE.exe. Run the program, click "Parts Manage", click "ReFormat USB Disk" (ignore its name, it is a poor choice of words), and see if "USB-HDD mode" is selected. (It should be.)

Then use the dropdown box, select which partition you want visible, and click "Set Accessible". Click Cancel button to quit. Windows should see that partition for Chkdsk /f now.
I won't be able to finish formatting the card until I get home, but when I do, I'll dump the header for you.

I'm using the plain old Windows Disk Management tool to format as exFAT. None of my other programs will do it (MiniTool or Paragon).

Great tip on the reformatting thing. Since I have a FAT32 partition at the beginning of the card, Windows wasn't giving me any options to do anything with it. I'd prefer to not have to reformat the card anymore, so hopefully chkdsk /f works (or we find a way to avoid the corruption at all, which would be ideal).

On the header thing - I understand the issues there. Isn't there any check that can be run to confirm the identity of the card inserted into the device? That would be a way of ensuring that the wrong card's header doesn't overwrite a different card. When I insert the card in Ubuntu it seems to have some number by which it mounts the partition as /media, and it seems to be different for every card. But I have no idea where it's getting that from. It's an 8-digit code I think with a dash in the middle, comprised of letters and numbers.

And in the case of where - how about the root of internal storage, or providing an option to the user on where to store it? I know some devices have limited space, so that would be the most flexible option, I suppose.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 50
    August 4th 2013 - This script has not been maintained in a while. A big thank you to Captain_Throwback for providing continued support.

    This is now minimally supported.
    Now that CM is adding native NTFS/exfat support, the only thing my script handles is multiple partitions.

    July 21 2014 - Thank you n01ce! Please see n01ce's post for a "6.5 Alpha" that may solve some checksum problems with exFAT. I have changed devices, so this thread is for historical purposes/legacy support.


    "HELP! I accidentally made my exFat card unreadable!!" -- or-- "I can't see more than 1 partition in windows!!"

    Please read the instructions at the bottom of THIS POST HERE. No data will be lost!

    "My card was working up until a moment ago but now the phone is showing "card damaged!!"

    Re-run the script by typing "fuse-mountsd.sh" as root. The script will attempt to repair and re-mount.
    If that fails, run "chkdsk /f" in Windows. Do not reformat until it is the last resort!

    TL;DR: (Flash this), put exFat/FAT32/NTFS/EXT4 sdcard in, reboot.
    To remount, type "fuse-mountsd.sh" in a console (or) run using RomToolbox Lite (in /system/xbin/)
    Needs to be run every time card is ejected + reinserted -- including when UMS is used

    To unmount, type "fuse-mountsd.sh umount" (or if 1 partition) use Storage Manager

    Non-customized multi-partitions mounted in /storage/<their name>

    • Uses init.d to fix/mount at boot
    • Scans for/mounts all useable block devices (with safety checks)
    • User-specifiable dynamic mount points
      ~~Create a ".mounthere" file in the partition with the first line "/location/to/mount/at"
      ~~Use the first line "skip" or "SKIP" to bypass that partition
    • Rescans for media when you re-mount
    • Repairs typical exFat damage caused by CM10.1 (with safety nets)
    • FAT32 support
    • NTFS-3g support (noatime set to reduce wear)
    • EXT4/3/2 support (*fuse built into JB/CM10.1) <- (MTP+EXT4 permissions need to be set to media_rw:media:rw 775!!))
    • Cleans up after itself: disables/enables ADB/root-security to what you set


    BUGS:

    All -- ntfsfix does not work. Binaries need to be recompiled. Not a major issue only dead weight.
    exFAT may prevent deep-sleep. (NTFS on GS3 doesn't seem to have this issue.)

    If you use EXT4/3/2, you need to run the following commands to allow the card to be accessed by the mobile-user:

    Code:
    find  /storage/sdcard1/ -print0 | xargs -0 chown media_rw:media_rw
    chmod -R 775 /storage/sdcard1/
    
    (or)
    
    find  /storage/sdcard1/ -print0 | xargs -0 chown root:media_rw

    Other phones -- Post a debug.txt if it works for you.

    CM10 (4.1.x) -- Support is experimental. Use at your own risk.

    CM 10.1 (4.2.x) -- Implemented RSA Key Signing Fix, works with BOOTICE.exe partitioned cards.

    EXPERTS:

    Everything is softcoded thanks to the $SECONDARY_STORAGE, $ANDROID_DATA, $ANDROID_STORAGE, $ANDROID_CACHE env variables and get/setprop command. Some locations are hardcoded in the script's "analyzePhone" function as fallbacks.

    To custom-map mountpoints, create a ".mounthere" file in the root of each partition. "skip" or "SKIP" = ignore partition at mount, "/your/path/here" will use that path (or the default if bad). Defaults to "$ANDROID_STORAGE/device_id" if directory is invalid. Removes any temporary directories (in /storage/ only) at unmount. YOU HAVE TO CREATE ANY CUSTOM DIRECTORIES OUTSIDE "/storage" YOURSELF -- I set it like that as a security precaution.

    To disable "Directory Creation Security", edit the line at the top of the script to say "dirSECURITY=0". This script will remount / and /storage as RW if needed.​

    Here is a quick rundown of typical use-cases:

    You want one large (exFat/NTFS/ext4) partition:
    • No customization needed, just flash and go

    You want a small FAT32 partition (p1) at the beginning (for firmware/CWM/TWRP) with another big ext4 partition (p2) for your SD card mount. [ Your ROM's vold will mount (p1:fat32) as /storage/sdcard1 automatically. To get it to swap over: ]
    • Create a ".mounthere" file on (p2) "big" partition with the text "/storage/sdcard1"
    This will override Vold and mount the (p2) as external storage. The FAT32 partition will be mounted in /storage/mmcblk1. If you want to mount it elsewhere (even /data/media/0/extSD ! ) simply add another ".mounthere" on the FAT32 partition. (The directory must already exist -- you must make it beforehand -- or disable Directory Security feature.) Be warned - Vold will mount the first partition as /storage/sdcard1 any chance it gets -- even in the background -- unless there is something mounted there already (by this script).

    You have (1) partition for a game app you play (internal storage) that you want to rebind, (2) another part you want to rebind OVER an existing directory, and (3) your main storage.
    • Create a ".mounthere" on (1) with text "/location/of/your/game/app/data"
    • ".mounthere" on (2) with text "/folder/you/want/substituted"
    • ".mounthere" on (3) with text "/storage/sdcard1"

    You are a long-hair-hippie Linux developer with 4 partitions, each in a different filesystem, and want them mounted hidden from apps and listed by block device so you know what partition you are on:
    • No customization needed, just flash and go :D

    SUPPORT:

    I can only provide support if you supply me with logs. Do so by typing "fuse-mountsd.sh > /sdcard/debug.txt 2>&1" and opening the Debug.txt in your phone's storage.

    It's all automatic now - so if it mounts your modem as writeable and kicks your dog don't blame me. (It excludes dangerous block devices automatically [mmcblk0, /system, mtdblock, etc], but there is always a 1% chance it will miss something.) If it does, report it here so I can fix it.

    If you intend to use this with a other ROMs/phones, IT SHOULD STILL WORK. Post any errors or weird behavior.

    Code:
    Changelog
    
    [I]7.0 - TBA (Make GUI? Fix ext4 permissions automatically? Get paid?)[/I]
    
    6.4 - No longer uses "mount" output (wasn't acting standard-ly. Using /proc/mounts instead)
        - [COLOR="Red"]Got rid of conv=notrunc[/COLOR]. Be careful!
    6.3 - Bugfix to scrubMount code
    6.2 - No longer Experimental / final unstable
        - added rough ext2/3 support
    6.1 - mount command bugfix
    6.0 - Added a bypass for Directory Security, fixed some bugs.
    5.9 - Rewrote NOGO code from scratch -- UUIDs ignored
    5.8 - (??)
    5.7 - Support for Note2 formatted exFat cards + more (0xf4 bug)
    5.6 - bug fixed: no longer detects zram/assumes multimount
    5.5 - [COLOR="Red"]Experimental support for weird devices[/COLOR]
    5.4 - [b]Major bugfix!![/b] Fix fixmyexfat.sh coding fail
    5.3 - Fixed "vffat" support. Undid HARD QUIT on bad Nogo, made it a soft one.
    5.2 - Increased logging of tables, HARD QUIT if Nogo not found
    5.1 - Quick patch to fix dm-* device blacklist
    5.0 - [b]SUPPORTS MULTI-PARTITIONED CARDS! Autoscans for block devs! Complete rewrite![/b]
    4.1 - Quick patch to check mmcblk1
    4.0 - [B]WORKS 100% ON 4.2.2!![/B] My script is the first to achieve this AFAIK
    3.3 - fixed a bug detecting existing mounts (related to "non-persistent mount points" issue)
    3.1 - added dynamic exFAT repair code
    3.0 - added NTFS/ext4 support
    1.0 -> 2.0 <Removed>

    Attribution credits:
    Original thanks go to originator of the method, smitna in the Galaxy S2 forum. Additional thanks go to shardul_seth (Post 23) for compiling the latest version of the fuse-exfat and ntfs-3g binaries for ARM, and of course Andrew Nayenko for his efforts in creating GPL'd exFat code (fuse-exfat on google code).

    [HOWTO][exFAT][WORK IN PROGRESS] Mount exFAT formatted drives and cards - smitna
    Full NTFS Read Write support for Android (ARM) - shardul_seth
    [HOWTO][exFAT][CM10.1] Working 64GB ext sdcard with fuse-exfat (1.0.1) + FIX broken (my original Dev thread)


    I believe the term is I "kanged" their binaries. The rest is mine. This is a "mod"/"hack" until CM adds native support. (If ever: exFat)

    DONATIONS:
    https://supporters.eff.org/donate , or help a noob by linking to a solution in their thread. :good:
    https://plus.google.com/+CyanogenMod/posts/ib5wz8jk1JyOne of the CM Team has flesh eating bacteria! Keep CM alive! (Literally)
    4
    Finally,
    Here's my working implementation to build a static binary under bionic and recovery:
    https://github.com/PhilZ-cwm6/philz_touch_cwm6/commit/b1bbdc2608b5db5e6c400953da42ad68a42b1e09

    Here's a ready binary fully working. Enjoy the really smaller size of bionic
    http://d-h.st/eVo

    Please give your feedback
    4
    (..) I had a really quick question, I know it's somewhat unrelated but can the source files be used to give NTFS support to stock ROMs (non-aosp) and if so, how?
    Yes, entirely possible. Someone did it for EXT4 and it was merged. exFat they hesitated on for moral reasons, NTFS-3g they had no reason. However, their EXT4 version (was) buggy if you ejected/reinserted the card and mine wasn't. They might have fixed that though.

    (S3 International - i9300) (..) is it only flash this file (CM10.1-AOSP_fuse-mountsd_6.4_HMkX2.zip) after flash the rom??
    Yes. Install CM10.x, flash the ZIP in recovery. For most people that is all.

    (MediaTek based devices, both running AOSP ROMs. V987 is running Android 4.2.1 and V970 is running Android 4.1.1.) Both devices have init.d support, but after installing your zip files through recovery mode, the devices weren't able to properly mount the exfat formatted sdcard. While trying to mount it manually, I got the following output:

    Code:
    ~~~~~~~~~ Beginning FS Logic ~~~~~~~~~
    [COLOR="Red"]./fuse-mountsd.sh: line 940: local: can only be used in a function
    ./fuse-mountsd.sh: line 941: local: can only be used in a function[/COLOR]
    Index (0) - [/dev/block/mmcblk1p1\texfat\tmount.exfat-fuse\t-o rw,dirsync,noatime,umask=0\tfixmyexfat.sh]
    [COLOR="Red"]./fuse-mountsd.sh: line 952: [: too many arguments
    ./fuse-mountsd.sh: line 986: local: can only be used in a function
    ./fuse-mountsd.sh: line 987: local: can only be used in a function
    [/COLOR]
    (...)

    As I'm not yet familiarized with your script, do you have any idea of what's happening?
    Those errors in red mean your "shell prompt" is outdated and not liking the way my Bash script is written. You might need to use an updated version of BusyBox. Type "busybox --help" (I think) to find what version you have.

    (...)
    My only problem is transfer rate with MTP = very2 slow. 1-2MB/s
    What's strange is transfer using wifi = 3-4MB/s
    Transfer using card reader = 9-10MB/s

    some problem with MTP driver ?
    MTP sucks. That's a known fact. "SGS3 Easy UMS" app fixes that problem.

    so i must run a script in cm to use exfat and ntfs? is this righT?
    I made a ZIP which makes my script run by itself when the phone restarts. Technically you don't need to do anything more than flash it.

    @HMkX2

    Looks like CM is finally trying to enable exFAT support:

    http://review.cyanogenmod.org/45176

    How will that affect the usage of this script (once it's tested and merged)?
    Hooray! This complete hack of a mod won't be necessary anymore! :D

    (...)
    Ah, NTFS and exFAT support just got merged :)
    Hooray!

    That's not entirely true. The CM implementation doesn't allow for multiple partitions, which the script can/does account for. Since the necessary binaries are now included in CM, however, only the script is really needed now (and it may need to be slightly adjusted for the CM binary names).
    The CM implementation of EXT4 also sucks, the "sdcard" binary causes the phone to lock up since it doesn't terminate when you eject the card. Zombie processes.

    (..)
    When I put .mounthere file with "/storage/sdcard0/extSdCard" inside - it is not mounting. When I select another location (/storage/ExtSD for example) it works (it is mounting, but poweramp still does't shows this location)
    Disable "Directory Creation Security". There are instructions in the top post.

    Unless the directory already exists, my script is set to NEVER create one. It can bind on top of already-existing directories, however. This was a security feature meant to prevent newbies from making zombie folders everywhere.
    3
    I wouldn't say I'm a developer, just a scripter with a lot of time on her hands.

    My only question is: Even though this is written for CM10.1 on Verizon s3, might this also work on T-mobile s3 with an AOSP (Android 4.2.2) ROM?

    MAKE A NANDROID. This mod should do nothing permanently harmful anyway: it looks for EXFAT before writing anything.

    Carrier doesn't matter. It only depends (1) if your kernel has FUSE support, (2) if it has init.d support and (3) what your Block device is.

    1. I think Google added FUSE by default in JB, and anything based off CM10.1 will have it
    2. Type "echo $SECONDARY_STORAGE" in a terminal emulator. If it displays ANYTHING other than blank it should work.
    3. The Block device is trickier. Type "blkid" as root with with your FAT32 card in and out. The one that disappears is your Card's Block device, and should be /dev/block/mmcblk1p1.

    If you have any doubts, don't do it.
    3
    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.
    (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 seem to have similar issues, but I don't understand how the script could be the issue. (YouTube crash)
    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).

    ... my old device I9000...

    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)""

    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.)

    Code:
    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:

    Code:
    [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 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?

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

    Code:
    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'.