From owner-freebsd-questions@freebsd.org Sun Oct 3 08:37:05 2021 Return-Path: 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 27D056B3E8E for ; Sun, 3 Oct 2021 08:37:05 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from holgerdanske.com (holgerdanske.com [184.105.128.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "holgerdanske.com", Issuer "holgerdanske.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HMcf76LPHz4fqs for ; Sun, 3 Oct 2021 08:37:03 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=holgerdanske.com; s=nov-20210719-112354; t=1633250212; bh=m3OjyKvKngKeNQbko+L+cv4Ovdy2G36XNVu19U7gG5I=; h=Received:Message-ID:Date:MIME-Version:User-Agent:Subject: Content-Language:To:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; b=MnOuR63A1ckHrAww1NDA3fp4Bax8nRop3WScQZd+DNqrocFhKAMtjerMHXf3/hm3y h39R3ue9astTRHKMMcEZFR1LGDgq3FjVybWd9v5G9MptValppbPGsKxeScFBQAImP8 GIvK3ig2XfP5PWn6Q1f6XVBu7gtFgY7BeHoG6fawQ7nDl2VxWOXTYW6kgODQM4kBzb wg0BPGXl+MR+Zh9otyG6gmFgMEPYuqDj066ZiPXnTD3lL6DXvC2SLgBsW/iIkJ1rtM d31jY16al+fJDzpumrDVfeJ+EZqiJSOld0SleoHSLl7zCbXwlTO0Gvx2qX1ZEWg9Ar RENMAVsaFbhZYU5Uy1H5KLBGJAMP8qh7TFG+p2a4ulNXos/F6zjd9x0UGhjdDcYM6b tJ4I7ahNlggxl2j+ECSl+1+Fu0sO5bSUK7v9J2A7DOw2wiuDWGoyWSgS9gJ6lWu6y6 IWrspRr/Ivg6nkllbqlR0lGS46J1LJZu9cGVEQpqLsr+9aqBkFrLIo8gq2v4m1Fn2P oDdY1JPeNqVPBjVX/ZbH85ufYEIYCw/KhXTxdaoPGt4yu+R6BzCUwzSkYoPF+QrRml p1UCjD4iQwpk46nCDvQLCXWECBGC4lSJ/MWnsFr1f/zj+rxP5vOh7SkRfUsQCNtmGX iqZfhP2hLSPNFQ1xmFJsW424= Received: from 99.100.19.101 (99-100-19-101.lightspeed.frokca.sbcglobal.net [99.100.19.101]) by holgerdanske.com with ESMTPSA (TLS_AES_128_GCM_SHA256:TLSv1.3:Kx=any:Au=any:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username dpchrist@holgerdanske.com, mechanism PLAIN) for ; Sun, 3 Oct 2021 01:36:52 -0700 Message-ID: Date: Sun, 3 Oct 2021 01:36:51 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: zfs q regarding backup strategy Content-Language: en-US To: freebsd-questions@freebsd.org References: <20211001222816.a36e9acbd4e8829aed3afb68@sohara.org> <809e4f3b-9e59-eb53-5b7d-0bcf7e401cd5@holgerdanske.com> <20211002115440.85c4342a49fe6e4573c37dd0@sohara.org> <20211002205504.9d81ee94caa231ee9b008d6a@sohara.org> <69954781-9e3c-ba96-5f1e-9b4043ecf56c@holgerdanske.com> <20211003063353.7415d12917f0e514d433ae1c@sohara.org> From: David Christensen In-Reply-To: <20211003063353.7415d12917f0e514d433ae1c@sohara.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4HMcf76LPHz4fqs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=holgerdanske.com header.s=nov-20210719-112354 header.b=MnOuR63A; dmarc=pass (policy=none) header.from=holgerdanske.com; spf=pass (mx1.freebsd.org: domain of dpchrist@holgerdanske.com designates 184.105.128.27 as permitted sender) smtp.mailfrom=dpchrist@holgerdanske.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[holgerdanske.com:s=nov-20210719-112354]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[holgerdanske.com:+]; DMARC_POLICY_ALLOW(-0.50)[holgerdanske.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:184.104.0.0/15, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 08:37:05 -0000 On 10/2/21 22:33, Steve O'Hara-Smith wrote: > On Sat, 2 Oct 2021 15:09:23 -0700 > David Christensen wrote: > >> Assuming I can create a ZFS pool from one or more ZFS volume datasets >> (?), here is an idea: > > I don't think you can create a pool on top of zvols, I couldn't get > it to work last time I tried. > >> 1. Create a large 'archive' pool. Say, 10 TB. >> >> 2. Within the archive pool, create many small volumes. Say, 100 >> volumes of 100 GB each. > > Why not just split the drives into 100GB partitions with gpart > rather than attempting to nest zpools ? The idea was to do redundancy (mirror, raidzN), caching, etc, once at the bottom level, rather than multiple times (once for each archive-source pool). But if it is not possible to build second-level ZFS pools on top of ZFS volumes on top of a first-level ZFS pool, then GPT partitions and doing it the hard way should work. But first, I would want to research GEOM and see if it can do RAID (I suspect the answer is yes). >> 3. For each source, create a 'archive-source' pool using the 'zpool >> create -R' option and one or more volumes as required for capacity. > > Also record the root mount for use at boot time. Yes. Figuring out where to put this, and the other settings/ data/ logs/ whatever, will be important to usability and to failure survival/ recovery. >> 4. From the archive server, replicate datasets from their respective >> source pools to their corresponding archive-source pools using the 'zfs >> receive -u' option. > > Once you have altroot working then you want the dataset mounted - > read only though. > >> 5. Upon receipt of a replica dataset, save the 'canmount' property (for >> restore). If it is 'on', set it to 'notauto'. > > No need. > >> 6. Upon receipt of a replica dataset, save the 'readonly' property (for >> restore). If it is 'off', set it to 'on'. > > Yes. I suppose the 'zfs receive -u' is overkill if 'altroot' is set properly on the pool, but I am not adverse to another layer of safety when doing sysadmin scripting. I also prefer having explicit control over if/when the replica is mounted. Most of the prior ideas are for the first full replication job of each dataset. More research/ testing/ thinking is needed for ongoing incremental replication jobs. > It is also necessary to check to see whether the target pool has > enough space and if not throw a few more logs on the fire. Yes -- that and probably a dozen more use-cases/ features to get to a minimal, fully-automatic implementation. >> The most obvious problem is if the system crashes between #4 and #5. On >> subsequent boot, AIUI all previously active pools will be automatically >> imported (e.g. without 'altroot') and all datasets with 'canmount=on' >> will be mounted (according to 'mountpoint'). If two or more datasets >> are mounted at the same mount point, the results could be bad. >> 'bootpool' and 'zroot' are likely cases. > > This is where the boot script to restore the altroot settings comes > in - but it has to run before zfs attempts the mounts. Do you have any idea if and what hooks are available during system boot and ZFS setup? STFW I see the following, but will need more information to affect ZFS during boot: https://openzfs.readthedocs.io/en/latest/boot-process.html https://www.unix.com/man-page/freebsd/8/zfsloader/ David