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

ZFS uses incorrect disk in interactive VM when using multiple disks. #885

Open
0x450x6c opened this issue Nov 18, 2024 · 2 comments
Open

Comments

@0x450x6c
Copy link
Contributor

I'm using following configuration & vmWithDisko:

disko.devices = {
    disk = {
      disk-1 = {
        imageSize = "512110190592";
        type = "disk";
        device = "/dev/disk/by-id/nvme-eui...";
        content = {
          type = "gpt";
          partitions = {
            esp = {
              priority = 1;
              name = "ESP";
              size = "512M";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot-1";
              };
            };
            special = {
              priority = 2;
              size = "320G";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
            swap = {
              priority = 3;
              size = "8G";
              content = {
                type = "swap";
                discardPolicy = "both";
              };
            };
            cache = {
              priority = 4;
              size = "100%";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
      disk-2 = {
        imageSize = "512110190592";
        type = "disk";
        device = "/dev/disk/by-id/nvme-eui....";
        content = {
          type = "gpt";
          partitions = {
            esp = {
              priority = 1;
              name = "ESP";
              size = "512M";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot-2";
              };
            };
            special = {
              priority = 2;
              size = "320G";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
            swap = {
              priority = 3;
              size = "8G";
              content = {
                type = "swap";
                discardPolicy = "both";
              };
            };
            cache = {
              priority = 4;
              size = "100%";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
      disk-3 = {
        imageSize = "16000900661248";
        type = "disk";
        device = "/dev/disk/by-id/wwn-...";
        content = {
          type = "gpt";
          partitions = {
            esp = {
              priority = 1;
              name = "ESP";
              size = "512M";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot-3";
              };
            };
            zfs = {
              priority = 2;
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
      disk-4 = {
        imageSize = "16000900661248";
        type = "disk";
        device = "/dev/disk/by-id/wwn-...";
        content = {
          type = "gpt";
          partitions = {
            esp = {
              priority = 1;
              name = "ESP";
              size = "512M";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot-4";
              };
            };
            zfs = {
              priority = 2;
              size = "14880G";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
    };
    zpool = {
      zroot = {
        options.ashift = "12";
        mode = {
          topology = {
            type = "topology";
            vdev = [
              {
                mode = "mirror";
                members = [
                  "/dev/disk/by-partlabel/disk-disk-3-zfs"
                  "/dev/disk/by-partlabel/disk-disk-4-zfs"
                ];
              }
            ];
            special = {
              mode = "mirror";
              members = [
                "/dev/disk/by-partlabel/disk-disk-1-special"
                "/dev/disk/by-partlabel/disk-disk-2-special"
              ];
            };
            cache = [
              "/dev/disk/by-partlabel/disk-disk-1-cache"
              "/dev/disk/by-partlabel/disk-disk-2-cache"
            ];
          };
        };
      };
    };
  };

Sometimes it works, but mostly hangs on importing ZFS pool.

It seems that is due to this line: https://github.com/nix-community/disko/blob/master/lib/interactive-vm.nix#L65

And can be worked around via:

boot.zfs.devNodes = lib.mkForce "/dev/disk/by-id";
@Mic92
Copy link
Member

Mic92 commented Nov 19, 2024

Looks like your observation is contracting with this comment?

@0x450x6c
Copy link
Contributor Author

0x450x6c commented Nov 19, 2024

Yes, /dev/disk/by-id works for me, maybe it will not work in some circumstances, but I did not encounter them.

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