yashsingh1/xdaforums huggingface dataset:
[Magisk] chrissss91:
Hi,

[MENTION=5228676]VR25[/MENTION] : Do you have any idea of what's going wrong with my config https://xdaforums.com/showpost.php?p=74049416&postcount=641 ?
[Magisk] VR25:
[MENTION=4420962]chrissss91[/MENTION], I'm not sure what's wrong this time. Will focus even more on that issue.
[Magisk] chrissss91:
Can I lauch some command or provide file/log to help you ?

Feel free to ask (with some details as I'm not really an expert :p)
[Magisk] akubaek:
I try to wanna swap only for certain obb. I try to put obb in config. But the whole obb in internal cannot read
[Magisk] VR25:
Try the attached zip.

obbf GAME_FOLDER_NAME is the config line you need then.
[Magisk] chrissss91:
Hey, it seems it worked :good:

Terminal said that it moved and binded the app.

App works.

I'm going to try with a big app (Hearthstone) and compare the size of a TWRP data backup before and after bind.

If I want to move another app, do I have to remove the lines in config.txt of apps already moved from previous "fbind -mb" command ?
[Magisk] chrissss91:
[MENTION=5228676]VR25[/MENTION],

I've done a lot of tests with your debug version and :

- data are not moved.

- .app_data/com.app.xxxx are created but empty

- Folder are binded.

- Apps are "reseted" as they have no data.

- If I uninstall your script via cmd 'fbind uninstall' and reboot, apps work again.

- I can see 'old data' in their 'original path' with TWRP file manager

Is there a way to totally remove your script ? I've done 7-8 uninstall/install today and some files stay in /data/_fbind (and maybe somewhere else) after uninstall ? I would like to restart with a "clean" install.

If data where moved I feel everything would be OK.
[Magisk] anthortic:
Hello, reading the config syntax I not sure I can achieve my aim...

is it possible to bind just one single file?

I would like to bind

/system/etc/libnfc-brcm.conf

to

/storage/emulated/0/Android/data/com.yuanwofei.cardemulator/files/libnfc-brcm.conf

Binding /system/etc/ would not be appropriate for this use case.

Any advice would be very welcome!

Cheers
[Magisk] Captain_Throwback:
[MENTION=5228676]VR25[/MENTION]

Just flashed the latest version on my M8 and it's not mounting any folders on any of my ROMs (I'm running several secondary ROMs in a MultiROM setup).

Attaching the debug log from my primary ROM - maybe you can figure out what's wrong?
[Magisk] VR25:
Went through the code -- couldn't find anything relevant. Still trying to figure out what's behind this. Your SD Card info is not shown, and I wonder what that "temp_exfat" is doing there...

What if you specified "intsd_path PATH" & "extsd_path PATH" in your config?
[Magisk] Captain_Throwback:
Manually specifying extsd_path does the trick. Thanks! I'm glad you made this tool so flexible. It really is a great module.
[Magisk] Captain_Throwback:
[MENTION=5228676]VR25[/MENTION]

Quick update - while specifying the extsd_path got it working on my Marshmallow and Nougat ROMs, it's still not working on Oreo. Google seems to have changed how the SD card is mounted a bit. Here's the output from the commands you had me list before:

htc_m8:/ $ su
htc_m8:/ # source /magisk/fbind/core.sh
htc_m8:/ # echo "[$intsd] [$extsd]"
[/data/media/0] []
htc_m8:/ #

SD Card not detected just like previously. And ls /mnt/media_rw outputs this:

htc_m8:/ # ls /mnt/media_rw
30324143-2d44-3832-3000-d7be175b6baa 57f8f4bc-abf4-655f-bf67-946fc0f9f25b
htc_m8:/ #

The first one is definitely the SD Card that we're looking for - the second one is an ext4 partition on my SD card which isn't being used. However fbind doesn't seem to be detecting anything.

In config.txt I have this:

extsd_path /mnt/media_rw/30324143-2d44-3832-3000-d7be175b6baa

