guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: Revert "berlin: Migrate root file system to Btrfs array."


From: Maxim Cournoyer
Subject: 01/03: Revert "berlin: Migrate root file system to Btrfs array."
Date: Wed, 4 May 2022 09:29:15 -0400 (EDT)

apteryx pushed a commit to branch master
in repository maintenance.

commit c5661d21a1dc35f5228ca6ba78e0c8bf6ced4ef0
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Tue May 3 21:12:06 2022 -0400

    Revert "berlin: Migrate root file system to Btrfs array."
    
    This reverts commit 6c6115ef2b3300f9bad028a242d21a97fd7f0bed, as the
    resulting system was not bootable.
---
 hydra/berlin.scm | 142 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 76 insertions(+), 66 deletions(-)

diff --git a/hydra/berlin.scm b/hydra/berlin.scm
index 4e8b533..d22a9ee 100644
--- a/hydra/berlin.scm
+++ b/hydra/berlin.scm
@@ -99,6 +99,30 @@ Best practices:
 
 Happy hacking!\n"))
 
+
+(define %copy-kernel-and-initrd
+  ;; The storage device where the root file system is is invisible to GRUB.
+  ;; Thus, copy the kernel and initrd to /store, where GRUB will be able to
+  ;; find them.
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (for-each (lambda (file)
+                    (let ((target (string-append "/store/" (basename file))))
+                      (unless (file-exists? target)
+                        (format #t "copying '~a' to /store...~%" file)
+                        (copy-recursively file target
+                                          #:log (%make-void-port "w")))))
+
+                  ;; /run/current-system/kernel is a profile.  The trick
+                  ;; below allows us to get at its actual directory name,
+                  ;; which is what 'grub.cfg' refers to.
+                  (list (dirname
+                         (canonicalize-path 
"/run/current-system/kernel/bzImage"))
+                        (dirname (canonicalize-path 
"/run/current-system/initrd")))))))
+
+
 (define %build-node-key-directory
   ;; Directory containing the signing keys of build nodes.
   (string-append (current-source-directory) "/keys/guix/berlin"))
@@ -129,6 +153,9 @@ Happy hacking!\n"))
         (rsync-module
          (name "web-audio")
          (file-name "/srv/audio"))
+        (rsync-module
+         (name "web-cuirass")
+         (file-name "/src/cuirass-releases"))
         (rsync-module
          (name "disarchive")
          (file-name "/gnu/disarchive"))
@@ -159,23 +186,43 @@ Happy hacking!\n"))
     ;; This is required by the 'btrbk' backup tool.
     (device (uuid %btrfs-raid-uuid))
     (mount-point "/mnt/btrfs-pool")
-    (create-mount-point? #t)
     (type "btrfs")
     (options (alist->file-system-options
               (cons '("subvolid" . "5")
                     %common-btrfs-options)))))
 
-(define (btrfs-subvolume-mount name mount-point)
-  "Return a file system to mount the Btrfs subvolume NAME at MOUNT-POINT."
+;;; Root Btrfs subvolume.
+(define @root
   (file-system
     (device (uuid %btrfs-raid-uuid))
-    (mount-point mount-point)
-    (create-mount-point? #t)
+    (mount-point "/new-root")
     (type "btrfs")
     (options (alist->file-system-options
-              (cons (cons "subvol" name)
+              (cons '("subvol" . "@root")
                     %common-btrfs-options)))))
 
+;;; Home Btrfs subvolume.
+(define @home
+  (file-system
+    (device (uuid %btrfs-raid-uuid))
+    (mount-point "/home")
+    (type "btrfs")
+    (options (alist->file-system-options
+              (cons '("subvol" . "@home")
+                    %common-btrfs-options)))
+    (dependencies (list @root))))
+
+;;; Cache Btrfs subvolume.
+(define @cache
+  (file-system
+    (device (uuid %btrfs-raid-uuid))
+    (mount-point "/var/cache")
+    (type "btrfs")
+    (options (alist->file-system-options
+              (cons '("subvol" . "@cache")
+                    %common-btrfs-options)))
+    (dependencies (list @root))))
+
 
 (operating-system
   (host-name "berlin.guix.gnu.org")
@@ -204,49 +251,35 @@ Happy hacking!\n"))
   ;; Show the GRUB menu on the serial interface.
   (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
-               ;; FIXME: Add support in GRUB to find devices by UUID
-               ;; or labels.
-               ;; FIXME: Ensure system can boot even when one disk is
-               ;; missing (see: https://issues.guix.gnu.org/40999).
-               (targets '("/dev/sda"
-                          "/dev/sdb"
-                          "/dev/sdc"
-                          "/dev/sdd"
-                          "/dev/sde"
-                          "/dev/sdf"))
+               (targets '("/dev/sda"))
                (terminal-inputs '(serial))
                (terminal-outputs '(serial))))
 
   (file-systems (cons*
-                 (btrfs-subvolume-mount "@root"       "/")
-                 (btrfs-subvolume-mount "@etc"        "/etc")
-                 (btrfs-subvolume-mount "@home"       "/home")
-                 (btrfs-subvolume-mount "@disarchive" "/gnu/disarchive")
-                 (btrfs-subvolume-mount "@cache"      "/var/cache")
-                 (btrfs-subvolume-mount "@cuirass"    "/var/cuirass")
-                 (btrfs-subvolume-mount "@log"        "/var/log")
-                 (btrfs-subvolume-mount "@mumi"       "/var/mumi")
-                 (btrfs-subvolume-mount "@postgresql" "/var/lib/postgresql")
-                 (btrfs-subvolume-mount "@secrets"    "/secrets")
-                 (btrfs-subvolume-mount "@srv"        "/srv")
-                 %btrfs-pool
+                 ;; The root file system resides on just a single
+                 ;; disk, no RAID :-/
+                 (file-system
+                   (device (file-system-label "my-root"))
+                   (mount-point "/")
+                   (type "ext4"))
                  ;; This is a large external storage array
                  ;; connected via 2 HBA cards.  We only mount it
                  ;; through one of the HBA cards.  We would need
                  ;; to use multipathd otherwise.
                  (file-system
                    (device (uuid "a6455b66-59d2-40bd-bddb-0c572bb62a2f"))
-                   (mount-point "/mnt/old-gnu")
-                   (create-mount-point? #t)
-                   (mount? #f)
+                   (mount-point "/gnu")
                    (type "ext4"))
                  ;; Access root file system without bind mounts.
                  (file-system
-                   (device (file-system-label "my-root"))
-                   (mount-point "/mnt/old-root-fs")
-                   (create-mount-point? #t)
-                   (mount? #f)
-                   (type "ext4"))
+                   (device "/")
+                   (mount-point "/mnt/root-fs")
+                   (flags '(bind-mount))
+                   (type "none"))
+                 %btrfs-pool
+                 @root
+                 @home
+                 @cache
                  %base-file-systems))
 
   ;; Local admin account for MDC maintenance.
@@ -273,6 +306,10 @@ Happy hacking!\n"))
                    %base-packages))
 
   (services (cons*
+             (simple-service 'copy-kernel+initrd-to-/store
+                             activation-service-type
+                             %copy-kernel-and-initrd)
+
              (service static-networking-service-type
                       (list (static-networking
                              (addresses
@@ -336,13 +373,13 @@ Happy hacking!\n"))
              (service zabbix-agent-service-type)
              (service zabbix-server-service-type
                       (zabbix-server-configuration
-                       (include-files '("/secrets/zabbix/pass"))
-                       (extra-options 
"AlertScriptsPath=/etc/zabbix/alert-scripts\n")))
+                       (include-files '("/root/zabbix-pass"))
+                       (extra-options 
"AlertScriptsPath=/root/zabbix-alert-scripts\n")))
              (service zabbix-front-end-service-type
                       (zabbix-front-end-configuration
                        (nginx (list %zabbix-nginx-server
                                     %zabbix-nginx-local-server))
-                       (db-secret-file "/secrets/zabbix/front-end-secrets")))
+                       (db-secret-file "/root/zabbix-front-end-secrets")))
 
              ;; For the Zabbix database.  It was created by manually
              ;; following the instructions here:
@@ -448,30 +485,3 @@ Happy hacking!\n"))
                                     #:motd %motd
                                     #:publish-workers 8
                                     #:max-jobs 20)))))
-
-
-;;;
-;;; State to preserve when migrating the root file system:
-;;;
-;;; - /etc/guix
-;;; - /etc/childhurd
-;;; - /etc/ssl-ca
-;;; - /etc/letsencrypt
-;;; - /etc/cuirass.csm
-;;; - /etc/wireguard
-;;; - /etc/ssh
-;;; - /etc/rsyncd.conf
-;;; - /etc/zabbix
-;;;
-;;; - /gnu/disarchive
-;;;
-;;; - /root/scripts
-;;;
-;;; - /secrets/zabbix
-;;;
-;;; - /srv
-;;;
-;;; - /var/cuirass
-;;; - /var/lib/postgresql
-;;; - /var/mumi
-;;; - /var/log



reply via email to

[Prev in Thread] Current Thread [Next in Thread]