disko icon indicating copy to clipboard operation
disko copied to clipboard

GRUB Mirrored boot entries with disko

Open Ma27 opened this issue 1 year ago • 5 comments

Given a Hetzner AX41 NVMe (two SSDs, MBR / legacy boot required) with a mirrored zpool (not part of the example):

{
  disko.devices.disk.nvme0n1 = {
    type = "disk";
    device = "/dev/nvme0n1";
    content = {
      type = "gpt";
      partitions = [
        { name = "bios0";
          type = "EF02";
          start = "1024";
          end = "2047";
        }
        { name = "boot0";
          type = "EF00";
          start = "1M";
          size = "512M";
          content = {
            type = "filesystem";
            format = "vfat";
            mountpoint = "/boot";
          };
        }
        # ...
      ];
    };
  };
  disko.devices.disk.nvme1n1 = {
    type = "disk";
    device = "/dev/nvme1n1";
    content = {
      type = "gpt";
      partitions = [
        { name = "bios1";
          type = "EF02";
          start = "1024";
          end = "2047";
        }
        { name = "boot1";
          type = "EF00";
          start = "1M";
          size = "512M";
          content = {
            type = "filesystem";
            format = "vfat";
            mountpoint = "/boot-fallback";
          };
        }
        # ...
      ];
    };
  };
}

This gives me a single entry in boot.loader.grub.mirroredBoots with devices containing both /dev/nvme0n1 and /dev/nvme1n1.

What I need though is

{
  boot.loader.grub.mirroredBoots = [
    { devices = [ "/dev/nvme0n1" ];
      path = "/boot";
      }
    { devices = [ "/dev/nvme1n1" ];
      path = "/boot-fallback";
    }
  ];
}

My workaround was to use mkForce on mirroredBoots. However I'm wondering if there's a better way to achieve that. Or am I holding it wrong?

Ma27 avatar Mar 19 '24 13:03 Ma27

Looks very similar to what I had to do: https://github.com/Mic92/dotfiles/blob/b2ff14454465c10d00c4239eea0785583ddf9a35/nixos/eve/modules/disko.nix#L39

I didn't had to use mkForce though.

Mic92 avatar Mar 21 '24 17:03 Mic92

Btw. You can also enable UEFI on most hetzner machines by ordering the KVM console once.

Mic92 avatar Mar 21 '24 17:03 Mic92