To install the ZFS utility Sanoid on TrueNAS systems, which do not permit user-installed packages.
Tested on:
- TrueNAS Scale 24.04.2
This script:
- Mounts /usr dataset, makes
apt
executable apt update
for new repo lists, but noupgrade
- Install Sanoid dependencies (only those not found already in the TrueNAS distro)
- Normal Sanoid installation steps recommended for Linux distros, including Sanoid, Syncoid and Findoid
- Downloads Sanoid from Github
- Copies the Sanoid executables to /usr/local/sbin
- Creates a systemd service for sanoid, sanoid pruning and a timer for it to run every 15 minutes
- (Optional) Symlinks
sanoid.conf
to a location in a user's home directory, to preserve it from being lost - Cleans up after itself: returns
apt
to unexecutable, /usr to read-only and deletes downloaded repo
Please read the source to confirm its operation before using.
- Take a configuration backup of your TrueNAS system first.
- Download the script (in this gist):
wget https://gist.github.com/seb26/962315ef04ef842b0217f1318174139d/raw/0a3cc86572aa8e3e089e549d4693c2737821b6cd/truenas-install-sanoid.sh
nano truenas-install-sanoid.sh
- Optionally (but recommended) edit the script and fill in the option
SANOID_HOME_CONFIG_PATH
.
# Insert an absolute path (no ~ tilde)
SANOID_HOME_CONFIG_PATH=/home/username/.config/sanoid/sanoid.conf
When specifying this, /etc/sanoid/sanoid.conf
will be symlinked to the home path you specify and Sanoid will read it from there. Therefore, you can maintain it/back it up in your home directory, in the event of a system upgrade.
By default, SANOID_HOME_CONFIG_PATH
is empty and no symlink will be created. A Sanoid config will be expected at /etc/sanoid/sanoid.conf
.
- Make the script executable, then execute it as sudo:
chmod +x truenas-install-sanoid.sh
sudo ./truenas-install-sanoid.sh
- Watch for any error output.
- Confirm sanoid services are operating fine:
systemctl status sanoid.service
systemctl status sanoid-prune.service
systemctl status sanoid.timer
When you update TrueNAS, it is most likely (but I'm not sure) that the Sanoid binaries and configuration will be lost.
You would need to run the script again to reinstall Sanoid.
Ideally, you have created a backup of your /etc/sanoid/sanoid.conf
. Or you have specified a path at SANOID_HOME_CONFIG_PATH
and maintain this config file in your home directory.
- jimsalterjrs/sanoid on GitHub and Sanoid Wiki
- sanoid/INSTALL.md