From: raid5atemyhomework <raid5atemyhomework@protonmail.com>
To: "guix-devel@gnu.org" <guix-devel@gnu.org>
Subject: Re: ZFS on Guix
Date: Wed, 06 Jan 2021 05:20:23 +0000 [thread overview]
Message-ID: <Zd8uMcxWfNY1RxDn4gwrCZjHKAUxSQgcuBsNDAqa0tMqj_ufQWE-URr7L49OBWMGDfQB8v_8eRdnhlsZTxU0Xq_F6tu-92jvvc1lSh-2tdA=@protonmail.com> (raw)
In-Reply-To: <t_t9LHglTTJw2Bhtd2xX4JCJeZBi5Drqg0t04vJsfRLfoENqpftZcuHO8LYi2AO05P71lbbCgQC5etCDiPsdcssJmw1pHGyCY3gUT-9w9_o=@protonmail.com>
Hi guix-developers,
Another issue here is that ZFS prefers to not be managed via `/etc/fstab`/`mount`/`umount`. Instead, at startup ZFS magically imports ZFS pools and mounts ZFS datasets in the correct place, as configured in the `mountpoint` properties of the dataset. This magic is actually implemented by executing `zpool import -a` at startup after ZFS module loading. Note that `zpool import -a` has to be executed always so that ZFS can detect its pools, though the automatic mounting can be suppressed with `zpool import -a -N`.
(`systemd`-based distros have a number of `systemd` services that handle ZFS importation by use of a `/etc/zfs/zpool.cache` file that ZFS maintains, and then does `zfs mount -a` to do automounting, but I'll leave that for later.)
Now, properly speaking, the shepherd `file-systems` service should not be started until we have actually performed ZFS automounting. This means that `file-systems` has to have as a requirement the ZFS shepherd service that implements the automounting. And of course it should *not* require that if ZFS isn't installed in the system.
So, I made another patch that makes the `file-systems` shepherd service have an extensible set of requirements, like `user-processes` does. It's below. Actual `file-system`s declared in the operating system then make themselves requirements of `file-systems`. Then, a ZFS automounting shepherd service can be installed by the `zfs-service-type` and added as a requirement of the `file-systems` shepherd service.
This is important since one possible use of ZFS is to have it provide the `/home` filesystem. And the `/home` filesystem has to be mounted before `user-homes` shepherd service starts. So the ZFS automounting shepherd service has to be a requirement of `file-systems`, which is enabled by the below.
Please review!
From 792a8f8efc95e4fe9a94d42f839ddcfb034b8540 Mon Sep 17 00:00:00 2001
From: raid5atemyhomework <raid5atemyhomework@protonmail.com>
Date: Wed, 6 Jan 2021 08:15:54 +0800
Subject: [PATCH] gnu: Make file-systems target extensible by services.
* gnu/services/base.scm (file-system-shepherd-services): Move file-systems
shepherd service to ...
(file-systems-target-shepherd-services): ... new procedure here.
(file-systems-target-service-type): New variable.
(file-system-service-type): Extend file-systems-target service to add each
file-system as a requirement.
* gnu/system.scm (operating-system-default-essential-services): Instantiate
file-systems-target-service-type.
(hurd-default-essential-services): Instantiate file-systems-target-service-type.
---
gnu/services/base.scm | 37 +++++++++++++++++++++++++++----------
gnu/system.scm | 2 ++
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 945b546607..13cfb6a8a2 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -13,6 +13,7 @@
;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -67,6 +68,7 @@
#:export (fstab-service-type
root-file-system-service
file-system-service-type
+ file-systems-target-service-type
swap-service
host-name-service
console-keymap-service
@@ -362,18 +364,29 @@ FILE-SYSTEM."
(gnu system file-systems)
,@%default-modules)))))))
+(define (file-systems-target-shepherd-services requirements)
+ (list
+ (shepherd-service
+ (provision '(file-systems))
+ (requirement (cons* 'root-file-system 'user-file-systems requirements))
+ (documentation "Target for all the initially-mounted file systems")
+ (start #~(const #t))
+ (stop #~(const #t)))))
+(define file-systems-target-service-type
+ (service-type
+ (name 'file-systems)
+ (extensions (list (service-extension shepherd-root-service-type
+ file-systems-target-shepherd-services)))
+ (compose concatenate)
+ (extend append)
+ ;; Extensions can add new values to this list.
+ (default-value '())
+ (description "The @code{file-systems} service is the target that is started
+when all file systems have been mounted.")))
+
(define (file-system-shepherd-services file-systems)
"Return the list of Shepherd services for FILE-SYSTEMS."
(let* ((file-systems (filter file-system-mount? file-systems)))
- (define sink
- (shepherd-service
- (provision '(file-systems))
- (requirement (cons* 'root-file-system 'user-file-systems
- (map file-system->shepherd-service-name
- file-systems)))
- (documentation "Target for all the initially-mounted file systems")
- (start #~(const #t))
- (stop #~(const #f))))
(define known-mount-points
(map file-system-mount-point file-systems))
@@ -403,7 +416,7 @@ FILE-SYSTEM."
(filter (negate known?) (mount-points)))
#f))))
- (cons* sink user-unmount
+ (cons* user-unmount
(map file-system-shepherd-service file-systems))))
(define (file-system-fstab-entries file-systems)
@@ -431,6 +444,10 @@ FILE-SYSTEM."
(service-extension fstab-service-type
file-system-fstab-entries)
+ ;; Have 'file-systems' depend on each declared file system.
+ (service-extension file-systems-target-service-type
+ (cut map file-system->shepherd-service-name <>))
+
;; Have 'user-processes' depend on 'file-systems'.
(service-extension user-processes-service-type
(const '(file-systems)))))
diff --git a/gnu/system.scm b/gnu/system.scm
index 5c530f176e..6987641ee8 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -667,6 +667,7 @@ bookkeeping."
(operating-system-setuid-programs os))
(service profile-service-type
(operating-system-packages os))
+ (service file-systems-target-service-type)
other-fs
(append mappings swaps
@@ -691,6 +692,7 @@ bookkeeping."
(operating-system-groups os))
(operating-system-skeletons os))
(root-file-system-service)
+ (service file-systems-target-service-type)
(service file-system-service-type '())
(service fstab-service-type
(filter file-system-needed-for-boot?
--
2.29.2
next prev parent reply other threads:[~2021-01-06 5:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-02 6:16 ZFS on Guix raid5atemyhomework
2021-01-02 6:40 ` raid5atemyhomework
2021-01-03 15:50 ` Danny Milosavljevic
[not found] ` <Kyzl4xnRrDtWbTkAmBf1i8mtSZvu-AYatdazY1NsABFAzqqi7HQl-t0d2LWAInr8n7KxGyJWfIfTWqrefrxdgWelKbr2SWc9ATV5P8zrVtw=3D@protonmail.com>
[not found] ` <DmzbKm-kVn1tCfYc4eAXeEEbj3RN28qvXJaLL6dHtBBeNdXE-e-vN-a4Y-De38H8jI5lt19mauUTz9k0JArMyOT2ciYoxKY8mXFw3xeHGqo=3D@protonmail.com>
[not found] ` <guGWV=5FuA7tRqi0SzCiial7b5W7uKlmcMRhQXIlhtzyf1Fgq91eakr8d5EQrZ2fJPJK1OqKMCJfMgE2H4SjRSph-31ms=5F2g-mFiddv9ppiaQ=3D@protonmail.com>
2021-01-04 0:50 ` raid5atemyhomework
2021-01-04 1:15 ` raid5atemyhomework
2021-01-05 11:02 ` raid5atemyhomework
2021-01-05 14:56 ` raid5atemyhomework
2021-01-06 0:59 ` Carlo Zancanaro
2021-01-06 3:50 ` raid5atemyhomework
2021-01-06 3:58 ` Carlo Zancanaro
[not found] ` <t=5Ft9LHglTTJw2Bhtd2xX4JCJeZBi5Drqg0t04vJsfRLfoENqpftZcuHO8LYi2AO05P71lbbCgQC5etCDiPsdcssJmw1pHGyCY3 gUT-9w9?= =?us-ascii?Q?=5Fo=3D@protonmail.com>
[not found] ` <Zd8uMcxWfNY1RxDn4gwrCZjHKAUxSQgcuBsNDAqa0tMqj=5FufQWE-URr7L49OBWMGDfQB8v=5F8eRdnhlsZTxU0Xq=5FF6tu-92jvvc1lSh-2tdA=3D@protonmail.com>
[not found] ` <vzCMYS=5FrSzkd3ZDA5TktzybU2LmfZsjWLmrd0ABQ1bIKyulAreAghoDBo0yjb-bEbH5ZmKhOO3D9WPjuDoMMUs0O eUWA1WakV?= =?us-ascii?Q?WFo6H61IHY=3D@protonmail.com>
[not found] ` <07kwAFNpjhGFe7ArkjjAtRhr564wvMPGhHFyjGb=5FXdmmPNddKTmT9Swky1NbbUxHBC4xw3p-m=5F3JyW16Ql9J7PLyk6UdhCsA2cdkHehdti8=3D@protonmail.com>
[not found] ` <VnQXBr-z8pdZxWrb6VtIu5pv0UeG1II5uUu4Q7BU3NsJMQbxhiQyWJE4fhEIWJO3VWrjetf1SMIu4=5Fgi5r2AlY q8dADCXCD?= =?us-ascii?Q?wW30RYaJ6seA=3D@protonmail.com>
[not found] ` <BwsjjkFjW7wwYSYYp-YUhl5t1-1OtA8t3wbDftsQTZBXHNxcR2tBprzJmBYvNrMKnCeiu0d5bPz7V8IaKIdYu9NP7kDsd16z6gMPpR89-3c=3D@protonmail.com>
[not found] ` <VnQXBr-z8pdZxWrb6VtIu5pv0UeG1II5uUu4Q7BU3NsJMQbxhiQyWJE4fhEIWJO3VWrjetf1SMIu4=5Fgi5r2AlYq8dADCXCDwW30RYaJ6seA=3D@protonmail.com>
[not found] ` <BwsjjkFjW7wwYSYYp-YUhl5t1-1OtA8t3wbDftsQTZBXHNxcR2tBprzJmBYvNrMKnCeiu0d5bPz7V8IaKIdYu9NP7kDsd16z6gMPpR89-3c=3D@protonmail.c om>
2021-01-06 4:41 ` raid5atemyhomework
2021-01-06 5:20 ` raid5atemyhomework [this message]
2021-01-06 15:58 ` raid5atemyhomework
2021-01-09 18:14 ` raid5atemyhomework
2021-01-10 5:17 ` raid5atemyhomework
2021-02-08 2:13 ` raid5atemyhomework
2021-02-08 3:51 ` Joshua Branson
2021-02-08 6:04 ` raid5atemyhomework
2021-02-08 6:13 ` raid5atemyhomework
2021-02-08 9:17 ` Maxime Devos
2021-02-08 9:32 ` raid5atemyhomework
2021-02-08 9:35 ` Maxime Devos
2021-02-10 8:29 ` Efraim Flashner
2021-02-08 2:16 ` Danny Milosavljevic
2021-02-10 7:37 ` raid5atemyhomework
[not found] <=5F1CLe9QSGsoMlu5WxBMXm4CbFLM=5FM9iRG1XQF9GDsK0GP208jpngdymfix4tAfoLP94mhMTt-Tx6OP2xN=5Fn78Jhx5KQzkiqPpIci=5F44C9OI=3D@protonmail.com>
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='Zd8uMcxWfNY1RxDn4gwrCZjHKAUxSQgcuBsNDAqa0tMqj_ufQWE-URr7L49OBWMGDfQB8v_8eRdnhlsZTxU0Xq_F6tu-92jvvc1lSh-2tdA=@protonmail.com' \
--to=raid5atemyhomework@protonmail.com \
--cc=guix-devel@gnu.org \
/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).