### Setup MkDocs Project Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/README.md Commands to create a virtual environment, activate it, install MkDocs and related packages, and serve the documentation locally. ```bash python3 -m venv venv source venv/bin/activate pip3 install --no-cache-dir mkdocs mkdocs-material pymdown-extensions mike mike serve ``` -------------------------------- ### Mergerfs Setup Script for Systemd Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/quickstart.md An example script (setup-for-mergerfs) to perform setup tasks before mounting mergerfs, used in conjunction with a systemd service. It uses systemd-notify to signal readiness. ```shell #!/usr/bin/env sh # Perform setup /bin/sleep 10 # Report back to systemd that things are ready /bin/systemd-notify --ready ``` -------------------------------- ### Compare mhddfs and mergerfs Setup Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/project_comparisons.md Example of setting up mhddfs and mergerfs for similar pooling behavior. Note the different options used for drive pooling and space management. ```bash mhddfs -o mlimit=4G,allow_other /mnt/drive1,/mnt/drive2 /mnt/pool ``` ```bash mergerfs -o minfreespace=4G,category.create=ff /mnt/drive1:/mnt/drive2 /mnt/pool ``` -------------------------------- ### Install Entware for x64 Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS Install Entware using the generic script for x64 processors. ```bash wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh ``` -------------------------------- ### Install Entware for armv5 Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS Install Entware using the generic script for armv5 processors. ```bash wget -O - http://bin.entware.net/armv5sf-k3.2/installer/generic.sh | /bin/sh ``` -------------------------------- ### Install attr package Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/runtime_interface.md Install the attr package to get getfattr and setfattr tools on Debian/Ubuntu systems. ```bash $ sudo apt-get install attr ``` -------------------------------- ### Install Entware for armv7 Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS Install Entware using the generic script for armv7 processors. ```bash wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh ``` -------------------------------- ### Build Debian/Ubuntu Package Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/build.md Install build dependencies, build a Debian package, and install it. ```bash $ cd mergerfs $ sudo buildtools/install-build-pkgs $ make deb $ sudo dpkg -i ../mergerfs__.deb ``` -------------------------------- ### mergerfs Runtime Configuration Example Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/runtime_interface.md Demonstrates retrieving and setting mergerfs runtime configurations, including branches and category create settings. ```bash [trapexit:/mnt/mergerfs] $ getfattr -d .mergerfs user.mergerfs.branches="/mnt/a=RW:/mnt/b=RW" user.mergerfs.minfreespace="4294967295" user.mergerfs.moveonenospc="false" ... [trapexit:/mnt/mergerfs] $ getfattr -n user.mergerfs.category.create .mergerfs user.mergerfs.category.search="mfs" [trapexit:/mnt/mergerfs] $ setfattr -n user.mergerfs.category.create -v pfrd .mergerfs [trapexit:/mnt/mergerfs] $ getfattr -n user.mergerfs.category.create .mergerfs user.mergerfs.category.search="prfd" [trapexit:/mnt/mergerfs] $ setfattr -n user.mergerfs.branches -v '+ for your specific OpenSUSE release. ```bash zypper addrepo https://download.opensuse.org/repositories/filesystems//filesystems.repo zypper refresh zypper install mergerfs ``` -------------------------------- ### Configure mergerfs Mount Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS Example mergerfs configuration. Adjust file paths and options according to your specific setup. The 'nonempty' option can be used if the destination directory already contains files like Synology's @eaDir. ```bash mergerfs -o rw,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff,dropcacheonclose=true /volume1/Media/TempMedia:/volume1/Media/GMedia /volume1/Media/FinalMedia ``` -------------------------------- ### Systemd Service for Setup Script Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/quickstart.md A systemd service file (setup-for-mergerfs.service) that runs a setup script before other services. It uses Type=notify to indicate completion. ```systemd [Unit] Description=mergerfs setup service [Service] Type=notify RemainAfterExit=yes ExecStart=/usr/local/bin/setup-for-mergerfs [Install] WantedBy=default.target ``` -------------------------------- ### Verify mergerfs Installation Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS Check if the mergerfs binary is installed correctly by listing the contents of the /opt/bin directory and running the help command. ```bash sudo ls /volume1/@Entware/opt/bin ``` ```bash mergerfs --help ``` -------------------------------- ### Install mergerfs on Debian/Ubuntu Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/installation.md Download and install the .deb package for Debian or Ubuntu. Replace , , and with the appropriate version, release, and architecture. ```bash wget https://github.com/trapexit/mergerfs/releases/download//mergerfs_.debian-_.deb sudo dpkg -i mergerfs_.debian-_.deb ``` -------------------------------- ### Install mergerfs using static Linux binaries Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/installation.md Download the static binary tarball and extract it to the root directory. Replace and with the appropriate version and architecture. ```bash wget https://github.com/trapexit/mergerfs/releases/download//mergerfs-static-linux_.tar.gz sudo tar xvf mergerfs-static-linux_.tar.gz -C / ``` -------------------------------- ### Systemd Service for Mergerfs with Setup Script Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/quickstart.md A systemd service file for mergerfs that depends on a setup script (setup-for-mergerfs.service) to ensure prerequisites are met before mounting. It includes Requires and After directives. ```systemd [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 \ -o category.create=pfrd \ -o func.getattr=newest \ -o dropcacheonclose=false \ /mnt/hdd0 \ /mnt/hdd1 \ /media ExecStop=/usr/bin/umount /media # Or if you need fusermount # ExecStop=/usr/bin/mergerfs-fusermount -u /media Restart=on-failure [Install] WantedBy=default.target ``` -------------------------------- ### Install mergerfs on Fedora Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/installation.md Download and install the RPM package for Fedora. Replace , , and with the appropriate version, release, and architecture. ```bash wget https://github.com/trapexit/mergerfs/releases/download//mergerfs-.fc..rpm sudo rpm -i mergerfs-.fc..rpm ``` -------------------------------- ### Install mergerfs using apt Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/installation.md Install mergerfs using the apt package manager. This is a simple command for Debian-based systems. ```bash sudo apt install -y mergerfs ``` -------------------------------- ### Mergerfs Symlink Setup for Branches Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/quickstart.md Illustrates how to set up symlinks for mergerfs branches, which mergerfs will resolve to use the real paths. This is useful when using wildcard paths in fstab. ```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 ``` -------------------------------- ### Install mergerfs on Ubuntu (non-LTS) Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/installation.md Download and install the .deb package for Ubuntu, potentially using a release most closely related to your non-LTS version. Replace , , , and accordingly. ```bash wget https://github.com/trapexit/mergerfs/releases/download//mergerfs_.ubuntu-_.deb sudo dpkg -i mergerfs_.ubuntu-_.deb ``` -------------------------------- ### Build on Generic Linux Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/build.md Compile and install mergerfs on a generic Linux system with required tools. ```bash $ cd mergerfs $ make $ sudo make install ``` -------------------------------- ### Build on FreeBSD Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/build.md Compile and install mergerfs on FreeBSD with required tools. ```bash $ cd mergerfs $ gmake $ gmake install # as root ``` -------------------------------- ### Systemd Service for Mergerfs (Simple) Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/quickstart.md A basic systemd service file to mount mergerfs on boot. It includes unit, service, and install sections for managing the mergerfs mount. ```systemd [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 \ -o category.create=pfrd \ -o func.getattr=newest \ -o dropcacheonclose=false \ /mnt/hdd0 \ /mnt/hdd1 \ /media ExecStop=/usr/bin/umount /media # Or if you need fusermount # ExecStop=/usr/bin/mergerfs-fusermount -u /media Restart=on-failure [Install] WantedBy=default.target ``` -------------------------------- ### Mergerfs Autostart Script Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS This script ensures mergerfs is mounted and started automatically on system boot, using the specified configuration options and paths. ```bash #!/bin/sh /opt/bin/mergerfs -o rw,use_ino,allow_other,func.getattr=newest,category.action=all,category.create=ff,dropcacheonclose=true /volume1/Media/TempMedia:/volume1/Media/GMedia /volume1/Media/FinalMedia ``` -------------------------------- ### Prepare /opt Directory for Entware Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS Remove the existing /opt directory and create a new one, then bind mount the Entware directory to /opt. ```bash rm -rf /opt mkdir /opt mount -o bind "/volume1/@Entware/opt" /opt ``` -------------------------------- ### Build Options for mergerfs Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/build.md Demonstrates how to use make to build mergerfs with specific options. ```bash $ make help usage: make make USE_XATTR=0 - build program without xattrs functionality make STATIC=1 - build static binary make LTO=1 - build with link time optimization ``` -------------------------------- ### Entware Autostart Script Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS This script ensures Entware is mounted and started on boot, and adds its profile to the global profile for system-wide access. It also updates the Entware package list. ```bash #!/bin/sh # Mount/Start Entware mkdir -p /opt mount -o bind "/volume1/@Entware/opt" /opt /opt/etc/init.d/rc.unslung start # Add Entware Profile in Global Profile if grep -qF '/opt/etc/profile' /etc/profile; then echo "Confirmed: Entware Profile in Global Profile" else echo "Adding: Entware Profile in Global Profile" cat >> /etc/profile <<"EOF" # Load Entware Profile [ -r "/opt/etc/profile" ] && . /opt/etc/profile EOF fi # Update Entware List /opt/bin/opkg update ``` -------------------------------- ### Build RHEL/CentOS/Rocky/Fedora Package Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/build.md Install build dependencies, build an RPM package, and install it. ```bash $ su - # cd mergerfs # buildtools/install-build-pkgs # make rpm # rpm -i rpmbuild/RPMS//mergerfs-..rpm ``` -------------------------------- ### Collect System Information with mergerfs.collect-info Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/tooling.md Run this tool to gather system and configuration details for support requests. Ensure mergerfs is mounted before execution and upload the generated file. ```text $ mergerfs.collect-info * Please have mergerfs mounted before running this tool. * Upload the following file to your GitHub ticket or put on https://pastebin.com when requesting support. * /tmp/mergerfs.info.txt ``` -------------------------------- ### Install mergerfs on FreeBSD Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/installation.md Install mergerfs on FreeBSD using the pkg package manager. ```bash pkg install filesystems/mergerfs ``` -------------------------------- ### Install Entware for armv8 (aarch64) Source: https://github.com/trapexit/mergerfs/wiki/Installing-MergerFS-on-a-Synology-NAS Install Entware using the generic script for Realtek RTD129x processors (armv8/aarch64). ```bash wget -O - http://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/sh ``` -------------------------------- ### Mergerfs fstab Configuration Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/quickstart.md Shows how to configure mergerfs using the /etc/fstab file, including an example with options directly in fstab and another using a separate configuration file. ```fstab /mnt/hdd0:/mnt/hdd1 /media mergerfs cache.files=off,category.create=pfrd,func.getattr=newest,dropcacheonclose=false 0 0 ``` ```fstab /etc/mergerfs/branches/media/* /media mergerfs config=/etc/mergerfs/config/media.ini ``` -------------------------------- ### Install mergerfs on CentOS/Rocky Linux Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/setup/installation.md Download and install the RPM package for CentOS or Rocky Linux. Replace , , and with the appropriate version, release, and architecture. ```bash wget https://github.com/trapexit/mergerfs/releases/download//mergerfs-.el..rpm sudo rpm -i mergerfs-.el..rpm ``` -------------------------------- ### Enable IO Passthrough with preload.so Source: https://github.com/trapexit/mergerfs/blob/master/mkdocs/docs/tooling.md This experimental library overrides file creation and opening to simulate passthrough IO, potentially offering near-native performance. It works with dynamically linked software and may not function with statically compiled applications. ```sh LD_PRELOAD=/usr/lib/mergerfs/preload.so touch /mnt/mergerfs/filename ```