2024-12-23 22:12:26 -06:00
|
|
|
# QuickStart
|
|
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
|
|
First ensure you have the [latest version installed](setup/installation.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
2025-03-11 23:30:13 -05:00
|
|
|
mergerfs has many [options](config/options.md) and effectively all of
|
|
|
|
|
them are functional in nature. What that means is that there is no
|
|
|
|
|
"best" or "fastest" configuration. No "make faster"
|
|
|
|
|
options. Everything changes behavior. Sometimes those changes in
|
|
|
|
|
behavior affect performance.
|
|
|
|
|
|
|
|
|
|
If you don't already know that you have special requirements then use
|
|
|
|
|
one of the following option sets as it will cover the common use
|
|
|
|
|
cases.
|
2024-12-23 22:12:26 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
### You use Linux v6.6 or above
|
|
|
|
|
|
|
|
|
|
* cache.files=off
|
2025-03-11 23:30:13 -05:00
|
|
|
* category.create=pfrd
|
2025-03-30 16:30:36 -05:00
|
|
|
* func.getattr=newest
|
2025-02-19 07:02:22 +02:00
|
|
|
* dropcacheonclose=false
|
2024-12-23 22:12:26 -06:00
|
|
|
|
2025-03-11 23:30:13 -05:00
|
|
|
In previous versions of Linux it was unable to support `mmap` if [page
|
|
|
|
|
caching](config/cache.md) was disabled (ie:
|
|
|
|
|
`cache.files=off`). However, it now will enable page caching if needed
|
|
|
|
|
for a particular file if `mmap` is requested.
|
2024-12-23 22:12:26 -06:00
|
|
|
|
2025-09-01 21:58:58 -04:00
|
|
|
[mmap](https://en.wikipedia.org/wiki/Mmap) is needed by certain
|
|
|
|
|
software to read and write to a file. However, many software could
|
|
|
|
|
work without it and fail to have proper error handling for when it is
|
|
|
|
|
unavailable. Many programs that use **sqlite3** will require `mmap`
|
|
|
|
|
despite [sqlite3 working perfectly
|
2025-03-11 23:30:13 -05:00
|
|
|
fine](known_issues_bugs.md#sqlite3-plex-jellyfin-do-not-work-with-mergerfs)
|
|
|
|
|
without it (and in some cases can be more performant with regular file
|
|
|
|
|
IO.)
|
2024-12-23 22:12:26 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
### You use Linux v6.5 or below
|
|
|
|
|
|
|
|
|
|
#### You need `mmap` (used by rtorrent and many sqlite3 base software)
|
|
|
|
|
|
|
|
|
|
* cache.files=auto-full
|
2025-03-11 23:30:13 -05:00
|
|
|
* category.create=pfrd
|
2025-03-30 16:30:36 -05:00
|
|
|
* func.getattr=newest
|
2024-12-23 22:12:26 -06:00
|
|
|
* dropcacheonclose=true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### You don't need `mmap`
|
|
|
|
|
|
|
|
|
|
* cache.files=off
|
2025-03-11 23:30:13 -05:00
|
|
|
* category.create=pfrd
|
2025-03-30 16:30:36 -05:00
|
|
|
* func.getattr=newest
|
2024-12-23 22:12:26 -06:00
|
|
|
* dropcacheonclose=false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
2025-04-18 01:08:41 -05:00
|
|
|
For some suggestions on branch setup see [the page on
|
|
|
|
|
branches](config/branches.md#branch-setup).
|
|
|
|
|
|
|
|
|
|
|
2024-12-23 22:12:26 -06:00
|
|
|
### Command Line
|
|
|
|
|
|
|
|
|
|
```
|
2025-03-30 16:30:36 -05:00
|
|
|
mergerfs -o cache.files=off,category.create=pfrd,func.getattr=newest,dropcacheonclose=false /mnt/hdd0:/mnt/hdd1 /media
|
2024-12-23 22:12:26 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### /etc/fstab
|
|
|
|
|
|
|
|
|
|
```
|
2025-03-30 16:30:36 -05:00
|
|
|
/mnt/hdd0:/mnt/hdd1 /media mergerfs cache.files=off,category.create=pfrd,func.getattr=newest,dropcacheonclose=false 0 0
|
2024-12-23 22:12:26 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### /etc/fstab w/ config file
|
|
|
|
|
|
|
|
|
|
For more complex setups it can be useful to separate out the config.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### /etc/fstab
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
/etc/mergerfs/branches/media/* /media mergerfs config=/etc/mergerfs/config/media.ini
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### /etc/mergerfs/config/media.ini
|
|
|
|
|
|
|
|
|
|
```ini title="media.ini" linenums="1"
|
|
|
|
|
cache.files=off
|
2025-03-11 23:30:13 -05:00
|
|
|
category.create=pfrd
|
2025-03-30 16:30:36 -05:00
|
|
|
func.getattr=newest
|
2024-12-23 22:12:26 -06:00
|
|
|
dropcacheonclose=false
|
2025-08-14 03:00:05 +02:00
|
|
|
# comments and empty lines are supported
|
2024-12-23 22:12:26 -06:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### /etc/mergerfs/branches/media/
|
|
|
|
|
|
|
|
|
|
Create a bunch of symlinks to point to the branch. mergerfs will
|
|
|
|
|
resolve the symlinks and use the real path.
|
|
|
|
|
|
|
|
|
|
`ls -lh /etc/mergerfs/branches/media/*`
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
lrwxrwxrwx 1 root root 21 Aug 4 2023 hdd00 -> /mnt/hdd/hdd00
|
|
|
|
|
lrwxrwxrwx 1 root root 21 Aug 4 2023 hdd01 -> /mnt/hdd/hdd01
|
|
|
|
|
lrwxrwxrwx 1 root root 21 Aug 4 2023 hdd02 -> /mnt/hdd/hdd02
|
|
|
|
|
lrwxrwxrwx 1 root root 21 Aug 4 2023 hdd03 -> /mnt/hdd/hdd03
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### systemd (simple)
|
|
|
|
|
|
|
|
|
|
`/etc/systemd/system/mergerfs-media.service`
|
|
|
|
|
|
|
|
|
|
```systemd title="mergerfs-media.service" linenums="1"
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=mergerfs /media service
|
|
|
|
|
After=local-fs.target network.target
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Type=simple
|
|
|
|
|
KillMode=none
|
|
|
|
|
ExecStart=/usr/bin/mergerfs \
|
|
|
|
|
-f \
|
|
|
|
|
-o cache.files=off \
|
2025-03-11 23:30:13 -05:00
|
|
|
-o category.create=pfrd \
|
2025-03-30 16:30:36 -05:00
|
|
|
-o func.getattr=newest \
|
2024-12-23 22:12:26 -06:00
|
|
|
-o dropcacheonclose=false \
|
|
|
|
|
/mnt/hdd0:/mnt/hdd1 \
|
|
|
|
|
/media
|
|
|
|
|
ExecStop=/bin/fusermount -uz /media
|
|
|
|
|
Restart=on-failure
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=default.target
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### systemd (w/ setup script)
|
|
|
|
|
|
|
|
|
|
Since it isn't well documented otherwise: if you wish to do some setup before
|
|
|
|
|
you mount mergerfs follow this example.
|
|
|
|
|
|
|
|
|
|
#### setup-for-mergerfs
|
|
|
|
|
|
|
|
|
|
`/usr/local/bin/setup-for-mergerfs`
|
|
|
|
|
|
|
|
|
|
```shell title="setup-for-mergerfs" linenums="1"
|
|
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
|
|
# Perform setup
|
|
|
|
|
/bin/sleep 10
|
|
|
|
|
|
|
|
|
|
# Report back to systemd that things are ready
|
|
|
|
|
/bin/systemd-notify --ready
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### setup-for-mergerfs.service
|
|
|
|
|
|
|
|
|
|
`/etc/systemd/system/setup-for-mergerfs.service`
|
|
|
|
|
|
|
|
|
|
```systemd title="setup-for-mergerfs.service" linenums="1"
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=mergerfs setup service
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Type=notify
|
|
|
|
|
RemainAfterExit=yes
|
|
|
|
|
ExecStart=/usr/local/bin/setup-for-mergerfs
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=default.target
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### mergerfs-media.service
|
|
|
|
|
|
|
|
|
|
`/etc/systemd/system/mergerfs-media.service`
|
|
|
|
|
|
|
|
|
|
```systemd title="mergerfs-media.service" linenums="1"
|
|
|
|
|
[Unit]
|
|
|
|
|
Description=mergerfs /media service
|
|
|
|
|
Requires=setup-for-mergerfs.service
|
|
|
|
|
After=local-fs.target network.target prepare-for-mergerfs.service
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Type=simple
|
|
|
|
|
KillMode=none
|
|
|
|
|
ExecStart=/usr/bin/mergerfs \
|
|
|
|
|
-f \
|
|
|
|
|
-o cache.files=off \
|
2025-03-11 23:30:13 -05:00
|
|
|
-o category.create=pfrd \
|
2025-03-30 16:30:36 -05:00
|
|
|
-o func.getattr=newest \
|
2024-12-23 22:12:26 -06:00
|
|
|
-o dropcacheonclose=false \
|
|
|
|
|
/mnt/hdd0:/mnt/hdd1 \
|
|
|
|
|
/media
|
|
|
|
|
ExecStop=/bin/fusermount -uz /media
|
|
|
|
|
Restart=on-failure
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=default.target
|
|
|
|
|
```
|