Search This thread

sjevtic

Senior Member
Dec 8, 2007
70
25
Chicago, IL
I should've clarified. Fbind does this, but only for bind-mounts. Here's how your setup would look like:

1. Mount the EXT4 partition the usual way:


2. Overlay the mount point with a bind-mount (works like sdcardfs, but better):
How does a bind mount achieve the emulation of having no filesystem permissions? I must be missing something here.
 
  • Like
Reactions: RootedLee
Jul 25, 2016
41
27
Samsung Galaxy A30
@VR25 I installed this module today and it's working great so far on android 11.

I am not sure how to use cryptsetup. I want something like "target Pictures" BUT with encryption like EncFS or rclone-crypt. So that, if put a file in $intsd/Pictures, the file will be encrypted $extsd/Pictures.

With Rclone Remount & ExSDCard Write Access Enabler magisk modules, I could somewhat achieve this on previous android versions.

Can I do this with fbind module? if so, what line do i write in config,txt.
 

K0rgar

Senior Member
Aug 27, 2013
52
25
@VR25 Can you please check if /data/media/0/.fbind does exist or not?
Because if it's there, then it goes into loop, can't mount, I had to reboot, manually delete such folder and finally termux, su, fbind -m
 
Last edited:
  • Like
Reactions: VR25

VR25

Senior Member
Apr 20, 2013
1,978
4,833
github.com
Yes but if bindfs wont work in enforced env. How can we expect fbind to work. Does it work ( after binds integration ) and grant RW access to underlying dir - if so what bindfs ops are used in fbind
Code:
nsenter -t 1 -m bindfs -o nosuid,nodev,noexec,noatime,nonempty -u 0 -g 9997 -p a-rwx,ug+rw,ugo+X --create-with-perms=a-rwx,ug+rw,ugo+X --xattr-none --chown-ignore --chgrp-ignore --chmod-ignore
 
  • Like
Reactions: sieger007

VR25

Senior Member
Apr 20, 2013
1,978
4,833
github.com
@VR25 I installed this module today and it's working great so far on android 11.

I am not sure how to use cryptsetup. I want something like "target Pictures" BUT with encryption like EncFS or rclone-crypt. So that, if put a file in $intsd/Pictures, the file will be encrypted $extsd/Pictures.

With Rclone Remount & ExSDCard Write Access Enabler magisk modules, I could somewhat achieve this on previous android versions.

Can I do this with fbind module? if so, what line do i write in config,txt.
Cryptsetup is used by fbind for disk encryption.
You need an encrypted partition. Once mounted, the syntax for folders is the same.

