Browse Source

try to clarify how path preserving policies work and other tweaks to docs

pull/378/head
Antonio SJ Musumeci 8 years ago
parent
commit
94ebccc6ed
  1. 61
      README.md
  2. 182
      man/mergerfs.1

61
README.md

@ -68,9 +68,9 @@ To have the pool mounted at boot or otherwise accessable from related tools use
# FUNCTIONS / POLICIES / CATEGORIES # FUNCTIONS / POLICIES / CATEGORIES
The POSIX filesystem API has a number of functions. **creat**, **stat**, **chown**, etc. In mergerfs these functions are grouped into 3 categories: **action**, **create**, and **search**. Functions and categories can be assigned a policy which dictates how **mergerfs** behaves. Any policy can be assigned to a function or category though some are not very practical. For instance: **rand** (random) may be useful for file creation (create) but could lead to very odd behavior if used for `chmod` (though only if there were more than one copy of the file).
The POSIX filesystem API has a number of functions. **creat**, **stat**, **chown**, etc. In mergerfs these functions are grouped into 3 categories: **action**, **create**, and **search**. Functions and categories can be assigned a policy which dictates how **mergerfs** behaves. Any policy can be assigned to a function or category though some may not be very useful in practice. For instance: **rand** (random) may be useful for file creation (create) but could lead to very odd behavior if used for `chmod` (though only if there were more than one copy of the file).
Policies, when called to create, will ignore drives which are readonly or have less than **minfreespace**. This allows for read/write and readonly drives to be mixed together and keep drives which may remount as readonly on error from further affecting the pool.
Policies, when called to create, will ignore drives which are readonly. This allows for readonly and read/write drives to be mixed together. Note that the drive must be explicitly mounted with the **ro** mount option for this to work.
#### Function / Category classifications #### #### Function / Category classifications ####
@ -88,21 +88,21 @@ Due to FUSE limitations **ioctl** behaves differently if its acting on a directo
| Policy | Description | | Policy | Description |
|--------------|-------------| |--------------|-------------|
| all | Search category: acts like **ff**. Action category: apply to all found. Create category: for **mkdir**, **mknod**, and **symlink** it will apply to all found. **create** works like **ff**. It will exclude readonly drives and those with free space less than **minfreespace**. | | all | Search category: acts like **ff**. Action category: apply to all found. Create category: for **mkdir**, **mknod**, and **symlink** it will apply to all found. **create** works like **ff**. It will exclude readonly drives and those with free space less than **minfreespace**. |
| epall (existing path, all) | Search category: acts like **epff**. Action category: apply to all found. Create category: for **mkdir**, **mknod**, and **symlink** it will apply to all existing paths found. **create** works like **epff**. It will exclude readonly drives and those with free space less than **minfreespace**. |
| epff | Given the order of the drives, as defined at mount time or when configured via the xattr interface, act on the first one found where the path already exists. For **create** category it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). Falls back to **ff**. |
| eplfs (existing path, least free space) | If the path exists on multiple drives use the one with the least free space. For **create** category it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **lfs**. |
| eplus (existing path, least used space) | If the path exists on multiple drives use the one with the least used space. For **create** category it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **lus**. |
| epmfs (existing path, most free space) | If the path exists on multiple drives use the one with the most free space. For **create** category it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. |
| eprand (existing path, random) | Calls **epall** and then randomizes. |
| erofs | Exclusively return **-1** with **errno** set to **EROFS**. By setting **create** functions to this you can in effect turn the filesystem readonly. |
| ff (first found) | Given the order of the drives, as defined at mount time or when configured via xattr interface, act on the first one found. For **create** category it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). |
| lfs (least free space) | Pick the drive with the least available free space. For **create** category it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. |
| lus (least used space) | Pick the drive with the least used space. For **create** category it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. |
| mfs (most free space) | Pick the drive with the most available free space. For **create** category it will exclude readonly drives. Falls back to **ff**. |
| newest (newest file) | Pick the file / directory with the largest mtime. For **create** category it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). |
| epall (existing path, all) | Search category: acts like **epff**. Action category: apply to all found. Create category: for **mkdir**, **mknod**, and **symlink** it will apply to all existing paths found. **create** works like **epff**. Excludes readonly drives and those with free space less than **minfreespace**. |
| epff (existing path, first found) | Given the order of the drives, as defined at mount time or configured at runtime, act on the first one found where the relative path already exists. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). Falls back to **ff**. |
| eplfs (existing path, least free space) | Of all the drives on which the relative path exists choose the drive with the least free space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **lfs**. |
| eplus (existing path, least used space) | Of all the drives on which the relative path exists choose the drive with the least used space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **lus**. |
| epmfs (existing path, most free space) | Of all the drives on which the relative path exists choose the drive with the most free space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. |
| eprand (existing path, random) | Calls **epall** and then randomizes. Otherwise behaves the same as **epall**. |
| erofs | Exclusively return **-1** with **errno** set to **EROFS** (Read-only filesystem). By setting **create** functions to this you can in effect turn the filesystem mostly readonly. |
| ff (first found) | Given the order of the drives, as defined at mount time or configured at runtime, act on the first one found. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). |
| lfs (least free space) | Pick the drive with the least available free space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. |
| lus (least used space) | Pick the drive with the least used space. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace**. Falls back to **mfs**. |
| mfs (most free space) | Pick the drive with the most available free space. For **create** category functions it will exclude readonly drives. Falls back to **ff**. |
| newest | Pick the file / directory with the largest mtime. For **create** category functions it will exclude readonly drives and those with free space less than **minfreespace** (unless there is no other option). |
| rand (random) | Calls **all** and then randomizes. | | rand (random) | Calls **all** and then randomizes. |
**epff**, **eplfs**, **eplus**, and **epmf** are path preserving policies. As the descriptions above explain they will only consider drives where the path being accessed exists. Non-path preserving policies will clone paths as necessary.
**epff**, **eplfs**, **eplus**, **epmf**, **eprand** are `path preserving` policies. As the descriptions above explain they will only consider drives where the relative path being accessed already exists. Non-path preserving policies will result in paths being copied to drives as necessary.
#### Defaults #### #### Defaults ####
@ -114,9 +114,11 @@ Due to FUSE limitations **ioctl** behaves differently if its acting on a directo
#### rename & link #### #### rename & link ####
[rename](http://man7.org/linux/man-pages/man2/rename.2.html) is a tricky function in a merged system. Normally if a rename can't be done atomically due to the source and destination paths existing on different mount points it will return **-1** with **errno = EXDEV**. The atomic rename is most critical for replacing files in place atomically (such as securing writing to a temp file and then replacing a target). The problem is that by merging multiple paths you can have N instances of the source and destinations on different drives. This can lead to several undesirable situtations with or without errors and it's not entirely obvious what to do when an error occurs.
[rename](http://man7.org/linux/man-pages/man2/rename.2.html) is a tricky function in a merged system. Under normal situations rename only works within a single filesystem or device. If a rename can't be done atomically due to the source and destination paths existing on different mount points it will return **-1** with **errno = EXDEV** (cross device).
Originally mergerfs would return EXDEV whenever a rename was requested which was cross directory in any way. This made the code simple and was technically complient with POSIX requirements. However, many applications fail to handle EXDEV at all and treat it as a normal error or they only partially support EXDEV (don't respond the same as `mv` would). Such apps include: gvfsd-fuse v1.20.3 and prior, Finder / CIFS/SMB client in Apple OSX 10.9+, NZBGet, Samba's recycling bin feature.
Originally mergerfs would return EXDEV whenever a rename was requested which was cross directory in any way. This made the code simple and was technically complient with POSIX requirements. However, many applications fail to handle EXDEV at all and treat it as a normal error or otherwise handle it poorly. Such apps include: gvfsd-fuse v1.20.3 and prior, Finder / CIFS/SMB client in Apple OSX 10.9+, NZBGet, Samba's recycling bin feature.
As a result a compromise was made in order to get most software to work while still obeying mergerfs' policies. Below is the rather complicated logic.
* If using a **create** policy which tries to preserve directory paths (epff,eplfs,eplus,epmfs) * If using a **create** policy which tries to preserve directory paths (epff,eplfs,eplus,epmfs)
* Using the **rename** policy get the list of files to rename * Using the **rename** policy get the list of files to rename
@ -144,10 +146,12 @@ Originally mergerfs would return EXDEV whenever a rename was requested which was
The the removals are subject to normal entitlement checks. The the removals are subject to normal entitlement checks.
The above behavior will help minimize the likelihood of EXDEV being returned but it will still be possible. To remove the possibility all together mergerfs would need to perform the as **mv** does when it receives EXDEV normally.
The above behavior will help minimize the likelihood of EXDEV being returned but it will still be possible.
**link** uses the same basic strategy. **link** uses the same basic strategy.
If you're receiving errors from software when files are moved / renamed then you should consider changing the create policy to one which is **not** path preserving.
#### readdir #### #### readdir ####
[readdir](http://linux.die.net/man/3/readdir) is different from all other filesystem functions. While it could have it's own set of policies to tweak its behavior at this time it provides a simple union of files and directories found. Remember that any action or information queried about these files and directories come from the respective function. For instance: an **ls** is a **readdir** and for each file/directory returned **getattr** is called. Meaning the policy of **getattr** is responsible for choosing the file/directory which is the source of the metadata you see in an **ls**. [readdir](http://linux.die.net/man/3/readdir) is different from all other filesystem functions. While it could have it's own set of policies to tweak its behavior at this time it provides a simple union of files and directories found. Remember that any action or information queried about these files and directories come from the respective function. For instance: an **ls** is a **readdir** and for each file/directory returned **getattr** is called. Meaning the policy of **getattr** is responsible for choosing the file/directory which is the source of the metadata you see in an **ls**.
@ -302,16 +306,19 @@ A B C
* mergerfs.ctl: A tool to make it easier to query and configure mergerfs at runtime * mergerfs.ctl: A tool to make it easier to query and configure mergerfs at runtime
* mergerfs.fsck: Provides permissions and ownership auditing and the ability to fix them * mergerfs.fsck: Provides permissions and ownership auditing and the ability to fix them
* mergerfs.dedup: Will help identify and optionally remove duplicate files * mergerfs.dedup: Will help identify and optionally remove duplicate files
* mergerfs.balance: Rebalance files across drives by moving them from the most filled to the least filled
* mergerfs.mktrash: Creates FreeDesktop.org Trash specification compatible directories on a mergerfs mount * mergerfs.mktrash: Creates FreeDesktop.org Trash specification compatible directories on a mergerfs mount
* https://github.com/trapexit/scorch * https://github.com/trapexit/scorch
* scorch: A tool to help discover silent corruption of files * scorch: A tool to help discover silent corruption of files
* https://github.com/trapexit/bbf
* bbf (bad block finder): a tool to scan for and 'fix' hard drive bad blocks and find the files using those blocks
# TIPS / NOTES # TIPS / NOTES
* The recommended options are **defaults,allow_other,direct_io,use_ino**. * The recommended options are **defaults,allow_other,direct_io,use_ino**.
* Run mergerfs as `root` unless you're merging paths which are owned by the same user otherwise strange permission issues may arise. * Run mergerfs as `root` unless you're merging paths which are owned by the same user otherwise strange permission issues may arise.
* https://github.com/trapexit/backup-and-recovery-howtos : A set of guides / howtos on creating a data storage system, backing it up, maintaining it, and recovering from failure. * https://github.com/trapexit/backup-and-recovery-howtos : A set of guides / howtos on creating a data storage system, backing it up, maintaining it, and recovering from failure.
* If you don't see some directories / files you expect in a merged point be sure the user has permission to all the underlying directories. Use `mergerfs.fsck` to audit the drive for out of sync permissions.
* If you don't see some directories and files you expect in a merged point or policies seem to skip drives be sure the user has permission to all the underlying directories. Use `mergerfs.fsck` to audit the drive for out of sync permissions.
* Do *not* use `direct_io` if you expect applications (such as rtorrent) to [mmap](http://linux.die.net/man/2/mmap) files. It is not currently supported in FUSE w/ `direct_io` enabled. * Do *not* use `direct_io` if you expect applications (such as rtorrent) to [mmap](http://linux.die.net/man/2/mmap) files. It is not currently supported in FUSE w/ `direct_io` enabled.
* Since POSIX gives you only error or success on calls its difficult to determine the proper behavior when applying the behavior to multiple targets. **mergerfs** will return an error only if all attempts of an action fail. Any success will lead to a success returned. This means however that some odd situations may arise. * Since POSIX gives you only error or success on calls its difficult to determine the proper behavior when applying the behavior to multiple targets. **mergerfs** will return an error only if all attempts of an action fail. Any success will lead to a success returned. This means however that some odd situations may arise.
* [Kodi](http://kodi.tv), [Plex](http://plex.tv), [Subsonic](http://subsonic.org), etc. can use directory [mtime](http://linux.die.net/man/2/stat) to more efficiently determine whether to scan for new content rather than simply performing a full scan. If using the default **getattr** policy of **ff** its possible **Kodi** will miss an update on account of it returning the first directory found's **stat** info and its a later directory on another mount which had the **mtime** recently updated. To fix this you will want to set **func.getattr=newest**. Remember though that this is just **stat**. If the file is later **open**'ed or **unlink**'ed and the policy is different for those then a completely different file or directory could be acted on. * [Kodi](http://kodi.tv), [Plex](http://plex.tv), [Subsonic](http://subsonic.org), etc. can use directory [mtime](http://linux.die.net/man/2/stat) to more efficiently determine whether to scan for new content rather than simply performing a full scan. If using the default **getattr** policy of **ff** its possible **Kodi** will miss an update on account of it returning the first directory found's **stat** info and its a later directory on another mount which had the **mtime** recently updated. To fix this you will want to set **func.getattr=newest**. Remember though that this is just **stat**. If the file is later **open**'ed or **unlink**'ed and the policy is different for those then a completely different file or directory could be acted on.
@ -432,29 +439,31 @@ mhddfs is no longer maintained and has some known stability and security issues
#### Why use mergerfs over aufs? #### Why use mergerfs over aufs?
While aufs can offer better peak performance mergerfs offers more configurability and is generally easier to use. mergerfs however does not offer the overlay / copy-on-write (COW) features which aufs and overlayfs have.
While aufs can offer better peak performance mergerfs provides more configurability and is generally easier to use. mergerfs however does not offer the overlay / copy-on-write (COW) features which aufs and overlayfs have.
#### Why use mergerfs over LVM/ZFS/BTRFS/RAID0 drive concatenation / striping? #### Why use mergerfs over LVM/ZFS/BTRFS/RAID0 drive concatenation / striping?
With simple JBOD / drive concatenation / stripping / RAID0 a single drive failure will lead to full pool failure. mergerfs performs a similar behavior without the catastrophic failure and general lack of recovery. Drives can fail and all other data will continue to be accessable.
With simple JBOD / drive concatenation / stripping / RAID0 a single drive failure will result in full pool failure. mergerfs performs a similar behavior without the possibility of catastrophic failure and difficulties in recovery. Drives may fail however all other data will continue to be accessable.
When combined with something like [SnapRaid](http://www.snapraid.it) and/or an offsite full backup solution you can have the flexibilty of JBOD without the single point of failure.
When combined with something like [SnapRaid](http://www.snapraid.it) and/or an offsite backup solution you can have the flexibilty of JBOD without the single point of failure.
#### Why use mergerfs over ZFS? #### Why use mergerfs over ZFS?
MergerFS is not intended to be a replacement for ZFS. MergerFS is intended to provide flexible pooling of arbitrary drives (local or remote), of arbitrary sizes, and arbitrary filesystems. For `write once, read many` usecases such as media storage. And where data integrity and backup can be managed in other ways. In that situation ZFS can introduce major maintance and cost burdens as described [here](http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html).
MergerFS is not intended to be a replacement for ZFS. MergerFS is intended to provide flexible pooling of arbitrary drives (local or remote), of arbitrary sizes, and arbitrary filesystems. For `write once, read many` usecases such as bulk media storage. Where data integrity and backup is managed in other ways. In that situation ZFS can introduce major maintance and cost burdens as described [here](http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html).
#### Can drives be written to directly? Outside of mergerfs while pooled? #### Can drives be written to directly? Outside of mergerfs while pooled?
Yes. It will be represented immediately in the pool as the policies would describe.
Yes. It will be represented immediately in the pool as the policies perscribe.
#### Why do I get an "out of space" error even though the system says there's lots of space left? #### Why do I get an "out of space" error even though the system says there's lots of space left?
Please reread the sections above about policies, path preserving, and the **moveonenospc** option. If the policy is path preserving and a drive is almost full and the drive the policy would pick then the writing of the file may fill the drive and receive ENOSPC errors. That is expected with those settings. If you don't want that: enable **moveonenospc** and don't use a path preserving policy.
Please reread the sections above about policies, path preserving, and the **moveonenospc** option.
Remember that mergerfs is simply presenting a logical merging of the contents of the pooled drives. The reported free space is the aggregate space available *not* the contiguous space available. If the writing of a file fills a drive and **moveonenospc** is disabled it will return an ENOSPC error.
#### Can mergerfs mounts be exported over NFS? #### Can mergerfs mounts be exported over NFS?
Yes. Some clients (Kodi) have issues but users have found that enabling the `use_ino` option often address the problem.
Yes. Some clients (Kodi) have issues in which the contents of the NFS mount will not be presented but users have found that enabling the `use_ino` option often fixes that problem.
#### Can mergerfs mounts be exported over Samba / SMB? #### Can mergerfs mounts be exported over Samba / SMB?

182
man/mergerfs.1

@ -1,5 +1,8 @@
.\"t .\"t
.\" Automatically generated by Pandoc 1.16.0.2
.\"
.TH "mergerfs" "1" "2017\-02\-18" "mergerfs user manual" "" .TH "mergerfs" "1" "2017\-02\-18" "mergerfs user manual" ""
.hy
.SH NAME .SH NAME
.PP .PP
mergerfs \- another (FUSE based) union filesystem mergerfs \- another (FUSE based) union filesystem
@ -144,22 +147,21 @@ In mergerfs these functions are grouped into 3 categories:
\f[B]action\f[], \f[B]create\f[], and \f[B]search\f[]. \f[B]action\f[], \f[B]create\f[], and \f[B]search\f[].
Functions and categories can be assigned a policy which dictates how Functions and categories can be assigned a policy which dictates how
\f[B]mergerfs\f[] behaves. \f[B]mergerfs\f[] behaves.
Any policy can be assigned to a function or category though some are not
very practical.
Any policy can be assigned to a function or category though some may not
be very useful in practice.
For instance: \f[B]rand\f[] (random) may be useful for file creation For instance: \f[B]rand\f[] (random) may be useful for file creation
(create) but could lead to very odd behavior if used for \f[C]chmod\f[] (create) but could lead to very odd behavior if used for \f[C]chmod\f[]
(though only if there were more than one copy of the file). (though only if there were more than one copy of the file).
.PP .PP
Policies, when called to create, will ignore drives which are readonly
or have less than \f[B]minfreespace\f[].
This allows for read/write and readonly drives to be mixed together and
keep drives which may remount as readonly on error from further
affecting the pool.
Policies, when called to create, will ignore drives which are readonly.
This allows for readonly and read/write drives to be mixed together.
Note that the drive must be explicitly mounted with the \f[B]ro\f[]
mount option for this to work.
.SS Function / Category classifications .SS Function / Category classifications
.PP .PP
.TS .TS
tab(@); tab(@);
l l.
lw(10.7n) lw(16.5n).
T{ T{
Category Category
T}@T{ T}@T{
@ -200,7 +202,7 @@ exists across all source mounts) \f[B]getattr\f[] will also be used.
.PP .PP
.TS .TS
tab(@); tab(@);
l l.
lw(14.6n) lw(13.6n).
T{ T{
Policy Policy
T}@T{ T}@T{
@ -226,99 +228,100 @@ Action category: apply to all found.
Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and Create category: for \f[B]mkdir\f[], \f[B]mknod\f[], and
\f[B]symlink\f[] it will apply to all existing paths found. \f[B]symlink\f[] it will apply to all existing paths found.
\f[B]create\f[] works like \f[B]epff\f[]. \f[B]create\f[] works like \f[B]epff\f[].
It will exclude readonly drives and those with free space less than
Excludes readonly drives and those with free space less than
\f[B]minfreespace\f[]. \f[B]minfreespace\f[].
T} T}
T{ T{
epff
epff (existing path, first found)
T}@T{ T}@T{
Given the order of the drives, as defined at mount time or when
configured via the xattr interface, act on the first one found where the
path already exists.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[] (unless there is no
other option).
Given the order of the drives, as defined at mount time or configured at
runtime, act on the first one found where the relative path already
exists.
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[] (unless there
is no other option).
Falls back to \f[B]ff\f[]. Falls back to \f[B]ff\f[].
T} T}
T{ T{
eplfs (existing path, least free space) eplfs (existing path, least free space)
T}@T{ T}@T{
If the path exists on multiple drives use the one with the least free
space.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[].
Of all the drives on which the relative path exists choose the drive
with the least free space.
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[].
Falls back to \f[B]lfs\f[]. Falls back to \f[B]lfs\f[].
T} T}
T{ T{
eplus (existing path, least used space) eplus (existing path, least used space)
T}@T{ T}@T{
If the path exists on multiple drives use the one with the least used
space.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[].
Of all the drives on which the relative path exists choose the drive
with the least used space.
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[].
Falls back to \f[B]lus\f[]. Falls back to \f[B]lus\f[].
T} T}
T{ T{
epmfs (existing path, most free space) epmfs (existing path, most free space)
T}@T{ T}@T{
If the path exists on multiple drives use the one with the most free
space.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[].
Of all the drives on which the relative path exists choose the drive
with the most free space.
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[].
Falls back to \f[B]mfs\f[]. Falls back to \f[B]mfs\f[].
T} T}
T{ T{
eprand (existing path, random) eprand (existing path, random)
T}@T{ T}@T{
Calls \f[B]epall\f[] and then randomizes. Calls \f[B]epall\f[] and then randomizes.
Otherwise behaves the same as \f[B]epall\f[].
T} T}
T{ T{
erofs erofs
T}@T{ T}@T{
Exclusively return \f[B]\-1\f[] with \f[B]errno\f[] set to Exclusively return \f[B]\-1\f[] with \f[B]errno\f[] set to
\f[B]EROFS\f[].
\f[B]EROFS\f[] (Read\-only filesystem).
By setting \f[B]create\f[] functions to this you can in effect turn the By setting \f[B]create\f[] functions to this you can in effect turn the
filesystem readonly.
filesystem mostly readonly.
T} T}
T{ T{
ff (first found) ff (first found)
T}@T{ T}@T{
Given the order of the drives, as defined at mount time or when
configured via xattr interface, act on the first one found.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[] (unless there is no
other option).
Given the order of the drives, as defined at mount time or configured at
runtime, act on the first one found.
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[] (unless there
is no other option).
T} T}
T{ T{
lfs (least free space) lfs (least free space)
T}@T{ T}@T{
Pick the drive with the least available free space. Pick the drive with the least available free space.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[].
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[].
Falls back to \f[B]mfs\f[]. Falls back to \f[B]mfs\f[].
T} T}
T{ T{
lus (least used space) lus (least used space)
T}@T{ T}@T{
Pick the drive with the least used space. Pick the drive with the least used space.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[].
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[].
Falls back to \f[B]mfs\f[]. Falls back to \f[B]mfs\f[].
T} T}
T{ T{
mfs (most free space) mfs (most free space)
T}@T{ T}@T{
Pick the drive with the most available free space. Pick the drive with the most available free space.
For \f[B]create\f[] category it will exclude readonly drives.
For \f[B]create\f[] category functions it will exclude readonly drives.
Falls back to \f[B]ff\f[]. Falls back to \f[B]ff\f[].
T} T}
T{ T{
newest (newest file)
newest
T}@T{ T}@T{
Pick the file / directory with the largest mtime. Pick the file / directory with the largest mtime.
For \f[B]create\f[] category it will exclude readonly drives and those
with free space less than \f[B]minfreespace\f[] (unless there is no
other option).
For \f[B]create\f[] category functions it will exclude readonly drives
and those with free space less than \f[B]minfreespace\f[] (unless there
is no other option).
T} T}
T{ T{
rand (random) rand (random)
@ -327,11 +330,12 @@ Calls \f[B]all\f[] and then randomizes.
T} T}
.TE .TE
.PP .PP
\f[B]epff\f[], \f[B]eplfs\f[], \f[B]eplus\f[], and \f[B]epmf\f[] are
path preserving policies.
\f[B]epff\f[], \f[B]eplfs\f[], \f[B]eplus\f[], \f[B]epmf\f[],
\f[B]eprand\f[] are \f[C]path\ preserving\f[] policies.
As the descriptions above explain they will only consider drives where As the descriptions above explain they will only consider drives where
the path being accessed exists.
Non\-path preserving policies will clone paths as necessary.
the relative path being accessed already exists.
Non\-path preserving policies will result in paths being copied to
drives as necessary.
.SS Defaults .SS Defaults
.PP .PP
.TS .TS
@ -363,26 +367,24 @@ T}
.PP .PP
rename (http://man7.org/linux/man-pages/man2/rename.2.html) is a tricky rename (http://man7.org/linux/man-pages/man2/rename.2.html) is a tricky
function in a merged system. function in a merged system.
Normally if a rename can\[aq]t be done atomically due to the source and
Under normal situations rename only works within a single filesystem or
device.
If a rename can\[aq]t be done atomically due to the source and
destination paths existing on different mount points it will return destination paths existing on different mount points it will return
\f[B]\-1\f[] with \f[B]errno = EXDEV\f[].
The atomic rename is most critical for replacing files in place
atomically (such as securing writing to a temp file and then replacing a
target).
The problem is that by merging multiple paths you can have N instances
of the source and destinations on different drives.
This can lead to several undesirable situtations with or without errors
and it\[aq]s not entirely obvious what to do when an error occurs.
\f[B]\-1\f[] with \f[B]errno = EXDEV\f[] (cross device).
.PP .PP
Originally mergerfs would return EXDEV whenever a rename was requested Originally mergerfs would return EXDEV whenever a rename was requested
which was cross directory in any way. which was cross directory in any way.
This made the code simple and was technically complient with POSIX This made the code simple and was technically complient with POSIX
requirements. requirements.
However, many applications fail to handle EXDEV at all and treat it as a However, many applications fail to handle EXDEV at all and treat it as a
normal error or they only partially support EXDEV (don\[aq]t respond the
same as \f[C]mv\f[] would).
normal error or otherwise handle it poorly.
Such apps include: gvfsd\-fuse v1.20.3 and prior, Finder / CIFS/SMB Such apps include: gvfsd\-fuse v1.20.3 and prior, Finder / CIFS/SMB
client in Apple OSX 10.9+, NZBGet, Samba\[aq]s recycling bin feature. client in Apple OSX 10.9+, NZBGet, Samba\[aq]s recycling bin feature.
.PP
As a result a compromise was made in order to get most software to work
while still obeying mergerfs\[aq] policies.
Below is the rather complicated logic.
.IP \[bu] 2 .IP \[bu] 2
If using a \f[B]create\f[] policy which tries to preserve directory If using a \f[B]create\f[] policy which tries to preserve directory
paths (epff,eplfs,eplus,epmfs) paths (epff,eplfs,eplus,epmfs)
@ -449,10 +451,12 @@ The the removals are subject to normal entitlement checks.
.PP .PP
The above behavior will help minimize the likelihood of EXDEV being The above behavior will help minimize the likelihood of EXDEV being
returned but it will still be possible. returned but it will still be possible.
To remove the possibility all together mergerfs would need to perform
the as \f[B]mv\f[] does when it receives EXDEV normally.
.PP .PP
\f[B]link\f[] uses the same basic strategy. \f[B]link\f[] uses the same basic strategy.
.PP
If you\[aq]re receiving errors from software when files are moved /
renamed then you should consider changing the create policy to one which
is \f[B]not\f[] path preserving.
.SS readdir .SS readdir
.PP .PP
readdir (http://linux.die.net/man/3/readdir) is different from all other readdir (http://linux.die.net/man/3/readdir) is different from all other
@ -691,12 +695,20 @@ ability to fix them
.IP \[bu] 2 .IP \[bu] 2
mergerfs.dedup: Will help identify and optionally remove duplicate files mergerfs.dedup: Will help identify and optionally remove duplicate files
.IP \[bu] 2 .IP \[bu] 2
mergerfs.balance: Rebalance files across drives by moving them from the
most filled to the least filled
.IP \[bu] 2
mergerfs.mktrash: Creates FreeDesktop.org Trash specification compatible mergerfs.mktrash: Creates FreeDesktop.org Trash specification compatible
directories on a mergerfs mount directories on a mergerfs mount
.IP \[bu] 2 .IP \[bu] 2
https://github.com/trapexit/scorch https://github.com/trapexit/scorch
.IP \[bu] 2 .IP \[bu] 2
scorch: A tool to help discover silent corruption of files scorch: A tool to help discover silent corruption of files
.IP \[bu] 2
https://github.com/trapexit/bbf
.IP \[bu] 2
bbf (bad block finder): a tool to scan for and \[aq]fix\[aq] hard drive
bad blocks and find the files using those blocks
.SH TIPS / NOTES .SH TIPS / NOTES
.IP \[bu] 2 .IP \[bu] 2
The recommended options are The recommended options are
@ -709,8 +721,9 @@ https://github.com/trapexit/backup\-and\-recovery\-howtos : A set of
guides / howtos on creating a data storage system, backing it up, guides / howtos on creating a data storage system, backing it up,
maintaining it, and recovering from failure. maintaining it, and recovering from failure.
.IP \[bu] 2 .IP \[bu] 2
If you don\[aq]t see some directories / files you expect in a merged
point be sure the user has permission to all the underlying directories.
If you don\[aq]t see some directories and files you expect in a merged
point or policies seem to skip drives be sure the user has permission to
all the underlying directories.
Use \f[C]mergerfs.fsck\f[] to audit the drive for out of sync Use \f[C]mergerfs.fsck\f[] to audit the drive for out of sync
permissions. permissions.
.IP \[bu] 2 .IP \[bu] 2
@ -976,7 +989,7 @@ MergerFS provides a superset of mhddfs\[aq] features and should offer
the same or maybe better performance. the same or maybe better performance.
.SS Why use mergerfs over aufs? .SS Why use mergerfs over aufs?
.PP .PP
While aufs can offer better peak performance mergerfs offers more
While aufs can offer better peak performance mergerfs provides more
configurability and is generally easier to use. configurability and is generally easier to use.
mergerfs however does not offer the overlay / copy\-on\-write (COW) mergerfs however does not offer the overlay / copy\-on\-write (COW)
features which aufs and overlayfs have. features which aufs and overlayfs have.
@ -984,45 +997,48 @@ features which aufs and overlayfs have.
striping? striping?
.PP .PP
With simple JBOD / drive concatenation / stripping / RAID0 a single With simple JBOD / drive concatenation / stripping / RAID0 a single
drive failure will lead to full pool failure.
mergerfs performs a similar behavior without the catastrophic failure
and general lack of recovery.
Drives can fail and all other data will continue to be accessable.
drive failure will result in full pool failure.
mergerfs performs a similar behavior without the possibility of
catastrophic failure and difficulties in recovery.
Drives may fail however all other data will continue to be accessable.
.PP .PP
When combined with something like SnapRaid (http://www.snapraid.it) When combined with something like SnapRaid (http://www.snapraid.it)
and/or an offsite full backup solution you can have the flexibilty of
JBOD without the single point of failure.
and/or an offsite backup solution you can have the flexibilty of JBOD
without the single point of failure.
.SS Why use mergerfs over ZFS? .SS Why use mergerfs over ZFS?
.PP .PP
MergerFS is not intended to be a replacement for ZFS. MergerFS is not intended to be a replacement for ZFS.
MergerFS is intended to provide flexible pooling of arbitrary drives MergerFS is intended to provide flexible pooling of arbitrary drives
(local or remote), of arbitrary sizes, and arbitrary filesystems. (local or remote), of arbitrary sizes, and arbitrary filesystems.
For \f[C]write\ once,\ read\ many\f[] usecases such as media storage.
And where data integrity and backup can be managed in other ways.
For \f[C]write\ once,\ read\ many\f[] usecases such as bulk media
storage.
Where data integrity and backup is managed in other ways.
In that situation ZFS can introduce major maintance and cost burdens as In that situation ZFS can introduce major maintance and cost burdens as
described described
here (http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html). here (http://louwrentius.com/the-hidden-cost-of-using-zfs-for-your-home-nas.html).
.SS Can drives be written to directly? Outside of mergerfs while pooled? .SS Can drives be written to directly? Outside of mergerfs while pooled?
.PP .PP
Yes. Yes.
It will be represented immediately in the pool as the policies would
describe.
It will be represented immediately in the pool as the policies
perscribe.
.SS Why do I get an "out of space" error even though the system says .SS Why do I get an "out of space" error even though the system says
there\[aq]s lots of space left? there\[aq]s lots of space left?
.PP .PP
Please reread the sections above about policies, path preserving, and Please reread the sections above about policies, path preserving, and
the \f[B]moveonenospc\f[] option. the \f[B]moveonenospc\f[] option.
If the policy is path preserving and a drive is almost full and the
drive the policy would pick then the writing of the file may fill the
drive and receive ENOSPC errors.
That is expected with those settings.
If you don\[aq]t want that: enable \f[B]moveonenospc\f[] and don\[aq]t
use a path preserving policy.
.PP
Remember that mergerfs is simply presenting a logical merging of the
contents of the pooled drives.
The reported free space is the aggregate space available \f[I]not\f[]
the contiguous space available.
If the writing of a file fills a drive and \f[B]moveonenospc\f[] is
disabled it will return an ENOSPC error.
.SS Can mergerfs mounts be exported over NFS? .SS Can mergerfs mounts be exported over NFS?
.PP .PP
Yes. Yes.
Some clients (Kodi) have issues but users have found that enabling the
\f[C]use_ino\f[] option often address the problem.
Some clients (Kodi) have issues in which the contents of the NFS mount
will not be presented but users have found that enabling the
\f[C]use_ino\f[] option often fixes that problem.
.SS Can mergerfs mounts be exported over Samba / SMB? .SS Can mergerfs mounts be exported over Samba / SMB?
.PP .PP
Yes. Yes.

Loading…
Cancel
Save