From patchwork Mon Jan 4 01:09:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: raid5atemyhomework X-Patchwork-Id: 26207 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D3CFF27BC0A; Mon, 4 Jan 2021 01:10:16 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 283CC27BC09 for ; Mon, 4 Jan 2021 01:10:16 +0000 (GMT) Received: from localhost ([::1]:58966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwENz-0001jB-A6 for patchwork@mira.cbaines.net; Sun, 03 Jan 2021 20:10:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44240) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwENm-0001id-Us for guix-patches@gnu.org; Sun, 03 Jan 2021 20:10:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwENm-00028w-NK for guix-patches@gnu.org; Sun, 03 Jan 2021 20:10:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kwENm-0003jg-Ie for guix-patches@gnu.org; Sun, 03 Jan 2021 20:10:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45643] [PATCH 3/3] gnu, guix: Support mounting legacy-mounted ZFS in operating-system form. References: In-Reply-To: Resent-From: raid5atemyhomework Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Jan 2021 01:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45643 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: "45643@debbugs.gnu.org" <45643@debbugs.gnu.org> Received: via spool by 45643-submit@debbugs.gnu.org id=B45643.160972259114339 (code B ref 45643); Mon, 04 Jan 2021 01:10:02 +0000 Received: (at 45643) by debbugs.gnu.org; 4 Jan 2021 01:09:51 +0000 Received: from localhost ([127.0.0.1]:39008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kwENb-0003jD-7w for submit@debbugs.gnu.org; Sun, 03 Jan 2021 20:09:51 -0500 Received: from mail4.protonmail.ch ([185.70.40.27]:35108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kwENY-0003iz-R8 for 45643@debbugs.gnu.org; Sun, 03 Jan 2021 20:09:49 -0500 Date: Mon, 04 Jan 2021 01:09:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1609722582; bh=H87PBleY3IgFM5yRiyzugIx+XG1IQXiF0pwTOlb2BPU=; h=Date:To:From:Reply-To:Subject:From; b=DYcRs2p++7LkvChB4nv4XDIZcBCQ53Uox3EVoahAWFRlon83aHMjL3FLYczFwGRva 1u9SClxJkjhZ8PoRmIFYlB4LJfXeMbwB0F5NStpyJlchJTRMVR2K/LMUg5A4UsE/WS R4RTlYtyDOPBlNJqZdIjNoofNXh92WTiQRLcx6LU= Message-ID: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: raid5atemyhomework , raid5atemyhomework via Guix-patches X-Patchwork-Original-From: raid5atemyhomework via Guix-patches via From: raid5atemyhomework X-getmail-retrieved-from-mailbox: Patches From 59c9bd5642e33962798c01f4dcf30be38ead4ab8 Mon Sep 17 00:00:00 2001 From: raid5atemyhomework Date: Mon, 4 Jan 2021 08:22:01 +0800 Subject: [PATCH 3/3] gnu, guix: Support mounting legacy-mounted ZFS in operating-system form. --- doc/guix.texi | 18 ++++++++++++++++++ gnu/build/file-systems.scm | 2 ++ gnu/machine/ssh.scm | 3 +++ gnu/services/base.scm | 5 ++++- guix/scripts/system.scm | 3 +++ 5 files changed, 30 insertions(+), 1 deletion(-) -- 2.29.2 diff --git a/doc/guix.texi b/doc/guix.texi index 4544b481b0..2909674302 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13982,6 +13982,24 @@ mount ZFS pools that have a non-@code{legacy} mountpoint. If ZFS finds mountable ZFS filesystems that are encrypted by passphrase, it will prompt for passphrases on the console. +You should @emph{not} put ZFS datasets with a non-@code{legacy} mountpoint +into the @code{file-systems} field of your @code{operating-sstem}. However, +if you want to declare them in your @code{file-systems} field, you can +set their ZFS mountpoints to @code{legacy} and add a @code{file-system} +declaration for them, using the ZFS pool dataset name as the @code{device} +field: + +@example +zfs set mountpoint=legacy pool/filesystem +@end example + +@lisp +(file-system + (device "pool/filesystem") + (mount-point "/path/to/mountpoint") + (type "zfs")) +@end lisp + You can put @code{/home} on a ZFS filesystem by setting it as the mountpoint of some ZFS filesystem. However, ZFS will refuse to mount onto a non-empty directory, so if you already have an existing diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index ddf6117b67..af75aee2b6 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -828,6 +828,8 @@ containing ':/')." ((string-prefix? "f2fs" type) check-f2fs-file-system) ((string-prefix? "ntfs" type) check-ntfs-file-system) ((string-prefix? "nfs" type) (const 'pass)) + ;; "ZFS doesn't need fsck." + ((string-prefix? "zfs" type) (const 'pass)) (else #f))) (if check-procedure diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 08c653ba17..cdd8913a00 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -175,6 +175,9 @@ exist on the machine." %pseudo-file-system-types)) ;; Don't try to validate network file systems. (not (string-prefix? "nfs" (file-system-type fs))) + ;; Don't try to validate ZFS file systems. + ;; XXX We should validate these by 'zfs status'. + (not (string-prefix? "zfs" (file-system-type fs))) (not (memq 'bind-mount (file-system-flags fs))))) (operating-system-file-systems (machine-operating-system machine)))) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index deffd49154..dcacc5b4b8 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -322,7 +322,10 @@ FILE-SYSTEM." (shepherd-service (provision (list (file-system->shepherd-service-name file-system))) (requirement `(root-file-system udev - ,@(map dependency->shepherd-service-name dependencies))) + ,@(map dependency->shepherd-service-name dependencies) + ,@(if (string-prefix? "zfs" (file-system-type file-system)) + '(zfs-loader) + '()))) (documentation "Check, mount, and unmount the given file system.") (start #~(lambda args #$(if create? diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 0dcf2b3afe..1515062ada 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -564,6 +564,9 @@ any, are available. Raise an error if they're not." %pseudo-file-system-types)) ;; Don't try to validate network file systems. (not (string-prefix? "nfs" (file-system-type fs))) + ;; Don't try to validate ZFS file systems. + ;; XXX We should validate these by 'zfs status'. + (not (string-prefix? "zfs" (file-system-type fs))) (not (memq 'bind-mount (file-system-flags fs))))) file-systems))