Change from mirror to snapraid with quirks

This commit is contained in:
Raphaël Numbus
2026-01-25 13:16:46 +01:00
parent daa517a6bf
commit 1c1573c5b2
4 changed files with 96 additions and 119 deletions
+7 -2
View File
@@ -1,4 +1,3 @@
{ lib, ... }:
{
disko.devices = {
# Boot disk LVM configuration
@@ -12,6 +11,12 @@
content.format = "btrfs";
content.mountpoint = "/";
};
snapraid = {
size = "1G";
content.type = "filesystem";
content.format = "btrfs";
content.mountpoint = "/mnt/content-0";
};
swap = {
size = "16G";
content.type = "swap";
@@ -23,7 +28,7 @@
# Boot disk
"boot-1" = {
type = "disk";
device = "${BOOT_DISK_1_ID}";
device = "$BOOT_DISK_1_ID";
content = {
type = "gpt";
partitions = {
+82 -32
View File
@@ -1,10 +1,9 @@
{ lib, ... }:
{
disko.devices = {
disk = {
"boot-1" = {
boot-1 = {
type = "disk";
device = "${BOOT_DISK_1_ID}";
device = "$BOOT_DISK_1_ID";
content = {
type = "gpt";
partitions = {
@@ -12,61 +11,112 @@
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
type = "mdraid";
name = "boot";
};
};
crypt_p1 = {
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted-boot-1";
settings = {
keyFile = "/etc/secrets/disks/boot-1";
allowDiscards = true;
keyFile = "/etc/secrets/disks/boot-1";
};
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
"boot-2" = {
boot-2 = {
type = "disk";
device = "${BOOT_DISK_2_ID}";
device = "$BOOT_DISK_2_ID";
content = {
type = "gpt";
partitions = {
crypt_p2 = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "mdraid";
name = "boot";
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted-boot-2";
settings = {
keyFile = "/etc/secrets/disks/boot-2";
allowDiscards = true;
keyFile = "/etc/secrets/disks/boot-2";
};
content = {
type = "btrfs";
extraArgs = [
"-d raid1"
"/dev/mapper/crypted-boot-1"
];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [
"rw"
"relatime"
"ssd"
];
};
"/swap" = {
mountpoint = "none";
swap.size = "16G";
};
};
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
};
mdadm = {
boot = {
type = "mdadm";
level = 1;
metadata = "1.2";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
swap = {
size = "16G";
lvm_type = "mirror";
content = {
type = "swap";
};
};
snapraid = {
size = "1G";
lvm_type = "mirror";
content = {
type = "filesystem";
format = "btrfs";
mountpoint = "/mnt/content-0";
};
};
root = {
size = "100%";
lvm_type = "mirror";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/rootfs" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
-49
View File
@@ -1,49 +0,0 @@
"content-1" = {
type = "disk";
device = "$CONTENT_DISK_ID";
content = {
type = "gpt";
partitions = {
mdadm = {
size = "$PARTITION_SIZE";
content = {
type = "mdraid";
name = "raid1";
};
};
};
};
};
"parity-1" = {
type = "disk";
device = "$PARITY_DISK_ID";
content = {
type = "gpt";
partitions = {
mdadm = {
size = "$PARTITION_SIZE";
content = {
type = "mdraid";
name = "raid1";
};
};
};
};
};
};
mdadm = {
raid1 = {
type = "mdadm";
level = 1;
metadata = "1.2";
content = {
type = "luks";
name = "crypted-mirror";
settings.keyFile = "/etc/secrets/disks/mirror";
content = {
type = "filesystem";
format = "xfs";
mountpoint = "/mnt/data";
};
};
};