Code:
part [-o <mount option...>] <[block device[--L[,password]]]> <mount point> ["fsck <option...>"]` Auto-mount a partition.
# The `--L` flag is for LUKS/2 volume, opened manually by running any `fbind` command.
# The filesystem is automatically detected.
# The defaut mount options are `rw` and `noatime`.
# `e2fsck -fy` is always used for supported filesystems.
 
  • Like
Reactions: Shihabus Sakib Rad

mashiro2296

Member
Dec 22, 2016
7
0
Manila
Hello! I Installed this module & it works fine on my J7 (2016) Device running on crDroid 10.
I've use the fbind wizard. done some non-media files (data folders) and it works but once I reboot my device bind doesn't work. I need to go to terminal and once I enter command 'fbind -um' the targeted folder binds again.

tried to add 'permissive' in the config and 'fbind -f' in terminal but same scenario occurs. once I reboot my device the targeted folder not binding.

Hope you may help me. Thanks in advance.
 

P650SE

Senior Member
Aug 14, 2013
666
187
Hi everyone,

I wondered if anyone can help a total beginner? Just recently I purchased a 256GB microSD card for my phone, I would like a way to create an encrypted volume on the SD card that can be mounted onto the device's filesystem so that the files can be freely accessed from within any file manager or gallery app.

As I understand it, I should be able to achieve what I am looking for with this module, but I don't have any knowledge of using terminal so this whole thing is overwhelming to me, I'm rooted with Magisk 25.1 on Android 11, I have the Fbind module installed and Termux from F-Droid. I downloaded the provided cryptsetup binaries and extracted them to /data/adb/vr25/bin/cryptsetup/ with permissions 755 but when I run the command fbind -C it says cryptsetup: can't execute: Is a directory

I can't tell what I'm doing wrong, I wondered if someone with better knowledge could guide me in the right direction, or offer some simplified step-by-step instructions on how to set this up?

Would really appreciate any assistance.

Thanks (and sorry!)
 
Last edited:
  • Like
Reactions: Shihabus Sakib Rad
Jul 25, 2016
41
27
Samsung Galaxy A30
You need an encrypted partition. Once mounted, the syntax for folders is the same.
Newb here. Could you explain in non-technical terms if it is possible to achieve what I want to do.
I want a folder, say, $extsd/Diary to be accessible on $intsd/Diary but with encryption. If I put a file firstday.txt on $intsd/Diary, A encrypted file would appear in $extsd/Diary.
Basically, it is similar to how cryptomator, EncFS or rclone-crypt work where encrypted file would be stored on Ext-SD but mounted on Int-SD. This way, I could set this $intsd/Diary path from any App as a Backup folder or Data storage location.

For this use case, could you write me the config file I need for "Diary" folder.
 
  • Like
Reactions: P650SE
Nov 2, 2018
20
5
I've been using fbind for long now.
Since Android 6.
Now in my new Android 11( Redmi note 11) it seems fbind is working fine, but after some time, the WhatsApp folder bind just unlinks without any warning. And idea or suggestions about that?
 

the gladiator

Senior Member
Dec 16, 2010
293
35
Using fbind from @VR25 since years with many ROMs and phones, it's more tricky meanwhile to setup the module, but of course not impossible, that's why i thougt i share my experiences with the latest release ( 071221 ) and my new toy ( Xperia XZ2 LOS 18.1, Magisk v23 ) .

I had some trouble to find the path of my intsd, without specify the internal SD in config.txt my binds were mounted, but without write rights, Chrome downloads and the DCIM folder were not accessable.

I installed Kuder Disk Info from APK Mirror, it's not in Play Store anymore, a very helpfull tool to look WHAT is WHERE mounted. Found my intsd under

/mnt/pass_through/0/emulated/0

so i was able to complete my config.txt

So, the first line in your config.txt should be WHERE the intsd is, second line WHERE the extsd is. Sometimes you simple have to try and error, it's all not magic.

Finally, maybe it's usefull for some people, my config.txt, with the device above.

intsd_path /mnt/pass_through/0/emulated/0
extsd_path /storage/xxxx-xxxx
target Android/data
from_to DCIM .fbind/DCIM
from_to Download .fbind/Download
obb


With this config the whole Android/data and Obb folder is on the extsd, DCIM and Download are on extsd too, accessable from the Cam and from Chrome. Media in linked DCIM are visible in gallery, and can be deleted via gallery. All fine.

So - specify the intsd and extsd - that's all.
As 0LDST4R, I'm using fbind since years over many smartphones and I consider it crucial in my digital life (it goes without saying that VR25 is my unparalleled guru). I wanted to install fbind on my daughter's smartphone with Android 9, Magisk 22.1 and fbind v2021.12.7.

It was ok BUT the sd card was disregarded; that means that it binded folders on internal memory. Useless! The trick was to add the "path" in the config file as 0LDST4R was suggesting, as simple as that (once you know) !!!
 
  • Like
Reactions: RootedLee

MarkLev

Senior Member
Dec 24, 2019
103
84
@VR25 , also to anyone if you have some answers:
What are the differences between media and non-media in term of fbind's behavior?
Why is there a need to distinguish them?

I am new to fbind, so...
 

MarkLev

Senior Member
Dec 24, 2019
103
84
Ok, here is what I found after playing around with fbind:

** fbind wizard's behavior:
In fbind wizard, there are 3 kinds of binding: Media, Non-media and OBB
There is no difference between Media, Non-media and OBB except the way wizard generates config.txt

Example: When choosing Media, the next prompting will generate the below line in config.txt for user's input "myDir":
from_to "myDir" ".fbind/myDir"
When choosing Non-media, the next prompting will generate the below line in config.txt for user's input "myDir":
target "myDir"
It is equivalent to:
from_to "myDir" "myDir"
When choosing OBB, the next prompting will generate the below line in config.txt for user's input "myDir"
obbf "myDir"
It is equivalent to:
from_to "Android/obb/myDir" "Android/obb/myDir"

** Here is the fbind wizard's behavior in comparison with fbind -m (fbind mount command)
With config from_to "myDir" "myDir":
If there's existing "myDir" in ExternalSD, that "myDir" is renamed to "myDir.old", and then fbind will move intSD-"myDir" to extSD, and mount extSD-"myDir" to intSD-"myDir"

fbind -m (fbind mount command):
With config from_to "myDir" "myDir"
If there's existing "myDir" in InternalSD, that "myDir" is ignored, and then fbind will mount extSD-"myDir" to intSD-"myDir"
 

AnonVendetta

Senior Member
Apr 29, 2016
1,392
515
Ok, here is what I found after playing around with fbind:

** fbind wizard's behavior:
In fbind wizard, there are 3 kinds of binding: Media, Non-media and OBB
There is no difference between Media, Non-media and OBB except the way wizard generates config.txt

Example: When choosing Media, the next prompting will generate the below line in config.txt for user's input "myDir":
from_to "myDir" ".fbind/myDir"
When choosing Non-media, the next prompting will generate the below line in config.txt for user's input "myDir":
target "myDir"
It is equivalent to:
from_to "myDir" "myDir"
When choosing OBB, the next prompting will generate the below line in config.txt for user's input "myDir"
obbf "myDir"
It is equivalent to:
from_to "Android/obb/myDir" "Android/obb/myDir"

** Here is the fbind wizard's behavior in comparison with fbind -m (fbind mount command)
With config from_to "myDir" "myDir":
If there's existing "myDir" in ExternalSD, that "myDir" is renamed to "myDir.old", and then fbind will move intSD-"myDir" to extSD, and mount extSD-"myDir" to intSD-"myDir"

fbind -m (fbind mount command):
With config from_to "myDir" "myDir"
If there's existing "myDir" in InternalSD, that "myDir" is ignored, and then fbind will mount extSD-"myDir" to intSD-"myDir"
Thx for the info. I've always wondered what the difference is between the 3. Apparently, there are none, except how the configuration file gets written.
 
  • Like
Reactions: MarkLev

kreatifchk

New member
Mar 11, 2022
2
0
What to do if fbind -u doesn't work? I did the binding through the terminal with the fbind -b command. Only reboot helps.
 

Teddan Fred

Member
Nov 6, 2016
8
1
Noob question here.
In termux when I run fbind (wizard) and press "a" to see all commands.
When I come to END I can no longer execute any new command.
What can I do exit this command list?
Thanks!

edit. Found it! press "q" :LOL:
 
Last edited:
  • Like
Reactions: RootedLee

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Noob question here.
    In termux when I run fbind (wizard) and press "a" to see all commands.
    When I come to END I can no longer execute any new command.
    What can I do exit this command list?
    Thanks!

    edit. Found it! press "q" :LOL:
  • 41
    ### No, I'm Not Dead! ###

    I know, I know... it's been quite a while. Well, yeah, maybe longer than that...

    Not gonna write a book on this. Lets just say it's HARD to access the internet on a regular basis from my current location. Plus, I've been busy with general life matters.
    That said, my online presence will still remain limited for a while. It won't be that much limited anymore, though. So... yay!



    ### Latest Changes ###

    F2FS Loopback Bug Workaround
    Magic GApps
    Magisk Manager for Recovery Mode
    Moto Z Play Dual SIM Mode Enabler
    Sysconfig Patcher
    Systemless Camera NX Mod
    - Fixed modPath detection & bad PATH variable issues (Magisk V16.6).
    - Updated documentation

    Magic Charging Switch (mcs)
    - Enhanced debugging function.
    - Fixed "automation config still calling `cs` instead of `mcs`."
    - Fixed modPath detection & bad PATH variable issues (Magisk V16.6).
    - Updated charging switches database (more devices supported)
    - Reliability improvements
    - Updated documentation

    Magic Folder Binder (fbind)
    - Ability to unmount loop devices and partitions on demand (i.e., fbind -u 'pattern1|pattern2|pattern...').
    - Better loop device mounting logic ("ugly bugs" fixed)
    - Bind-mount folders automatically regardless of --L (LUKS) flag's usage.
    - Dedicated logs dir -- /data/media/fbind/logs (easier & advanced debugging)
    - Deprecated `fbind -l` in favor of `fbind -i` (outputs much more information)
    - Fixed "misleading [N/A] mount status".
    - Fixed modPath detection & bad PATH variable issues (Magisk V16.6).
    - Fixed "rm -rf not affecting hidden files/folders" in data moving functions.
    - Ignore `app_data` line whose target apk is missing (to avoid app data loss).
    - Option to mount app_data in ext4 .img file (loop device)
    - Shipping with a comprehensive, noob-friendly tutorial (tutorial.txt, /data/media/fbind/info/tutorial.txt)
    - Reliability improvements (better data loss protection algorithms)
    - Updated documentation
    - Using `rsync -a` for advanced copy operations, instead of `cp -a`.



    ### Last, but Far from Least ###

    Will update each project's thread and repository & answer queries at my earliest (uh... maybe a little late) convenience.
    Meanwhile, everything you need is in the attached zip. Yes, all modules are there, along with a md5sum.

    P.S., To everyone who donated and/or contributed in other ways,
    -- Thank you very much!
    19
    Is this project discontinued? Last update almost a year ago.

    Ok, I downloaded latest version (2019.1.23) and installed it on my Lineage OS 17.1 (Android 10) with Magisk v20.2, and... spent two days for manage it to work... Meh, it'd be better to not even start.

    Fist of, it simply hasn't been installed properly on my system (no binaries, no scripts, only info/config examples), so I downloaded latest update-binary, saved it as is (without modifications), and manually converted config.sh to install.sh (using aka "legacy script" logic) (fix1-fix2) customize.sh (fix3).

    Secondly, fstype binary doesn't detect FAT (vfat/exfat/sdfat) on my system, so I added extra check to part() function in core.sh: in case if fstype has not detected FS, let mount detect it automatically (omit -t).

    Next, grep /storage/emulated /proc/mounts | grep -Eiq ' sdcardfs | fuse ' || exit 1 line in wait_until_true() function instanly exit script on boot, I guess it's because it starts too early on my system. So I replaced "exit" with waiting loop.

    After all this modifications and countless hours of tries and errors I finally got what I wanted - move (bind) some internal folders to encrypted second partiton of my external SD card.

    /data/adb/fbind/config.txt:
    Code:
    part -o umask=0 /dev/block/mmcblk1p2--L,MyLoNgPaSsWoRd /mnt/sdcrypt
    extsd_path /mnt/sdcrypt
    target DCIM
    target Audio
    target TitaniumBackup

    I found using umask=0 on FAT is a most painless way to deal with apps permissions to use binded folders. Less secure though. I logically understand that fbind should take care of access to binded folders, but it looks like something changed lately in Android's storage "magic", which is not clear to me, so... umask=0. Tried other mountpoints like /mnt/media_rw/sdcrypt or /storage/sdcrypt, tried ext4 instead of exfat, but all that caused even more problems with permissions. I'd appreciate any advice about better mountpoint and options to use.
    Got an infinite bootloop when I used to use FUSE (which is happen automatically when I add something like "intsd_path /storage/emulated/0" in config.txt), thanks god we have TWRP.

    I attached modified zip-file in case if anyone interested (not sure If I had right to do this tho, I will remove it if OP or moderators ask), magisk-only.
    DISCLAIMER: I'm very new to module coding and coding in general, I'm just an experienced Linux user, so I can't guarantee that my modifications are 100% correct and universal, test it on your own risk.

    UPD: new "fix2" version with some fixes.
    UPD2: new "fix3" version: magisk 20.4 support and others changes.
    UPD3: new "fix4" version: small bugfixes and simplified code (info).
    17
    13
    Hi guys, I made new "fix3" version if anyone interested:
    - magisk 20.4 support (magisk 20.0+ is requied starting from this version)
    And some fixes for those who using partitions and/or images:
    - loop and part now support both EXT2/3/4 and FAT/exFAT file systems, and loop accepts mount options (loop -o ...) like part does
    - better detection file system of partitions and loop images (using blkid if fstype fails)
    - fixed problems with permissions when mounting (ex)FAT and EXTfs partitions/images (using better mount options, sdcardfs and more of android storage "views" black magic)
    You can part/loop directly to target folder (part /dev/block/mmcblk1p2 $intsd/Viber) or mount it aside (part /dev/block/mmcblk1p2 /mnt/flash), declare as $extsd (exstsd_path=/mnt/flash) and then bind/target folders (target Viber, from_to Viber .Viber, etc)

    Tested with Carbon 8.0 (Android 10, AOSP-based) on my ancient Xperia Z3 Compact
    zip-file attached to my original post

    JUST FOR INFO (UPDATED after "fix4" released in my next post below):
    Hardcoded mount options for initial mounting of partitions and loop images:
    for all FS: nosuid,nodev,noexec,context=u:eek:bject_r:sdcardfs:s0
    + for (ex)FAT: uid=0,gid=1023gid=9997,umask=0007
    + for EXT2/3/4: changing owner:group of root directory to 0:1023 0:9997 and perms to rwxrwxr-x - you should know this if you use mounted EXTfs-devices somewere else. This will allow you to create and delete newly created or empty folders in the root of mounted EXFfs storage, but for existed folders you need to do chown -R 0:9997 <mountpoint> and chmod -R 775 <mountpoint> by hand at least once.
    These changes should help with access to mounted storages in recent androids.
    And additional options when binding devices and folders: gid=9997,mask=6
    Also, here is another interesting tool for binding folders: https://bindfs.org (but see "known issues" at bottom). May be I'll try switch to it if encounter problems with permissions in next android updates. If I don't buy new phone with 128+ gigs of internal memory soon :)