Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

: is not a valid character for disko.devices.disk attribute #937

Open
someonewithpc opened this issue Jan 12, 2025 · 2 comments
Open

: is not a valid character for disko.devices.disk attribute #937

someonewithpc opened this issue Jan 12, 2025 · 2 comments

Comments

@someonewithpc
Copy link

I'm trying to define a scheme where I have mdadm RAID across two disks, with /dev/disk/by-path, and I tried to use the following:

{ lib, ... }: {
  disko.devices = {
    disk = lib.genAttrs [ "pci-0000:04:00.0-nvme-1" "pci-0000:0f:00.0-nvme-1" ] (path: {
      type = "disk";
      device = "/dev/disk/by-path/${path}";
      content = {
        type = "gpt";
        partitions = {
          ESP = {
            size = "1G";
            type = "EF00";
            content = {
              type = "mdraid";
              name = "boot";
            };
          };
          RAID = {
            size = "100%";
            content = {
              type = "mdraid";
              name = "raid";
            };
          };
        };
      };
    });

    mdadm = {
      boot = {
        type = "mdadm";
        level = 1;
        metadata = "1.0";
        content = {
          type = "filesystem";
          format = "vfat";
          mountpoint = "/boot";
          mountOptions = [ "umask=0077" ];
        };
      };

      raid = {
        type = "mdadm";
        level = 0;
        metadata = "1.0";
        content = import ../btrfs-on-luks.nix;
      };
    };
  };
}

But I get

+ mdadm --create /dev/md/boot --level=1 --raid-devices=2 --metadata=1.0 --force --homehost=any /dev/disk/by-partlabel/disk-pci-0000:04:00.0-nvme-1-ESP /dev/disk/by-partlabel/disk-pci-0000:0f:00.0-nvme-1-ESP
mdadm: cannot open /dev/disk/by-partlabel/disk-pci-0000:04:00.0-nvme-1-ESP: No such file or directory

However, with

disk = let
  paths = [ "pci-0000:04:00.0-nvme-1" "pci-0000:0f:00.0-nvme-1" ];
in lib.listToAttrs (lib.map (path: {
  name = lib.replaceStrings [":"] ["-"] path;
  value = ...;
}) paths);

It works, so it seems like : is not a valid character for the partition name, at least for mdadm.

Could there be a type error for this, or would there be a way to escape it to allow it?

@Lassulus
Copy link
Collaborator

Would be good to know if sgdisk already failed with that partition name or if it just a mdadm limitation

@someonewithpc
Copy link
Author

Would be good to know if sgdisk already failed with that partition name or if it just a mdadm limitation

My setup on a laptop is using by-path and not mdadm, and it works, so I think it's a limitation on mdadm. See https://codeberg.org/someonewithpc/nixos-dotfiles/src/branch/main/lithium/disko.nix#L6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants