I use sanoid for snapshots and would like to replicate them with syncoid to a truenas system. There I want to use sanoid for pruning. The snapshots are produced by sanoid with its naming convention, and are best processed with sanoid. This system has worked well over the years, and I prefer to use the same tool in truenas.
But Truenas does not allow installation via apt. I searched online and it seems there is no easy way to install sanoid.
On the other hand, sanoid is a bash script. Any issue if I copy sanoid script to truenas and use it that way?
If it has dependencies like Perl packages, how should those be installed and will there be any problems?
I think sanoid is mostly Perl, BTW. Github says 84.4% Perl and 15.2% shell. /pedantic
Edit: I once needed to install it in an environment that had ZFS built from scratch. The .deb required the ZFS module. I forked the repo to remove that dependency but young Mr. Salter explained that all I needed to do was copy a couple Perl scripts to somewhere in my path.
The dependencies are: Perl module Config::IniFiles, ssh, pv, gzip, lzop, and mbuffer.
How to install these modules safely and in a persistent manner in truenas that thinks of itself as an appliance and doesn’t even include apt package manager?
The difficult dependencies to fill are the two perl modules, capture::tiny and config::inifiles. In most cases, you fulfill those dependencies from distribution repos. But the TrueNAS repos are pared down to the bone, so what you probably want to do is use CPAN.
If you wanted to run syncoid directly on your TrueNAS box, you’d also want to provide pv, lzop, and mbuffer–most likely, by copying binaries from a FreeBSD box. But if all you need is sanoid, all you need are the two perl modules.
But if all you need is sanoid, all you need are the two perl modules.
That’s how I got sanoid running on my TrueNAS box. My build of sanoid-portable includes just those two perl dependencies, plus the Perl runtime (I forgo the rest of the optional dependencies pv, lzop, mbuffer). That’s enough to get sanoid running on TrueNAS without installing any extra packages. Syncoid on TrueNAS has been pulling snapshots just fine for me without those extra tools.
I tried different ways and couldn’t install dependencies. TrueNAS doesn’t allow installation of the Perl modules or most other software on host (in some cases one could proceed with builds but ends up with errors). The recommendation is to install software in containers, which works for 99% of applications but not Sanoid that has to manage file system snapshots.
A static binary from Sanoid project or TrueNAS would be great for NAS operating systems! Ideally, TrueNAS could support Sanoid and its config format.
The way I used to deal with this kind of thing in FreeNAS/TrueNAS was to create a utility jail and install whatever I wanted there. Then I’d add the jail’s /usr/local/bin directory to my TrueNAS user’s $PATH.