followed by some folders I'm trying to bind mount. I'm guessing there's an incompatibility with Oreo.
[Magisk] VR25:
[MENTION=1162986]Captain_Throwback[/MENTION], fbind is stuck on the loop until mountpoint /mnt/media_rw/30324143-2d44-3832-3000-d7be175b6baa; do sleep 1; done

That shouldn't happen, though -- given that the specified path exists and is in fact a mount point.

I've tested the module on Oreo (LOS 15) -- no issues.

Anyway, let's see if we can solve the puzzle...

1. Double check whether extsd_path is correct

ls /mnt/media_rw | grep '30324143-2d44-3832-3000-d7be175b6baa'

2. Check whether it's a mount point

mountpoint /mnt/media_rw/30324143-2d44-3832-3000-d7be175b6baa

3. Check whether fbind works manually

fbind -b

4. Let fbind mount the target partition instead (you may get "SD card is corrupt" Android notification -- ignore it)

CONFIG LINE: altpart /dev/block/mmcblk1) /data/.extsd

Your partition name might be either that one or mmcblk1p1
[Magisk] Captain_Throwback:
Well this is odd - it seems the path is changing on every reboot. Now it's something different.

htc_m8:/ # ls /mnt/media_rw | grep '30324143-2d44-3832-3000-d7be175b6baa'
1|htc_m8:/ # mountpoint /mnt/media_rw/30324143-2d44-3832-3000-d7be175b6baa
mountpoint: /mnt/media_rw/30324143-2d44-3832-3000-d7be175b6baa: No such file or directory
1|htc_m8:/ # ls /mnt/media_rw
30324143-2d44-3832-3000-80be171b39b5 57f8f4bc-abf4-655f-bf67-946fc0f9f25b
htc_m8:/ #

So I'll try the altpart and see if that works. I already get the corrupted partition notification because Android doesn't know how to read my ext partition.

EDIT: The altpart is only for mounting the ext partition, isn't it? That doesn't help me with the bind mounting issue, does it? It's good to know though, that I can mount it somewhere.

EDIT 2: [MENTION=5228676]VR25[/MENTION] Attached debug log from mounting the ext partition using altpart, which according to the log doesn't seem to be working, but it's there in Root Explorer, so I'm not sure why it's reporting errors. I still have no idea how to identify the portable storage SD card reliably for bind mounting.

EDIT 3: Nevermind, I know why it's throwing those errors, and it's not an issue. The issue is - how do we get fbind to detect my SD Card properly? It seems on every reboot, the 5th section of the folder numder of the SD card changes. The rest stay the same. If wildcards would work, then that would allow me to specify part of the path, and it should pick up the correct path.

EDIT 4: When I check "mount", this is what I see for the SD card mountpoint:

