From owner-freebsd-questions@freebsd.org  Fri Oct  1 21:28:23 2021
Return-Path: <owner-freebsd-questions@freebsd.org>
Delivered-To: freebsd-questions@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id E26696B6786
 for <freebsd-questions@mailman.nyi.freebsd.org>;
 Fri,  1 Oct 2021 21:28:23 +0000 (UTC) (envelope-from
 4250.82.1d4d40006635d6a.2771f05be17fe4266ff3a878638d009f@email-od.com)
Received: from s1-b0c6.socketlabs.email-od.com
 (s1-b0c6.socketlabs.email-od.com [142.0.176.198])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 4HLjs30QgZz3Kq7
 for <freebsd-questions@freebsd.org>; Fri,  1 Oct 2021 21:28:23 +0000 (UTC)
 (envelope-from
 4250.82.1d4d40006635d6a.2771f05be17fe4266ff3a878638d009f@email-od.com)
DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim;
 c=relaxed/relaxed; q=dns/txt; t=1633123703; x=1635715703;
 h=content-transfer-encoding:content-type:mime-version:references:in-reply-to:message-id:subject:cc:to:from:date:x-thread-info;
 bh=qRZXjR/BGNZ3YaJCigGe3F0Crh2I8PgfYTFy4Lo0O2A=;
 b=VLa7809/OAF3hEHU7A96DsrTomtHwxQr0n0iuOnzxCGIGVSv/DxlZAeQHW9c2zAyKkHiSfIvOFnxXpSBiJ1PLyaw0VXsP2yR8nUKxaJzB3ei50A8/Qc7nJ5/cfv2N0qZTf4DhYtUDw+uHmfFJl3SumPjjToEAK3RV0QOwF/AZwQ=
X-Thread-Info: NDI1MC4xMi4xZDRkNDAwMDY2MzVkNmEuZnJlZWJzZC1xdWVzdGlvbnM9ZnJlZWJzZC5vcmc=
Received: from r1.us-east-2.aws.in.socketlabs.com
 (r1.us-east-2.aws.in.socketlabs.com [142.0.189.1]) by mxsg2.email-od.com
 with ESMTP(version=Tls12 cipher=Aes256 bits=256);
 Fri, 1 Oct 2021 17:28:18 -0400
Received: from smtp.lan.sohara.org (EMTPY [185.202.17.215]) by
 r1.us-east-2.aws.in.socketlabs.com
 with ESMTP(version=Tls12 cipher=Aes256 bits=256);
 Fri, 1 Oct 2021 17:28:18 -0400
Received: from [192.168.63.1] (helo=steve.lan.sohara.org)
 by smtp.lan.sohara.org with smtp (Exim 4.94.2 (FreeBSD))
 (envelope-from <steve@sohara.org>)
 id 1mWQ4m-00013s-PO; Fri, 01 Oct 2021 22:28:16 +0100
Date: Fri, 1 Oct 2021 22:28:16 +0100
From: Steve O'Hara-Smith <steve@sohara.org>
To: tech-lists <tech-lists@zyxst.net>
Cc: freebsd-questions@freebsd.org
Subject: Re: zfs q regarding backup strategy
Message-Id: <20211001222816.a36e9acbd4e8829aed3afb68@sohara.org>
In-Reply-To: <YVcXsF5NFq2abE+7@ceres.zyxst.net>
References: <YVZM1HnPuwIUQpah@ceres.zyxst.net>
 <ba54a415-da45-e662-73fe-65702c4131e2@holgerdanske.com>
 <YVcXsF5NFq2abE+7@ceres.zyxst.net>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd12.1)
X-Clacks-Overhead: "GNU Terry Pratchett"
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Rspamd-Queue-Id: 4HLjs30QgZz3Kq7
X-Spamd-Bar: --
Authentication-Results: mx1.freebsd.org;
 dkim=pass header.d=email-od.com header.s=dkim header.b="VLa7809/";
 dmarc=none; spf=pass (mx1.freebsd.org: domain of
 4250.82.1d4d40006635d6a.2771f05be17fe4266ff3a878638d009f@email-od.com
 designates 142.0.176.198 as permitted sender)
 smtp.mailfrom=4250.82.1d4d40006635d6a.2771f05be17fe4266ff3a878638d009f@email-od.com
X-Spamd-Result: default: False [-2.70 / 15.00]; MID_RHS_MATCH_FROM(0.00)[];
 ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[email-od.com:s=dkim];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[];
 TO_DN_SOME(0.00)[]; MV_CASE(0.50)[];
 R_SPF_ALLOW(-0.20)[+ip4:142.0.176.0/20];
 MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sohara.org];
 NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[4];
 TO_MATCH_ENVRCPT_SOME(0.00)[];
 DKIM_TRACE(0.00)[email-od.com:+]; RCPT_COUNT_TWO(0.00)[2];
 RCVD_IN_DNSWL_NONE(0.00)[142.0.189.1:received];
 NEURAL_HAM_SHORT(-1.00)[-1.000];
 FORGED_SENDER(0.30)[steve@sohara.org,4250.82.1d4d40006635d6a.2771f05be17fe4266ff3a878638d009f@email-od.com];
 RWL_MAILSPIKE_POSSIBLE(0.00)[142.0.176.198:from];
 MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[];
 ASN(0.00)[asn:7381, ipnet:142.0.176.0/22, country:US];
 FROM_NEQ_ENVFROM(0.00)[steve@sohara.org,4250.82.1d4d40006635d6a.2771f05be17fe4266ff3a878638d009f@email-od.com];
 MAILMAN_DEST(0.00)[freebsd-questions];
 DWL_DNSWL_NONE(0.00)[email-od.com:dkim]
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Oct 2021 21:28:23 -0000

On Fri, 1 Oct 2021 15:14:08 +0100
tech-lists <tech-lists@zyxst.net> wrote:

> What I'm looking for is something (ideally) written in sh. Or even perl.
> But even before that, need to understand incremental backups properly.
> Basically the backup needs to be (effectively) write-only. By that, I
> mean only added to.

	With zfs send every stream is a send up to some 'target' snapshot,
a full stream is the complete history while an incremental stream is from
an earlier 'source' snapshot.

	It is therefore necessary for any successful incremental backup
system to know what the last snapshot sent was so that the next cycle can
start by creating a new snapshot and sending the increment from the last
sent to the latest. On the receiving end the options are to either store
each send as a file named in such a way as to make it obvious what order to
process them in should restore be needed or (more usefully) to use zfs recv
to load them into filesystems in a pool on the receiving machine. If you do
this there will be no pruning of the received snapshots unless you set
something up to do it.

	This sounds nice and simple and is the basis of most homebrew and
packaged zfs replication systems - proper error handling is *difficult*
especially handling errors in the zfs recv phase. Also there is the
irritating detail that one of the properties of a ZFS filesystem is its
mount point and while you can run zfs recv in such a way as not to mount
the received filesystems they will get mounted on reboot which makes
backing up several root filesystems to an archive server a little tricky! 

	The bad news is that I haven't found a solution I really like,
zrepl comes close but it solves that last problem by dropping *all* the zfs
properties in the archive and I'm pretty sure it ignores some error
conditions that eventually lead to an incomplete backup. What I really want
is a rok solid reliable archive server with all the hierarchies archived
mounted read only under something like /archive/<source>/. I haven't got it
yet.

-- 
Steve O'Hara-Smith <steve@sohara.org>