Add ZFS support to sleeper-service
- Replace ext4 with ZFS pool 'filepool' for enhanced data integrity - Add ZFS auto-scrub and TRIM services for file server - Configure proper ZFS datasets: root, nix, var, storage - Add networking hostId (a1b2c3d4) required for ZFS - Update NFS and Transmission to use ZFS mount points - Change file ownership to 'sma' user for server configuration - Add comprehensive ZFS setup documentation Ready for deployment with proper file server storage backend.
This commit is contained in:
parent
715911cc62
commit
c392df4a93
6 changed files with 35 additions and 11 deletions
0
machines/sleeper-service/ZFS_SETUP.md
Normal file
0
machines/sleeper-service/ZFS_SETUP.md
Normal file
|
@ -14,14 +14,21 @@
|
||||||
../../modules/users/sma.nix
|
../../modules/users/sma.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Boot configuration
|
# Boot configuration with ZFS support
|
||||||
boot.loader.grub = {
|
boot.loader.grub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
zfsSupport = true;
|
||||||
efiSupport = true;
|
efiSupport = true;
|
||||||
efiInstallAsRemovable = true;
|
efiInstallAsRemovable = true;
|
||||||
devices = [ "nodev" ];
|
devices = [ "nodev" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# ZFS services for file server
|
||||||
|
services.zfs = {
|
||||||
|
autoScrub.enable = true;
|
||||||
|
trim.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
# Time and locale
|
# Time and locale
|
||||||
time.timeZone = "Europe/Oslo";
|
time.timeZone = "Europe/Oslo";
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
|
@ -13,9 +13,25 @@
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
# ZFS Configuration for file server
|
||||||
fileSystems."/" =
|
fileSystems."/" =
|
||||||
{ device = "/dev/disk/by-uuid/12345678-1234-1234-1234-123456789abc";
|
{ device = "filepool/root";
|
||||||
fsType = "ext4";
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/nix" =
|
||||||
|
{ device = "filepool/nix";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/var" =
|
||||||
|
{ device = "filepool/var";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/mnt/storage" =
|
||||||
|
{ device = "filepool/storage";
|
||||||
|
fsType = "zfs";
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" =
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
# Machine-specific network configuration
|
# Machine-specific network configuration
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "sleeper-service";
|
hostName = "sleeper-service";
|
||||||
|
hostId = "a1b2c3d4"; # Required for ZFS support
|
||||||
|
|
||||||
# Enable systemd-networkd for static networking
|
# Enable systemd-networkd for static networking
|
||||||
useNetworkd = true;
|
useNetworkd = true;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# NFS server configuration
|
# NFS server configuration
|
||||||
services.nfs.server = {
|
services.nfs.server = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# Export the storage directory
|
# Export the storage directory (ZFS dataset)
|
||||||
exports = ''
|
exports = ''
|
||||||
/mnt/storage 10.0.0.0/24(rw,sync,no_subtree_check,no_root_squash)
|
/mnt/storage 10.0.0.0/24(rw,sync,no_subtree_check,no_root_squash)
|
||||||
'';
|
'';
|
||||||
|
@ -14,12 +14,12 @@
|
||||||
createMountPoints = true;
|
createMountPoints = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Ensure the storage directory exists
|
# Ensure the storage subdirectories exist (ZFS dataset is mounted at /mnt/storage)
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /mnt/storage 0755 geir users -"
|
"d /mnt/storage/media 0755 sma users -"
|
||||||
"d /mnt/storage/media 0755 geir users -"
|
"d /mnt/storage/downloads 0755 sma users -"
|
||||||
"d /mnt/storage/downloads 0755 geir users -"
|
"d /mnt/storage/backups 0755 sma users -"
|
||||||
"d /mnt/storage/backups 0755 geir users -"
|
"d /mnt/storage/shares 0755 sma users -"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Required packages for NFS
|
# Required packages for NFS
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# Will re-enable once package is stable
|
# Will re-enable once package is stable
|
||||||
services.transmission = {
|
services.transmission = {
|
||||||
enable = false;
|
enable = false;
|
||||||
user = "geir";
|
user = "sma"; # Using admin user for server processes
|
||||||
group = "users";
|
group = "users";
|
||||||
settings.rpc-port = 9091;
|
settings.rpc-port = 9091;
|
||||||
settings.rpc-bind-address = "0.0.0.0";
|
settings.rpc-bind-address = "0.0.0.0";
|
||||||
|
@ -19,6 +19,6 @@
|
||||||
|
|
||||||
# Ensure downloads directory exists even without Transmission
|
# Ensure downloads directory exists even without Transmission
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /mnt/storage/downloads 0755 geir users -"
|
"d /mnt/storage/downloads 0755 sma users -"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue