Thoughts on my disko config

I’d greatly appreciate any feedback on my disko config. This is for a home backup machine, and first time using zfs.

{
  disko.devices = {
    disk = {
      disk1 = {
        type = "disk";
        device = "/dev/disk/by-id/nvme-CT1000P310SSD8_252550E58990";
        content = {
          type = "gpt";
          partitions = {
            esp = {
              name = "ESP";
              size = "500M";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot";
                mountOptions = [
                  "umask=0077"
                ];
              };
            };
            luks = {
              size = "100%";
              content = {
                type = "luks";
                name = "crypted1";
                extraOpenArgs = [ ];
                settings = {
                  allowDiscards = true;
                };
                content = {
                  type = "btrfs";
                  extraArgs = [ "-f" ];
                  subvolumes = {
                    "/root" = {
                      mountpoint = "/";
                      mountOptions = [
                        "subvol=root"
                        "compress=zstd"
                        "noatime"
                        "ssd"
                      ];
                    };
                    "/persist" = {
                      mountpoint = "/persist";
                      mountOptions = [
                        "subvol=persist"
                        "compress=zstd"
                        "noatime"
                        "ssd"
                      ];
                    };
                    "/nix" = {
                      mountpoint = "/nix";
                      mountOptions = [
                        "subvol=nix"
                        "compress=zstd"
                        "noatime"
                        "ssd"
                      ];
                    };
                    "/swap" = {
                      mountpoint = "/swap";
                      swap.swapfile.size = "16G";
                    };
                  };
                };
              };
            };
          };
        };
      };
      disk2 = {
        type = "disk";
        device = "/dev/disk/by-id/nvme-Fanxiang_S690Q_4TB_FXS690Q254120031";
        content = {
          type = "gpt";
          partitions = {
            luks = {
              size = "100%";
              content = {
                type = "luks";
                name = "crypted2";
                settings = {
                  allowDiscards = true;
                };
                content = {
                  type = "zfs";
                  pool = "phobos";
                };
              };
            };
          };
        };
      };
      disk3 = {
        type = "disk";
        device = "/dev/disk/by-id/nvme-Fanxiang_S690Q_4TB_FXS690Q254110015";
        content = {
          type = "gpt";
          partitions = {
            luks = {
              size = "100%";
              content = {
                type = "luks";
                name = "crypted3";
                settings = {
                  allowDiscards = true;
                };
                content = {
                  type = "zfs";
                  pool = "phobos";
                };
              };
            };
          };
        };
      };
    };
    zpool = {
      phobos = {
        type = "zpool";
        mode = "mirror";
        options = {
          ashift = "12";
        };
        rootFsOptions = {
          compression = "zstd";
        };
        mountpoint = "/phobos";
        datasets = {
          backups = {
            type = "zfs_fs";
            mountpoint = "/phobos/backups";
          };
          media = {
            type = "zfs_fs";
            mountpoint = "/phobos/media";
          };
        };
      };
    };
  };
}

There’s no need to add subvol= to the mount options, disko does that. And btrfs automatically detects SSDs, so there’’s no need for the ssd mount option ether. Otherwise it looks good to me.

1 Like