Skip to content

Allow draid in ZFS #1049

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Allow draid in ZFS #1049

wants to merge 1 commit into from

Conversation

9p4
Copy link

@9p4 9p4 commented Jun 3, 2025

Previously, creating a draid pool in disko would fail with a type error. This simple patch should resolve that.

name = "zpoolMode";
description = "valid modes for a zpool";
descriptionClass = "noun";
check = (x: lib.isString x && (builtins.elem x modeOptions || lib.strings.hasPrefix "draid" x));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does example configuration for this looks like? Should we extend zfs-with-vdevs.nix ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks very similar to raidz, but the mode would look something like draid2:16d:27c:2s.

Copy link
Member

@Mic92 Mic92 Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a more complete configuration that I can use for testing?

Copy link
Author

@9p4 9p4 Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
  lib,
  ...
}:
let
in
{
  disko.devices = {
    disk = {
      "disk0" = {
        type = "disk";
        device = "/dev/mapper/disk0";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk1" = {
        type = "disk";
        device = "/dev/mapper/disk1";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk2" = {
        type = "disk";
        device = "/dev/mapper/disk2";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk3" = {
        type = "disk";
        device = "/dev/mapper/disk3";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk4" = {
        type = "disk";
        device = "/dev/mapper/disk4";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk5" = {
        type = "disk";
        device = "/dev/mapper/disk5";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk6" = {
        type = "disk";
        device = "/dev/mapper/disk6";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk7" = {
        type = "disk";
        device = "/dev/mapper/disk7";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk8" = {
        type = "disk";
        device = "/dev/mapper/disk8";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk9" = {
        type = "disk";
        device = "/dev/mapper/disk9";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk10" = {
        type = "disk";
        device = "/dev/mapper/disk10";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk11" = {
        type = "disk";
        device = "/dev/mapper/disk11";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk12" = {
        type = "disk";
        device = "/dev/mapper/disk12";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk13" = {
        type = "disk";
        device = "/dev/mapper/disk13";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk14" = {
        type = "disk";
        device = "/dev/mapper/disk14";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk15" = {
        type = "disk";
        device = "/dev/mapper/disk15";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk16" = {
        type = "disk";
        device = "/dev/mapper/disk16";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk17" = {
        type = "disk";
        device = "/dev/mapper/disk17";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk18" = {
        type = "disk";
        device = "/dev/mapper/disk18";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk19" = {
        type = "disk";
        device = "/dev/mapper/disk19";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk20" = {
        type = "disk";
        device = "/dev/mapper/disk20";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk21" = {
        type = "disk";
        device = "/dev/mapper/disk21";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk22" = {
        type = "disk";
        device = "/dev/mapper/disk22";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk23" = {
        type = "disk";
        device = "/dev/mapper/disk23";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk24" = {
        type = "disk";
        device = "/dev/mapper/disk24";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk25" = {
        type = "disk";
        device = "/dev/mapper/disk25";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
      "disk26" = {
        type = "disk";
        device = "/dev/mapper/disk26";
        content = {
          type = "gpt";
          partitions = {
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "tank";
              };
            };
          };
        };
      };
    };
    zpool = {
      tank = {
        type = "zpool";
        mode = {
          topology = {
            type = "topology";
            vdev = [
              {
                mode = "draid2:16d:27c:2s"; # according to my calculations, this is pretty optimal. Read the README for more info
                members = [
                  "disk0"
                  "disk1"
                  "disk2"
                  "disk3"
                  "disk4"
                  "disk5"
                  "disk6"
                  "disk7"
                  "disk8"
                  "disk9"
                  "disk10"
                  "disk11"
                  "disk12"
                  "disk13"
                  "disk14"
                  "disk15"
                  "disk16"
                  "disk17"
                  "disk18"
                  "disk19"
                  "disk20"
                  "disk21"
                  "disk22"
                  "disk23"
                  "disk24"
                  "disk25"
                  "disk26"
                ];
              }
            ];
          };
        };
        datasets = {
          mirror = {
            type = "zfs_fs";
            mountpoint = "/srv/mirror";
          };
        };
      };
    };
  };
}

@9p4
Copy link
Author

9p4 commented Jun 8, 2025

I'm not quite sure how to have the tests pass if the type is set to a function.

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

Successfully merging this pull request may close these issues.

2 participants