/dev/block/vold/public:179_129 on /mnt/media_rw/30324143-2d44-3832-3000-9abe176b0fb6 type fuseblk (rw,dirsync,nosuid,nodev,noexec,noatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
[Magisk] DessertArbiter:
I get a bunch of errors

mkdir: can't create directory '/mnt/media_rw/903C-ED7D': File exists
mkdir: can't create directory '903C-ED7D?sdcard1': Read-only file system
mkdir: can't create directory 'sdcard1/.fbind_bkp': No such file or directory
cp: can't create 'sdcard1/.fbind_bkp/config.txt/config.txt': No such file or directory
cp: omitting directory '/mnt/media_rw/903C-ED7D'
cp: can't stat '903C-ED7D?sdcard1': No such file or directory
chmod: 903C-ED7D?sdcard1: No such file or directory
chmod: sdcard1/.fbind_bkp/config.txt: No such file or directory
Moving data...
- Done.

mkdir: can't create directory '/mnt/media_rw/903C-ED7D': File exists
mkdir: can't create directory '903C-ED7D?sdcard1': Read-only file system
mkdir: can't create directory 'sdcard1/.fbind_bkp': No such file or directory
cp: can't create 'sdcard1/.fbind_bkp/config.txt/config.txt': No such file or directory
cp: omitting directory '/mnt/media_rw/903C-ED7D'
cp: can't stat '903C-ED7D?sdcard1': No such file or directory
chmod: 903C-ED7D?sdcard1: No such file or directory
chmod: sdcard1/.fbind_bkp/config.txt: No such file or directory
Binding folders...

- Done.

Edit: I solved it by manually specifying extsd_path
[Magisk] akubaek:
I should write obbf com.rockstargames.bully or

obbf

Android/obb/com.rockstargames.bully .. please guide me.. i'm super noob
[Magisk] VR25:
[MENTION=1162986]Captain_Throwback[/MENTION]

Well, fbind mounts the partition and uses it as extsd. So, it's part of the binding process.

My bad, we forgot the third parameter, which is filesystem. So, the syntax for altpart is altpart [/path/to/partition] [/path/to/mount/point] [partition_filesystem] ["fsck -OPTION(s)" (fs dependent, optional)]. Next fbind version will auto-detect the fs.

Yeah... wildcards don't work only because of variable quoting -- to support paths containing spaces. You can use command substitution to get over that limitation, though! Here's how I would do it: extsd_path /mnt/media_rw/$(ls /mnt/media_rw | grep 'Section1')"

obbf com.rockstargames.bully
[Magisk] Captain_Throwback:
Progress!

Using the grep allowed the proper detection of the SD card - but now I'm still not seeing anything bind mounted. I had to comment out the altpart command to get the "from_to" commands to process (because of the errors altpart was throwing, even though it was mounting the partition just fine), but even after doing that, the bind mounted folders appear empty in my internal storage.

Any ideas as to why? Most recent debug.log is attached. Is using altpart not supported for a secondary SD card partition? Or is there another way I need to mount that if I'm using portable storage as well? Obviously, getting the bind mounts to work is more important :).
[Magisk] VR25:
Hm... have you tried specifying the filesystem?

# Example -- my former config
part /dev/block/mmcblk1 /data/.extsd f2fs

By the way, it's now "part" as opposed to "altpart" (auto-renamed upon update).

Anyway, that should work. Else if, try switching "Mount Namespace Mode" to "Global" in Magisk Manager settings and/or use "intsd_path /storage/emulated/0" & "intobb_path /storage/emulated/obb". Else, I'll pray for you! ;)
[Magisk] Captain_Throwback:
The problem is that the partition is already mounted elsewhere, so it throws an error, which prevents the rest of the script from running, even though it mounts it fine (yes I saw the missing parameter, and added it myself manually).

It seems like you're only addressing one of my issues though - not the bind mounting to my SD card portable storage partition issue? Any idea on the fix for that?

P.S. [MENTION=5228676]VR25[/MENTION] Maybe I'm not explaining everything that's going on and that's confusing you. So, let me start from the beginning:

First off, I'm using MultiROM, and I'm running the Oreo ROM (LineageOS 15.0) on my HTC One (M8) from an ext4 partition on my SD Card. The ROM itself, as well as Magisk work fine, outside of the "Corrupted SD Card" message Android throws because it doesn't know how to mount/handle the ext4 partition on my SD Card.

Installed fbind module, currently running 10/10/2017-2 version

Added "extsd_path /mnt/media_rw/$(ls /mnt/media_rw | grep '30324143-2d44-3832-3000')" to my config.txt, which got my portable storage mounted, and the bind mounts get processed, but don't work.

Added "altpart /dev/block/mmcblk1p2 /data/.extsd ext4" to my config.txt at your suggestion to get my ext4 partition mounted, which is unrelated to my portable storage (which is formatted exfat and mounted by fuse in the ROM)

My plan is to change the syntax to "part" as you mentioned, but I'm not sure how that helps me with the broken bind mounts. Does this make the issue any clearer?

EDIT: [MENTION=5228676]VR25[/MENTION] I tried the part command, and the results are the same as when I used altpart - the script throws errors because the block device is already mounted, and then it never processes the bind mounts. I tried adjusting the intsd_path to /storage/emulated/0, but that just causes my device to get stuck at the end of the boot animation and reboot. It seems there is no solution to get this working on Oreo for me, currently. Attaching a screenshot of the successful mount of my ext4 partition to /data/.extsd (despite the errors in the log), my log and my config.txt, where the bind mounts aren't getting processed. If I comment out the "part" line, I'll get the output that indicates the bind mounts are completed, but the folders appear empty in my storage.
[Magisk] VR25:
The latest build is 12/10/2017 and it auto-renames "altpart" to "part." Also, it includes some optimizations to that function.

Now, as to why I suggested altpart...

First off, it can mount a partition with any filesystem, as long as your device/kernel supports it.

By using that function, you essentially/potentially avoid major FUSE's issues/limitations, since fbind overrides your system's SD card mounting mechanism. So, the idea was to mount your primary partition (the one where your actually want bind-mounts to work on). I'm really trying to solve the bind-mounts issue, not anything else.

A couple of other things I'm aware of, besides "extsd not detected" that would cause such an or similar issue are:

* sdcardfs enabled -- not the case here

* intsd path /data/media/* -- some devices (i.e., certain Samsung models) have that problem -- solved by the line "intsd_path /storage/emulated/0"

* Mount Namespace Mode -- another possibility

* The classic storage permissions issue -- the darkest one so far

EDIT: [MENTION=1162986]Captain_Throwback[/MENTION], I see...

The mystery just got funnier.
[Magisk] koko115:
After update i have twice bind folder like Download Downloadroid, Android Androiddroid etc....
[Magisk] koko115:
How fix twice folder ? When i delate this bug folder after reboot still is. http://cloud.tapatalk.com/s/59e073ca6ad9d/debug.log.zip
[Magisk] VR25:
The only data left behind is the folder /data/_fbind (with its contents). So, your config remains intact across uninstalls/re-installs. That's the reasoning behind leaving /data/_fbind alone. As per data not being moved -- I'm yet to identify what exactly that issue is being caused by. The feature works fine for me.

Well, as per my tests on Android, "mount -o bind" doesn't work with files -- only directories.

You could try the following (symlink) alternative:

su
ln -s /system/etc/libnfc-brcm.conf /data/media/0/Android/data/com.yuanwofei.cardemulator/files/libnfc-brcm.conf

[MENTION=4715235]koko115[/MENTION], are you sure you didn't make any other changes to your system besides updating fbind? The module doesn't seem to be the root cause of the issue.
[Magisk] lcsboy:
[MENTION=5228676]VR25[/MENTION] Does it support ExtFAT ?
[Magisk] VR25:
Did you mean exFAT?

fbind is filesystem independent.
[Magisk] anthortic:
Thank you I appreciate your time in replying.

I understand this is off topic for the function of the module but could you clarify whether a symlink to /system/etc/libnfc-brcm.conf would itself be a modification of the /system directory?

Many thanks
[Magisk] mcurotto:
Hello

I was using this module without any issues until v2017.9.18.1

Something changed on the code, as none of the versions after that worked anymore.

Below is the log. Any idea what the issue is?

Thank you!

<Config Update>

- Done.

<SD Card Information>

mkdir: can't create directory '/mnt/media_rw/F89D-B411': File exists

mkdir: can't create directory 'sdcard1': Read-only file system

cp: can't create 'usbdrive/.fbind_bkp/config.txt/config.txt': No such file or directory

cp: omitting directory '/mnt/media_rw/F89D-B411'

cp: can't stat 'sdcard1': No such file or directory

chmod: sdcard1: No such file or directory

chmod: usbdrive/.fbind_bkp/config.txt: No such file or directory

<Bind Folders>

[intsd/Media] <--> [extsd/.fbind/Media]

[intsd/Transmission] <--> [extsd/.fbind/Transmission]

- Done.

<Cleanup>

- Done.

****** EDIT *******

Manually setting extsd_path solved it! Still wonder what changed to cause this.

Awesome module by the way!
[Magisk] VR25:
Let me ask you this first:

- Which one is the file you're linking from?

-- If the source is in /system, then you're good. Else, the described workaround implies system modification.

--- I can build a standalone module to achieve that systemlessly, though. It'll automatically detect updates to the source file on boot, copy it to magisk directory, and replace the target in /system. Just let me know whether this is what you really need.

[MENTION=1674232]mcurotto[/MENTION], I see errors below "EDIT". Did you get the issue solved already?
[Magisk] mcurotto:
Yes, the issue was solved by manually setting extcard path.

My "EDIT" was bad placed :o
[Magisk] pat357:
Maybe this can be solved by calling "su" with the extra switches "-mm" or "-M" ? (see "su --help" for all options).

When you issue "su -mm", it will launch in "global name space mode", independent from the setting in Magic Manager.

This switch was created especially for mounting, etc .. where a "global name-space" is desired.

That way the user doesn't have to fiddle no longer with the name-space settings in MM.
[Magisk] BzYczekMaruSha:
Is it possible for this program to cause game loading longer? Even if the game have no fbinded folders?

I notticed that my game (Sword of Chaos) with fbind turned on in Magisk is loading 3-5 seconds longer between stages. When I disable fbind in Magisk game is loading faster.

My phone is Sony Z3 and Linegae OS 14.
[Magisk] DroidIt!:
Some of that might depend on the speed of your SD card. Like I know the one that shipped with my Sammy tablet was quite a ways below the speed capability of my SanDisk. The faster the better, but I always look for one's with a good UHS-1 speed, about 90 Mb/s.

Edit: UHS-1 is the classification recommended for recording in 4k or in Flac for audio. They ARE a little more pricey, but you can find them on Amazon by typing in "UHS-1 SD card".
[Magisk] BzYczekMaruSha:
I understand that lower read speed of SDCard can do that but i didnt fbinded folder of that game so it is still in internal memory.
[Magisk] nl3142:
When using "bind_mnt $extsd/.fbind $intsd -mv" does that mean everything in your internal storage gets moved to [external storage]/.fbind or that everything in your .fbind folder gets moved to internal storage? Because I want to fully replace intsd with extsd but still have my internal storage accessible by going to #extsd/.0-IntStorage. So do I leave off the -mv like this

part /dev/block/vold/public:179_65 $intsd f2fs
bind_mnt $extsd/.0-IntStorage $intsd
obb
[Magisk] VR25:
["bind_mnt $extsd/.fbind $intsd -mv" allows data from intsd to be moved to extsd/.fbind. However, if you want to replace the internal storage with extsd/.fbind, there's a specific function just for that and it affects obb, intsd/Android and intsd/data folders too. You can still access the internal storage from its standard location, but you'll always see files/folders from extsd/.fbind there, instead of the original data. You cannot have access to both intsd original data and extsd/.fbind data while these directories are bound. Also, why is the line "part" there? The only line you need for this setup is "int_extf".

I don't know what your actual setup is, but generally -- if no target game's related data is bound to an extsd directory, then that shouldn't happen. Are you sure you don't have the whole Android or obb directory bound to a folder in extsd?
[Magisk] nl3142:
Nevermind, turns out I never had it working properly in the first place. Apparently it not only needed the extsd path specified but it didn't like notpad/wordpad. I had to use pspad to get it to work.

What I was wanting to do was replace the internal storage with the sd card, but still have the original internal storage accessable via a specific folder (such as 0-internalstorage). In other words, use this

# Fully replace intsd with extsd (similar to the one-line setup above, but more aggressive)
part /dev/block/mmcblk1 $intsd f2fs
obb

but still be able to access the original internal storage by mounting it to a folder.
[Magisk] goose2600:
Hi [MENTION=5228676]VR25[/MENTION],

I put just "from_to WhatsApp .fbind/WhatsApp" in the config.txt file then I tryed to bind WhatsApp folder typing "fbind -mb".

Doing this, all the content of WhatsApp intsd folder was copied to .fbind/WhatsApp folder in extsd.

After binding, the folder WhatsApp in intsd is empity (ls show it is a "cross-device link") and WhatsApp stops working because find no media.

My phone is Huawey P9 lite, Android 7.0 (Emui version is 5.0.1), intsd is /mnt/sdcard (/storage/emulated/0/) and extsd is /mnt/media_rw/xxxx-xxxx/

Can you help me?

Thank you
[Magisk] VR25:
Well, I'm still not sure why you would like to access the original internal storage. If you're replacing it, that would essentially mean it's contents aren't needed or there is no data at all in intsd.

That said, what fbind does to "replace" folders is actually just overlaying them (mount -o bind) -- which means you can access both ends, but you'll see the exact same contents of "destination" in "source". So "source" & "destination" both have the contents of "source", though in reality, such data exists only in "destination". Now, if for whatever reason you still want to access the actual/original contents of "source", then you have to umount everything first (fbind -u). Afterwards, you have to bind-mount again with "fbind -b". You can use any of the two methods provided in config_samples.txt.

[MENTION=3202335]goose2600[/MENTION], that seems to be the "storage permissions" issue which in Marshmallow is solved by the Xposed module "Marshmallow SD Fix". Unfortunately, there's no workaround for Nougat I'm aware of. However, that problem might just as well be caused by something else. Try changing "Mount Namespace Mode" to "Global" in Magisk Manager settings and see whether it helps.
[Magisk] nl3142:
I had the same problem and fixed it by first installing ExSDCard Write Access Enabler v2.1. You can use nextapp sdfix to see if it worked or not (yes, it is for Kitkat and while the fixing part won't work on Nougat the permission testing functionality works just fine, so if it asks for root just deny it)

Note that if you are using ext4/f2fs you will need to manually fix SD permissions in recovery (boot twrp, 'cd /external_sd', 'pwd' (be absolutely sure you are in /external_sd/ before doing the following two commands!) 'chown -R media_rw.media_rw' , 'chmod -R 775 * ' .

Also, at least for me using app_data (tested with app_data com.opera.mini.native.beta) required setting selinux to permissive so you will need selinuxchanger v10 from github as well.

Everything was tested on Resurrection Remix 5.8.5 (Android 7.1.2) on a Sprint Galaxy S5 (kltespr) with Magisk 14.3 .
[Magisk] goose2600:
Changing mount namespace mode does not helps. Anyway, thank you for helping.

Thank you for reply. I installed Marshmallow SD Fix, nextapp sdfix says I have write access to sd, but unfortunately magic folder binder still not works.

After binding command (fbind -mb), the sd card foder become a cross-device link and is not browseable (the forder content is moved to the external sd fbind folder).
[Magisk] nl3142:
You are not on Marshmallow (6.x = Marshmallow, 7.x = Nougat) so Marshmallow SD Fix won't work. Install both Magisk SELinux Permissive Script and ExSDCard_Write_Access_Enabler_Nougat_v2.1 with SELinux. Note that version 2.1 of the ExSDCard Write Access Enabler has several bugfixes and will often work even if previous versions didn't. Also be sure you have the Magisk 14.3 beta.
[Magisk] goose2600:
Thank you again for helping!

I installed the two modules you sayd, then rebooted my phone and now I am trying to bind a folder again.

Of course Magisk version is 14.3, and selinux is in permissive mode (# getenforce > permissive), anyway looks like fbind still not working.

After binding via "fbind -mb" is it supposed to see the same content in both source and destination folders, right?

Here I see source the folder is empty and all the files are just in the destination folder.

When I type "fbind -u", fbind log says "Unmounting folders... Done", while the files remains only in the extsd folder (is it supposed "fbind -u" copy back the files in the original source folder?).

Am I missing something?
[Magisk] pat357:
No, "fbind -u" should just unbind the folders and show you the real locations where the files are.

No copy back / moving is done by this command.

About the same as all Nougat users that use this module, I guess ..:confused:
[Magisk] bnwg:
Try reboot after fbind -mb.

For me content shows up in both location after reboot.