mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-04 22:00:15 -05:00
Spawn "mount" on branches when waiting for mounts enabled
This commit is contained in:
parent
23824eaeb4
commit
1b167d34d8
10 changed files with 2235 additions and 48 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# branches-mount-timeout
|
||||
|
||||
Default: `0`
|
||||
* type: `UINT` (seconds)
|
||||
* default: `0`
|
||||
|
||||
mergerfs is compatible with any path, whether it be a mount point or a
|
||||
directory on your [root
|
||||
|
|
@ -17,8 +18,10 @@ offers a way to enforce mount dependencies using the
|
|||
option in /etc/fstab, applying this to every branch path is both
|
||||
cumbersome and susceptible to errors.
|
||||
|
||||
`branches-mount-timeout` will cause mergerfs to wait for all branches
|
||||
to become "mounted." The logic to determine "mounted" is as follows.
|
||||
`branches-mount-timeout` will cause mergerfs to first attempt to mount
|
||||
each branch if the branch appears to be on the same filesystem as the
|
||||
`mergerfs` mount point and then wait for all branches to become
|
||||
"mounted." The logic to determine "mounted" is as follows.
|
||||
|
||||
1. It is mounted if the branch directory has the extended attribute
|
||||
`user.mergerfs.branch`
|
||||
|
|
@ -28,13 +31,25 @@ to become "mounted." The logic to determine "mounted" is as follows.
|
|||
attribute `user.mergerfs.branch_mounts_here`
|
||||
4. It is **not** mounted if the branch directory contains
|
||||
a file named `.mergerfs.branch_mounts_here`
|
||||
5. It is mounted if the `st_dev` value of the mergerfs mountpoint is
|
||||
5. It is mounted if the `st_dev` value of the mergerfs mount point is
|
||||
different from the branch path.
|
||||
|
||||
These files and xattrs are used to help `mergerfs` know whether or not
|
||||
a directory happens to be a branch or is the underlying directory
|
||||
mount point.
|
||||
|
||||
|
||||
**NOTE:** If on a `systemd` based system and using `fstab` it is a
|
||||
good idea to set the mount option
|
||||
[x-systemd.mount-timeout](https://www.freedesktop.org/software/systemd/man/latest/systemd.mount.html#x-systemd.mount-timeout=)
|
||||
to some value longer than `branches-mount-timeout`.
|
||||
to some value longer than `branches-mount-timeout` otherwise `systemd`
|
||||
might kill `mergerfs` before it finishes waiting.
|
||||
|
||||
**NOTE:** The way `mergerfs` attempts to mount the branch is by
|
||||
calling out to the system command `mount` with the branch as the
|
||||
target. If that path is configured in `/etc/fstab` as a mount point
|
||||
then `mount` should attempt to mount it with the settings defined in
|
||||
`fstab`.
|
||||
|
||||
|
||||
## branches-mount-timeout-fail
|
||||
|
|
@ -66,8 +66,8 @@ A convenient way to configure branches is to use
|
|||
|
||||
## branch setup
|
||||
|
||||
mergerfs does not require any special setup of branch paths in order
|
||||
to be used however here are some suggestions.
|
||||
`mergerfs` does **not** require any special setup of branch paths in
|
||||
order to be used however here are some suggestions.
|
||||
|
||||
|
||||
### layout
|
||||
|
|
@ -132,12 +132,13 @@ $ sudo chattr +i /mnt/hdd/10T-XYZ
|
|||
```
|
||||
|
||||
The extended attribute `user.mergerfs.branch_mounts_here` is used by
|
||||
the [branches-mount-timeout](branches_mount_timeout.md) option to
|
||||
the [branches-mount-timeout](branches-mount-timeout.md) option to
|
||||
recognize whether or not a mergerfs branch path points to the intended
|
||||
filesystem.
|
||||
|
||||
The `chattr` is likely to only work on EXT{2,3,4} filesystems but will
|
||||
restrict even `root` from modifying the directory or its content.
|
||||
restrict even `root` from modifying the directory or its content but
|
||||
is still able to be a mount point.
|
||||
|
||||
|
||||
#### mounted filesystems
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ config file.
|
|||
key=val / ini style format.
|
||||
* **[branches](branches.md)**: Colon delimited list of branches. Used
|
||||
primarily in config file.
|
||||
* **[branches-mount-timeout](branches-mount-timeout.md)=UINT**: Number
|
||||
of seconds to wait at startup for branches to be a mount other than
|
||||
the mountpoint's filesystem. (default: 0)
|
||||
* **[branches-mount-timeout-fail](branches-mount-timeout.md##branches-mount-timeout-fail)=BOOL**:
|
||||
If set to `true` then if `branches-mount-timeout` expires it will
|
||||
exit rather than continuing. (default: false)
|
||||
* **[minfreespace](minfreespace.md)=SIZE**: The minimum available
|
||||
space of a branch necessary to be considered for a create
|
||||
[policy](functions_categories_policies.md). This is a default value
|
||||
|
|
@ -102,9 +108,6 @@ config file.
|
|||
* **nfsopenhack=off|git|all**: A workaround for exporting mergerfs
|
||||
over NFS where there are issues with creating files for write while
|
||||
setting the mode to read-only. (default: off)
|
||||
* **branches-mount-timeout=UINT**: Number of seconds to wait at
|
||||
startup for branches to be a mount other than the mountpoint's
|
||||
filesystem. (default: 0)
|
||||
* **[follow-symlinks](follow-symlinks.md)=never|directory|regular|all**:
|
||||
Turns symlinks into what they point to. (default: never)
|
||||
* **[link-exdev](link-exdev.md)=passthrough|rel-symlink|abs-base-symlink|abs-pool-symlink**:
|
||||
|
|
|
|||
|
|
@ -36,36 +36,27 @@ and [FAQ](configuration_and_policies.md) for policy recommendations.
|
|||
|
||||
## Why do I get an "out of space" / "no space left on device" / ENOSPC error even though there appears to be lots of space available?
|
||||
|
||||
First make sure you've read the sections about [policies, path
|
||||
preservation, branch
|
||||
filtering,](../config/functions_categories_policies.md) and the
|
||||
options [minfreespace](../config/minfreespace.md),
|
||||
[moveonenospc](../config/moveonenospc.md),
|
||||
[statfs](../config/statfs.md), and
|
||||
[statfs_ignore](../config/statfs.md#statfs_ignore).
|
||||
One or multiple of the below are likely causing branches
|
||||
|
||||
mergerfs is simply presenting a union of the content within multiple
|
||||
* [minfreespace](../config/minfreespace.md) could be filtering out
|
||||
branches
|
||||
* if using an `ep*`
|
||||
[policy](../config/functions_categories_policies.md) there may not
|
||||
be an available branch
|
||||
* due to [branch modes](../config/branches.md#branch-mode) being set
|
||||
to to `NC` or `RO` branches will be excluded from consideration
|
||||
* if using `ext4` ensure you are not running into reserve limits (use
|
||||
`tune2fs -m 0` to remove the reserve)
|
||||
* it is possible that the filesystem selected by the policy has run
|
||||
out of inodes (check with `df -i`)
|
||||
|
||||
mergerfs is presenting a union of the content within multiple
|
||||
branches. The reported free space is an aggregate of space available
|
||||
within the pool (behavior modified by `statfs` and
|
||||
`statfs_ignore`). It does not represent a contiguous space. In the
|
||||
same way that read-only filesystems, those with quotas, or reserved
|
||||
space report the full theoretical space available. Not the practical
|
||||
usable space.
|
||||
|
||||
Due to using an `existing path` based policy, setting a [branch's
|
||||
mode](../config/branches.md#branch-mode) to `NC` or `RO`, a
|
||||
filesystems read-only status, and/or `minfreespace` setting it is
|
||||
[perfectly
|
||||
valid](../config/functions_categories_policies.md#filtering) that
|
||||
`ENOSPC` / "out of space" / "no space left on device" be returned when
|
||||
attempting to create a file despite there being actual space available
|
||||
somewhere in the pool. It is doing what was asked of it: filtering
|
||||
possible branches due to those settings. If that is not the behavior
|
||||
you want you need to modify the settings accordingly.
|
||||
|
||||
It is also possible that the filesystem selected has run out of
|
||||
inodes. Use `df -i` to list the total and available inodes per
|
||||
filesystem.
|
||||
within the pool (behavior modified by [statfs](../config/statfs.md)
|
||||
and [statfs_ignore](../config/statfs.md#statfs_ignore)). It does not
|
||||
represent a contiguous space. In the same way that read-only
|
||||
filesystems, those with quotas, or reserved space report the full
|
||||
theoretical space available. Not the practical usable space.
|
||||
|
||||
|
||||
## Why isn't the create policy working?
|
||||
|
|
@ -76,7 +67,7 @@ First, confirm the policy is configured as expected by using the
|
|||
[runtime interface](../runtime_interfaces.md).
|
||||
|
||||
```shell
|
||||
$ getfattr -n user.mergerfs.category.create /mnt/mergerfs/.mergerfs
|
||||
$ sudo getfattr -n user.mergerfs.category.create /mnt/mergerfs/.mergerfs
|
||||
# file: mnt/mergerfs/.mergerfs
|
||||
user.mergerfs.category.create="mfs"
|
||||
```
|
||||
|
|
@ -87,8 +78,8 @@ where it was created.
|
|||
|
||||
|
||||
```shell
|
||||
$ touch /mnt/mergerfs/new-file
|
||||
$ getfattr -n user.mergerfs.allpaths /mnt/mergerfs/new-file
|
||||
$ sudo touch /mnt/mergerfs/new-file
|
||||
$ sudo getfattr -n user.mergerfs.allpaths /mnt/mergerfs/new-file
|
||||
# file: mnt/mergerfs/new-file
|
||||
user.mergerfs.allpaths="/mnt/hdd/drive1/new-file"
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue