ZFS for Dummies
I recently rebuilt a load of infrastructure (mainly LAMP servers) and decided to back them all with ZFS on Linux for the benefit of efficient backup replication and encryption.<p>I&#x27;ve been using ZFS in combination with rsync for backups for a long time, so I was fairly comfortable with it... and it all worked out, but it was a way bigger time sink than I expected - because I wanted to do it right - and there is a <i>lot</i> of misleading advice on the web, particularly when it comes to running databases and replication.<p>For databases (you really should at minimum do basic tuning like block size alignment), by far the best resource I found for mariadb&#x2F;innoDB is from the lets encrypt people [0]. They give reasons for everything and cite multiple sources, which is gold. If you search around the web elsewhere you will find endless contradicting advice, anecdotes and myths that are accompanied with incomplete and baseless theories. Ultimately you should also test this stuff and understand everything you tune (it&#x27;s ok to decide to not tune something).<p>For replication, I can only recommend the man pages... yeah, really! ZFS gives you solid replication tools, but they are too agnostic, they are like git pluming, they don&#x27;t assume you&#x27;re going to be doing it over SSH (even though that&#x27;s almost always how it&#x27;s being used)... so you have to plug it together yourself, and this feels scary at first, especially because you probably want it to be automated, which means considering edge cases... which is why everyone runs to something like syncoid, but there&#x27;s something horrible I discovered with replication scripts like syncoid, which is that they don&#x27;t use ZFS&#x27;s send --replication mode! They try to reimplement it in perl, for &quot;greater flexibility&quot;, but incompletely. This is maddening when you are trying to test this stuff for the first time and find that all of the encryption roots break when you do a fresh restore, and not all dataset properties are automatically synced. ZFS takes care of all of this if you simply use the build in recursive &quot;replicate&quot; option. It&#x27;s not that hard to script manually once you commit to it, just keep it simple, don&#x27;t add a bunch of unnecessary crap into the pipeline like syncoid does, (they actually slow it down if you test), just use pv to monitor progress and it will fly.<p>I might publish my replication scripts at some point because I feel like there are no good functional reference scripts for this stuff that deal with the basics without going nuts and reinventing replication badly like so many others.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;letsencrypt&#x2F;openzfs-nvme-databases">https:&#x2F;&#x2F;github.com&#x2F;letsencrypt&#x2F;openzfs-nvme-databases</a>