@@ -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
@@ -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
@@ -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))))
@@ -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?
@@ -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))
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(-) -- 2.29.2