From 6e74938211172b951bb5da6a38808e4e46b51412 Mon Sep 17 00:00:00 2001 From: albert Date: Sun, 14 Jul 2024 20:10:56 +0900 Subject: [PATCH] update disks for warsaw --- nixos/hosts/warsaw-ovh-01/disks.nix | 229 ++++++++++++---------------- 1 file changed, 96 insertions(+), 133 deletions(-) diff --git a/nixos/hosts/warsaw-ovh-01/disks.nix b/nixos/hosts/warsaw-ovh-01/disks.nix index 820e39b6..3f8d9f7f 100644 --- a/nixos/hosts/warsaw-ovh-01/disks.nix +++ b/nixos/hosts/warsaw-ovh-01/disks.nix @@ -1,5 +1,4 @@ { - # https://github.com/nix-community/disko/blob/master/example/boot-raid1.nix imports = [ ../../common/services/snapper.nix ]; # extra configs not present in the standard config above @@ -12,136 +11,100 @@ services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.interval = "weekly"; - disko.devices = { - disk = { - sda = { - type = "disk"; - device = "/dev/sda"; - content = { - type = "gpt"; - partitions = { - BOOT = { - size = "1M"; - type = "EF02"; # GRUB MBR - }; - ESP = { - size = "500M"; - type = "EF00"; - content = { - type = "mdraid"; - name = "boot"; - }; - }; - mdadm = { - size = "100%"; - content = { - type = "mdraid"; - name = "raid1"; - }; - }; + disko.devices.disk.sda = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + BOOT = { + priority = 1; + name = "BOOT"; + start = "0%"; + end = "550MiB"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + # https://github.com/nix-community/disko/issues/527 + mountOptions = [ "umask=0077" ]; + mountpoint = "/boot"; }; - }; - }; - - sdb = { - type = "disk"; - device = "/dev/sdb"; - content = { - type = "gpt"; - partitions = { - BOOT = { - size = "1M"; - type = "EF02"; # GRUB MBR - }; - ESP = { - size = "500M"; - type = "EF00"; - content = { - type = "mdraid"; - name = "boot"; - }; - }; - mdadm = { - size = "100%"; - content = { - type = "mdraid"; - name = "raid1"; - }; - }; - }; - }; - }; - }; - - mdadm = { - boot = { - type = "mdadm"; - level = 1; - metadata = "1.0"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; - }; - }; - raid1 = { - type = "mdadm"; - level = 1; - content = { - type = "gpt"; - partitions = { - LUKS-ROOT = { - start = "550MiB"; - end = "100%"; - content = { - type = "luks"; - name = "ROOT"; - extraOpenArgs = [ "--allow-discards" ]; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # root - "/home" = { - mountpoint = "/home"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # home - "/nix" = { - mountpoint = "/nix"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # nix - "/Storage" = { - mountpoint = "/Storage"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # Storage - # SNAPSHOT SUBVOLS - "/root/.snapshots" = { - mountpoint = "/.snapshots"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # root - "/home/.snapshots" = { - mountpoint = "/home/.snapshots"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # home - "/nix/.snapshots" = { - mountpoint = "/nix/.snapshots"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # nix - "/Storage/.snapshots" = { - mountpoint = "/Storage/.snapshots"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # Storage - }; # subvolumes - }; # content.content - }; # content - }; # partition 2 (/ BTRFS) - }; - }; - }; - }; - }; -} + }; # partition 1 (ESP) + LUKS-ROOT = { + start = "550MiB"; + end = "100%"; + content = { + type = "luks"; + name = "ROOT"; + extraOpenArgs = [ "--allow-discards" ]; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home" = { + mountpoint = "/home"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix + # SNAPSHOT SUBVOLS + "/root/.snapshots" = { + mountpoint = "/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home/.snapshots" = { + mountpoint = "/home/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix/.snapshots" = { + mountpoint = "/nix/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix + }; # subvolumes + }; # content.content + }; # content + }; # partition 2 (/ BTRFS) + }; # partitions + }; # content + }; # disko.devices.disk.sda + + disko.devices.disk.sdb = { + type = "disk"; + device = "/dev/sdb"; + content = { + type = "gpt"; + partitions = { + LUKS-STORAGE = { + start = "550MiB"; + end = "100%"; + content = { + type = "luks"; + name = "STORAGE"; + extraOpenArgs = [ "--allow-discards" ]; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/Storage" = { + mountpoint = "/Storage"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # Storage + "/Storage/.snapshots" = { + mountpoint = "/Storage/.snapshots"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # Storage + }; # subvolumes + }; # content.content + }; # content + }; # partition 2 (/ BTRFS) + }; # partitions + }; # content + }; # disko.devices.disk.sdb +} # root