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 = [
(modulesPath + "/installer/scan/not-detected.nix")
(modulesPath + "/profiles/qemu-guest.nix")
./disk-config.nix
];
boot.loader.grub = {
@ -24,8 +23,14 @@
];
users.users.root.openssh.authorizedKeys.keys = [
"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";
}

View file

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