unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: raid5atemyhomework via Guix-patches via <guix-patches@gnu.org>
To: "45643@debbugs.gnu.org" <45643@debbugs.gnu.org>
Subject: [bug#45643] [PATCH 3/3] gnu, guix: Support mounting legacy-mounted ZFS in operating-system form.
Date: Mon, 04 Jan 2021 01:09:35 +0000	[thread overview]
Message-ID: <JQwrx0zllfKouhNkLC3SdQXURha-g0cP1d37GCcZZc_Kq1WqlDJzKYyJxBlUsMscWI9cNq6I32GJ46E2JZwZOdRJVNlWjtwrIDZQ4YAOuEU=@protonmail.com> (raw)
In-Reply-To: <KsQRoKgO0OqFaU5n-6nXB2fBwhViqfa-T12IzGcIDCtZFGhGfKz_8cVrnk2IVYQERMjIhw7MV6nOQxMZ0nZn2ddHQFQi4jJJf_spXGkUgkg=@protonmail.com>

From 59c9bd5642e33962798c01f4dcf30be38ead4ab8 Mon Sep 17 00:00:00 2001
From: raid5atemyhomework <raid5atemyhomework@protonmail.com>
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(-)

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))

--
2.29.2





      parent reply	other threads:[~2021-01-04  1:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04  1:02 [bug#45643] [PATCH 0/3] Better Support for ZFS on Guix raid5atemyhomework via Guix-patches via
2021-01-04  1:05 ` [bug#45643] [PATCH 1/3] gnu, doc: Create and document procedure to compile ZFS for specific kernel raid5atemyhomework via Guix-patches via
2021-01-04  1:06 ` [bug#45643] [PATCH 2/3] gnu: Make 'file-systems' target extensible raid5atemyhomework via Guix-patches via
2021-01-04  1:09 ` raid5atemyhomework via Guix-patches via [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='JQwrx0zllfKouhNkLC3SdQXURha-g0cP1d37GCcZZc_Kq1WqlDJzKYyJxBlUsMscWI9cNq6I32GJ46E2JZwZOdRJVNlWjtwrIDZQ4YAOuEU=@protonmail.com' \
    --to=guix-patches@gnu.org \
    --cc=45643@debbugs.gnu.org \
    --cc=raid5atemyhomework@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).