4.2 KiB
Installation
Sanoid and Syncoid are complementary but separate pieces of software. To install and configure them, follow the guide below for your operating system. Everything in code blocks
should be copy-pasteable. If your OS isn't listed, a set of general instructions is at the end of the list and you can perform the process manually.
Ubuntu
Install prerequisite software:
apt install libconfig-inifiles-perl pv lzop mbuffer
CentOS
Install prerequisite software:
# Install and enable epel if we don't already have it, and git too
sudo yum install -y epel-release git
# Install the packages that Sanoid depends on:
sudo yum install -y perl-Config-IniFiles perl-Data-Dumper lzop mbuffer mhash pv
Clone this repo, then put the executables and config files into the appropriate directories:
# Download the repo as root to avoid changing permissions later
sudo git clone https://github.com/jimsalterjrs/sanoid.git
cd sanoid
# Install the executables
sudo cp sanoid syncoid findoid sleepymutex /usr/local/sbin
# Create the config directory
sudo mkdir /etc/sanoid
# Install default config
sudo cp sanoid.defaults.conf /etc/sanoid
# Create a blank config file
sudo touch /etc/sanoid/sanoid.conf
# Place the sample config in the conf directory for reference
sudo cp sanoid.conf /etc/sanoid/sanoid.example.conf
Create a systemd service:
cat << "EOF" | sudo tee /etc/systemd/system/sanoid.service
[Unit]
Description=Snapshot ZFS Pool
Requires=zfs.target
After=zfs.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/sanoid --cron
EOF
And a systemd timer that will execute Sanoid once per minute:
cat << "EOF" | sudo tee /etc/systemd/system/sanoid.timer
[Unit]
Description=Run Sanoid Every Minute
Requires=sanoid.service
[Timer]
OnCalendar=*:0/1
Persistent=true
[Install]
WantedBy=timers.target
EOF
Reload systemd and start our timer:
# Tell systemd about our new service definitions
sudo systemctl daemon-reload
# Enable and start the Sanoid timer
sudo systemctl enable sanoid.timer
sudo systemctl start sanoid.timer
Now, proceed to configure Sanoid
FreeBSD
Install prerequisite software:
pkg install p5-Config-Inifiles pv lzop
Additional notes:
-
FreeBSD may place pv and lzop in somewhere other than /usr/bin — syncoid currently does not check path.
-
Simplest path workaround is symlinks, eg
ln -s /usr/local/bin/lzop /usr/bin/lzop
or similar, as appropriate to create links in /usr/bin to wherever the utilities actually are on your system.
Other OSes
Sanoid depends on the Perl module Config::IniFiles and will not operate without it. Config::IniFiles may be installed from CPAN, though the project strongly recommends using your distribution's repositories instead.
Syncoid depends on ssh, pv, gzip, lzop, and mbuffer. It can run with reduced functionality in the absence of any or all of the above. SSH is only required for remote synchronization. On newer FreeBSD and Ubuntu Xenial chacha20-poly1305@openssh.com, on other distributions arcfour crypto is the default for SSH transport since v1.4.6. Syncoid runs will fail if one of them is not available on either end of the transport.
General outline for installation
- Install prerequisites: Perl module Config::IniFiles, ssh, pv, gzip, lzop, and mbuffer
- Download the Sanoid repo
- Create the config directory
/etc/sanoid
and putsanoid.defaults.conf
in there, and createsanoid.conf
in it too - Create a cron job or a systemd timer that runs
sanoid --cron
once per minute
Configuration
Sanoid won't do anything useful unless you tell it how to handle your ZFS datasets in /etc/sanoid/sanoid.conf
.
Syncoid is a command line utility that doesn't require any configuration, with all of its switches set at runtime.
Sanoid
Instructions on how to set up sanoid.conf
. Maybe just copy/paste the example sanoid.conf
file in here but clean it up a little bit.