Sanoid in TrueNAS

Hello

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?

Are the instructions here https://github.com/jimsalterjrs/sanoid/blob/master/INSTALL.md useful in your environment?

I think sanoid is mostly Perl, BTW. Github says 84.4% Perl and 15.2% shell. /pedantic :winking_face_with_tongue:

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.

2 Likes

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?

1 Like

See GitHub - furicle/Syncoid-Scale: Reinstall Syncoid on TrueNAS Scale after a system update

Perl, not bash.

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.

1 Like

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.

3 Likes

Hey, cool project! Would you like me to link to it from sanoid’s readme?

1 Like

Sure, go for it! I use it myself on many systems so I plan on maintaining it into the future.

I also see now that I need to cut a release of sanoid-portable for sanoid 2.3.0. I’ll get that out shortly.

sanoid-portable 2.3.0-1 is out!

1 Like

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.

1 Like