guix-commits
[Top][All Lists]
Advanced

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

branch master updated: berlin: Migrate root file system to Btrfs array.


From: Maxim Cournoyer
Subject: branch master updated: berlin: Migrate root file system to Btrfs array.
Date: Thu, 17 Feb 2022 11:51:05 -0500

This is an automated email from the git hooks/post-receive script.

apteryx pushed a commit to branch master
in repository maintenance.

The following commit(s) were added to refs/heads/master by this push:
     new 6c6115e  berlin: Migrate root file system to Btrfs array.
6c6115e is described below

commit 6c6115ef2b3300f9bad028a242d21a97fd7f0bed
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Wed Feb 16 14:50:20 2022 -0500

    berlin: Migrate root file system to Btrfs array.
    
    This completes the migration from the old rotational disk storage to
    the new SSD-backed Btrfs array.
    
    * hydra/berlin.scm (%copy-kernel-and-initrd): Delete variable.
    (%rsync-modules-for-backup): De-register unused '/src' directory.
    (%btrfs-pool)[create-mount-point?]: New field.
    (@root, @home, @cache): Delete variable.
    (btrfs-subvolume-mount): New procedure.
    (operating-system)[bootloader]: Adjust targets field.
    [file-systems]: Relocate previous root file system to
    "/mnt/old-root-fs"; previous /gnu storage to "/mnt/old-gnu".
    Set the mount point of the @root subvolume to "/".
    Register the new @disarchive, @cuirass, @log, @mumi, @postgresql,
    @secrets and @srv Btrfs subvolumes.
    [services]: Delete the 'copy-kernel+initrd-to-/store' simple service.
    {zabbix-server-service-type}: Adjust file paths.
    {zabbix-front-end-service-type}: Likewise.
---
 hydra/berlin.scm | 140 +++++++++++++++++++++++++------------------------------
 1 file changed, 64 insertions(+), 76 deletions(-)

diff --git a/hydra/berlin.scm b/hydra/berlin.scm
index 96977df..466e734 100644
--- a/hydra/berlin.scm
+++ b/hydra/berlin.scm
@@ -99,30 +99,6 @@ 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"))
@@ -153,9 +129,6 @@ 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"))
@@ -185,43 +158,23 @@ 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)))))
 
-;;; Root Btrfs subvolume.
-(define @root
+(define (btrfs-subvolume-mount name mount-point)
+  "Return a file system to mount the Btrfs subvolume NAME at MOUNT-POINT."
   (file-system
     (device (uuid %btrfs-raid-uuid))
-    (mount-point "/new-root")
+    (mount-point mount-point)
+    (create-mount-point? #t)
     (type "btrfs")
     (options (alist->file-system-options
-              (cons '("subvol" . "@root")
+              (cons (cons "subvol" name)
                     %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")
@@ -244,35 +197,47 @@ Happy hacking!\n"))
   ;; Show the GRUB menu on the serial interface.
   (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
-               (targets '("/dev/sda"))
+               ;; 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"))
                (terminal-inputs '(serial))
                (terminal-outputs '(serial))))
 
   (file-systems (cons*
-                 ;; The root file system resides on just a single
-                 ;; disk, no RAID :-/
-                 (file-system
-                   (device (file-system-label "my-root"))
-                   (mount-point "/")
-                   (type "ext4"))
+                 (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
                  ;; 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 "/gnu")
+                   (mount-point "/mnt/old-gnu")
+                   (create-mount-point? #t)
                    (type "ext4"))
                  ;; Access root file system without bind mounts.
                  (file-system
-                   (device "/")
-                   (mount-point "/mnt/root-fs")
-                   (flags '(bind-mount))
-                   (type "none"))
-                 %btrfs-pool
-                 @root
-                 @home
-                 @cache
+                   (device (file-system-label "my-root"))
+                   (mount-point "/mnt/old-root-fs")
+                   (create-mount-point? #t)
+                   (type "ext4"))
                  %base-file-systems))
 
   ;; Local admin account for MDC maintenance.
@@ -299,10 +264,6 @@ 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
@@ -366,13 +327,13 @@ Happy hacking!\n"))
              (service zabbix-agent-service-type)
              (service zabbix-server-service-type
                       (zabbix-server-configuration
-                       (include-files '("/root/zabbix-pass"))
-                       (extra-options 
"AlertScriptsPath=/root/zabbix-alert-scripts\n")))
+                       (include-files '("/secrets/zabbix/pass"))
+                       (extra-options 
"AlertScriptsPath=/etc/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 "/root/zabbix-front-end-secrets")))
+                       (db-secret-file "/secrets/zabbix/front-end-secrets")))
 
              ;; For the Zabbix database.  It was created by manually
              ;; following the instructions here:
@@ -469,3 +430,30 @@ 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]