Add zfs cluster

This commit is contained in:
GHOSCHT 2024-03-31 22:04:31 +02:00
parent 6172e26bb1
commit bb38367685
Signed by: ghoscht
GPG key ID: 2C2C1C62A5388E82
2 changed files with 131 additions and 4 deletions

View file

@ -14,6 +14,7 @@ in {
./hardware-configuration.nix
(import ../../disko/btrfs-swap.nix {device = "/dev/nvme0n1";})
./disko/zfs.nix
../common/global
@ -25,6 +26,16 @@ in {
./arion
];
# Enable ZFS
boot.supportedFilesystems = ["zfs"];
networking.hostId = "f014fc43";
systemd.enableEmergencyMode = false;
# Prevent zfs from being automounted by fstab auto discovery & zfs
fileSystems."/storage/dataset".options = ["noauto"];
fileSystems."/storage".options = ["noauto"];
users.mutableUsers = true;
users.users.${vars.user} = {
password = "changeme";
@ -38,10 +49,6 @@ in {
};
security.pam.enableSSHAgentAuth = true;
fileSystems."/drives/hdd" = {
device = "/dev/disk/by-uuid/7d5eaff7-c17d-4fac-b7d7-7aa3c35b9a29";
};
nixpkgs = {
overlays = [
outputs.overlays.additions

120
hosts/franz/disko/zfs.nix Normal file
View file

@ -0,0 +1,120 @@
{
disko.devices = {
disk = {
a = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
b = {
type = "disk";
device = "/dev/sdb";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
c = {
type = "disk";
device = "/dev/sdc";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
d = {
type = "disk";
device = "/dev/sdd";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
e = {
type = "disk";
device = "/dev/sde";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
f = {
type = "disk";
device = "/dev/sdf";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
};
zpool = {
storage = {
type = "zpool";
mode = "raidz2";
mountpoint = "/storage";
datasets = {
dataset = {
type = "zfs_fs";
mountpoint = "/storage/dataset";
options = {
encryption = "on";
keyformat = "hex";
keylocation = "file:///home/ghoscht/.zfs/secret.key";
};
};
};
};
};
};
}