evaluate and checkout mdadm disk layout

This commit is contained in:
hodasemi 2025-05-14 17:22:36 +02:00
parent eae9f1e18c
commit f3eae6241d
2 changed files with 53 additions and 33 deletions

View file

@ -7,7 +7,6 @@
{ {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
(modulesPath + "/profiles/qemu-guest.nix")
./disk-config.nix ./disk-config.nix
]; ];
boot.loader.grub = { boot.loader.grub = {
@ -27,5 +26,11 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHDuOIycRP7Ney136ro/doWj1kttJUqmbGz6OC2nia09 michael.huebner@ptspaper.de" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHDuOIycRP7Ney136ro/doWj1kttJUqmbGz6OC2nia09 michael.huebner@ptspaper.de"
]; ];
# # even though we have raid 1, we only boot from the first disk with the zfs setup
# boot.loader.grub.devices = [ "/dev/nvme0n1" ];
# # this was generated with `head -c4 /dev/urandom | od -A none -t x4`
# networking.hostId = "32fd1c31";
system.stateVersion = "24.05"; system.stateVersion = "24.05";
} }

View file

@ -1,4 +1,3 @@
# Example to create a bios compatible gpt partition
{ {
disko.devices = { disko.devices = {
disk = { disk = {
@ -8,21 +7,19 @@
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
ESP = { boot = {
size = "1024M"; size = "500M";
type = "EF00"; type = "EF00";
content = { content = {
type = "filesystem"; type = "mdraid";
format = "vfat"; name = "boot";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
}; };
}; };
zfs = { primary = {
size = "100%"; size = "100%";
content = { content = {
type = "zfs"; type = "lvm_pv";
pool = "zroot"; vg = "pool";
}; };
}; };
}; };
@ -34,38 +31,56 @@
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
zfs = { boot = {
size = "500M";
type = "EF00";
content = {
type = "mdraid";
name = "boot";
};
};
primary = {
size = "100%"; size = "100%";
content = { content = {
type = "zfs"; type = "lvm_pv";
pool = "zroot"; vg = "pool";
}; };
}; };
}; };
}; };
}; };
}; };
zpool = { mdadm = {
zroot = { boot = {
type = "zpool"; type = "mdadm";
mode = "mirror"; level = 1;
# Workaround: cannot import 'zroot': I/O error in disko tests metadata = "1.0";
options.cachefile = "none"; content = {
rootFsOptions = { type = "filesystem";
compression = "zstd"; format = "vfat";
"com.sun:auto-snapshot" = "true"; mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
}; };
mountpoint = "/"; };
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zroot@blank$' || zfs snapshot zroot@blank"; };
lvm_vg = {
datasets = { pool = {
zfs_fs = { type = "lvm_vg";
type = "zfs_fs"; lvs = {
mountpoint = "/zfs_fs"; root = {
size = "100%";
lvm_type = "mirror";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [
"defaults"
];
};
}; };
}; };
}; };
}; };
}; };
} }