<?xml version="1.0"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:html="http://www.w3.org/1999/xhtml">
  <atom:id>http://bill.welliver.org/atom/smartos/zfsbackup-go</atom:id>
  <atom:title type="text">electronic.alchemy :: zfsbackup-go on SmartOS to BackBlaze B2</atom:title>
  <atom:updated>2026-05-01T04:41:09-04:00</atom:updated>
  <atom:link href="http://bill.welliver.org/atom/smartos/zfsbackup-go" type="application/atom+xml"></atom:link>
  <atom:link href="http://bill.welliver.org/space/smartos/zfsbackup-go" type="text/html"></atom:link>
  <atom:link href="http://bill.welliver.org/rss/smartos/zfsbackup-go" type="application/rss+xml"></atom:link>
  <atom:generator uri="http://modules.gotpike.org/blahblah/Public.Syndication.ATOM" version="0.1">Public.Syndication.ATOM (Pike v8.0 release 702)</atom:generator>
  <atom:icon>http://bill.welliver.org/favicon.ico</atom:icon>
  <atom:logo>http://bill.welliver.org/static/images/alchemy.gif</atom:logo>
  <atom:subtitle type="xhtml"><html:div xmlns:html="http://www.w3.org/1999/xhtml"><html:a href="https://github.com/someone1/zfsbackup-go">zfsbackup-go</html:a> is a utility that can be used to backup ZFS snapshots to cloud storage such as Google, Amazon or B2. This is a handy way to get offsite backups if you're already using ZFS snapshots to back up your data.&#xD;
<html:p>&#xD;
</html:p>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:p class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		I'm using zfsbackup-go to back up my existing SmartOS(illumos) ZFS snapshots offsite to BackBlaze B2. There were a few little tweaks that needed to be made to get things built and working on SmartOS; the B2 parts are not SmartOS specific and are mostly down to less than stellar documentation.&#xD;
		<html:br/>&#xD;
	</html:p>&#xD;
	<html:h3>&#xD;
		Building zfsbackup-go on SmartOS&#xD;
	</html:h3>&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
Build the utility on a standard native zone with pkgsrc-trunk. The resulting binary can be copied to the GZ later, if desired.&#xA0;&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:pre class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
pkgin in go113&#xA0; &#xD;
ln -s /opt/local/bin/go113 /opt/local/bin/go&#xA0;&#xA0; &#xD;
GOPATH=/root/go&#xA0; &#xD;
export GOPATH &#xD;
go get <html:a class="Hyperlink SCXO55334023 BCX2" href="https://github.com/someone1/zfsbackup-go" rel="noreferrer" target="_blank">https://github.com/someone1/zfsbackup-go</html:a>	&#xD;
</html:pre>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:p class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		I had a minor compilation problem with one or two of the dependencies, but it was easy to fix:&#xA0;&#xD;
	</html:p>&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:p class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		Add solaris to the list of build platforms in:&#xA0;&#xD;
	</html:p>&#xD;
	$GOPATH/go/pkg/mod/github.com/mattn/go-ieproxy@v0.0.0-20190610004146-91bb50d98149/ieproxy_unix.go&#xA0;&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:p class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		and&#xA0;&#xD;
	</html:p>&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:p class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		$GOPATH/go/src/github.com/Azure/azure-storage-blob-go/azblob/zc_mmf_unix.go&#xA0;&#xD;
	</html:p>&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:p class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		Additionally, in zc_mmf_unix.go, change the import of "syscall" to "golang.org/x/sys/unix" and change all the syscall references to unix.&#xD;
	</html:p>&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:h3 class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		SSL Trust Store&#xA0;&#xD;
	</html:h3>&#xD;
	Also, (and I suspect this affects most of the external backup providers) the go SSL implementation has hard coded locations for trust store certificates, and if the trust store can't be found, connections will silently hang without any errors. On SmartOS, you can fix this by running the following: &#xA0;&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:pre>&#xD;
pkgin in mozilla-rootcerts&#xA0; &#xD;
ln -s /opt/local/etc/openssl/ca-certificates.crt \&#xD;
   /etc/ssl/certs/ca-certificates.crt&#xA0; 	&#xD;
</html:pre>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:h2 class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		BackBlaze B2&#xA0;&#xD;
	</html:h2>&#xD;
</html:div>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
	<html:p class="Paragraph SCXO55334023 BCX2" lang="EN-US" style="background-color: transparent; font-style: normal; font-weight: normal; text-align: left; vertical-align: baseline;">&#xD;
		You'll need to set two environment variables containing your B2 account and key information. There's surprisingly little information about what these values are, so after extensive trial and error, here's where they seem to come from:&#xA0;&#xD;
	</html:p>&#xD;
</html:div>&#xD;
<html:b>B2_ACCOUNT_ID</html:b>: this is the <html:i>keyID </html:i>value displayed when you create a new application key in the B2 admin interface. You can see this listed with each application key later.&#xA0;&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:br/>&#xD;
<html:b>B2_ACCOUNT_KEY</html:b>: this is the&#xA0;<html:i>applicationKey </html:i>value displayed when you create a new application key in the B2 interface. This value is only displayed once and should be saved for use later.&#xA0;&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:h2>&#xD;
	Usage&#xD;
</html:h2>&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
The documentation for this tool isn't the best, I'm sure there are better ways to do this. However, I'm mostly interested in sending a full backup offsite. &#xA0;&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:br/>&#xD;
This assumes you're using B2, that you've got a bucket created and an application key generated that has access to the desired bucket. I'm also encrypting my backups for good measure; for this you'll need a PGP keyring with a keypair. There are lots of discussions of this elsewhere, so I leave that as an exercise to the reader.&#xA0;&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:br/>&#xD;
Here's the command I'm using (assuming the snapshot already exists):&#xA0;&#xD;
<html:div class="OutlineElement Ltr  BCX2 SCXO55334023" style="direction: ltr; margin-left: 0px;">&#xD;
</html:div>&#xD;
<html:pre>&#xD;
B2_ACCOUNT_ID=myKeyID \&#xA0; &#xD;
B2_ACCOUNT_KEY=myApplicationKey \&#xA0; &#xD;
/opt/zfsbackup-go send --full -R \&#xD;
    --encryptTo myPGPKey@myDomain \&#xA0; &#xD;
&#xA0; &#xA0; --signFrom myPGPKey@myDomain \&#xD;
    --publicKeyRingPath /zones/images/zfsbackup.pub \&#xA0; &#xD;
&#xA0;&#xA0;&#xA0; --secretKeyRingPath /zones/images/zfsbackup.priv <html:br/>    --logLevel debug \&#xA0; &#xD;
&#xA0;&#xA0;&#xA0; --workingDirectory /zones/images/.zfsbackup \&#xA0; &#xD;
&#xA0;&#xA0;&#xA0; zones b2://hostA-backup-2019/zones&#xD;
	&#xD;
</html:pre>&#xD;
</html:div></atom:subtitle>
</atom:feed>
