diff --git a/disko/default.nix b/disko/default.nix index cd321b8..1e6c617 100644 --- a/disko/default.nix +++ b/disko/default.nix @@ -254,6 +254,9 @@ in { }; }; zstorage = { + # PARITY_COUNT=3 NUM_DRIVES=8 HOT_SPARES=2 sudo -E zpool create -f -O mountpoint=none -O compression=on -O xattr=sa -O acltype=posixacl -o ashift=12 -O atime=off -O recordsize=64K zstorage draid{$PARITY_COUNT}:{$NUM_DRIVES}c:{$HOT_SPARES}s /dev/disk/by-id/scsi-35000039548cb637c /dev/disk/by-id/scsi-35000039548cb7c8c /dev/disk/by-id/scsi-35000039548cb85c8 /dev/disk/by-id/scsi-35000039548d9b504 /dev/disk/by-id/scsi-35000039548da2b08 /dev/disk/by-id/scsi-35000039548dad2fc /dev/disk/by-id/scsi-350000399384be921 /dev/disk/by-id/scsi-35000039548db096c + # sudo zfs create -o mountpoint=legacy zstorage/nix + # sudo zfs create -o canmount=on -o mountpoint=/storage zstorage/storage name = "zstorage"; config = {}; }; diff --git a/nixos/beefcake.nix b/nixos/beefcake.nix index a447181..9793370 100644 --- a/nixos/beefcake.nix +++ b/nixos/beefcake.nix @@ -22,7 +22,18 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00 imports = [ { # hardware + networking.hostId = "541ede55"; boot = { + zfs = { + extraPools = ["zstorage"]; + }; + supportedFilesystems = { + zfs = true; + }; + initrd.supportedFilesystems = { + zfs = true; + }; + kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; initrd.availableKernelModules = ["ehci_pci" "mpt3sas" "usbhid" "sd_mod"]; kernelModules = ["kvm-intel"]; loader.systemd-boot.enable = true; @@ -40,14 +51,22 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00 options = ["fmask=0022" "dmask=0022"]; }; + # should be mounted by auto-import; see boot.zfs.extraPools # fileSystems."/storage" = { - # device = "/dev/disk/by-uuid/ea8258d7-54d1-430e-93b3-e15d33231063"; - # fsType = "btrfs"; - # options = [ - # "compress=zstd:5" - # "space_cache=v2" - # ]; + # device = "zstorage/storage"; + # fsType = "zfs"; # }; + + fileSystems."/nix" = { + device = "zstorage/nix"; + fsType = "zfs"; + }; + + services.zfs.autoScrub.enable = true; + services.zfs.autoSnapshot.enable = true; + + # TODO: nfs with zfs? + # services.nfs.server.enable = true; } { boot.kernelParams = ["nohibernate"];