From 7c2bbb4df70d05abda3165455d0ecd7d521c8bd3 Mon Sep 17 00:00:00 2001 From: Dmitriy Kholkin Date: Thu, 29 Sep 2022 20:57:27 +0300 Subject: [PATCH] fix zfs installation script --- install/install-zfs.sh | 17 +++++++---------- machines/Testing-VM/default.nix | 4 +++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/install/install-zfs.sh b/install/install-zfs.sh index 5007860..7a4d2c8 100755 --- a/install/install-zfs.sh +++ b/install/install-zfs.sh @@ -4,11 +4,12 @@ set -e CONFIG_FOLDER="$(dirname "$(pwd)")" -DEVICE_NAME=AMD-Workstation -MAX_JOBS=8 +DEVICE_NAME=Testing-VM +MAX_JOBS=4 SWAP_SIZE=16GiB USE_ECNRYPTION=false -ZFS_ARC_MAX=8589934592 +ZFS_ARC_MAX=1073741824 +# ZFS_ARC_MAX=8589934592 # 8GiB # ZFS_ARC_MAX=4294967296 # Max ARC cache size. default = 4GiB ZFS_ASHIFT=12 # recommended=12 which 1<<12 (4096) @@ -159,7 +160,6 @@ fi pprint "Create ZFS pool on $ZFS" zpool create \ -f \ - # -m none \ -o ashift=$ZFS_ASHIFT \ -o autotrim=on \ -R /mnt \ @@ -167,12 +167,11 @@ zpool create \ -O atime=on \ -O canmount=off \ -O compression=zstd \ - -O dnodesize=auto + -O dnodesize=auto \ -O normalization=formD \ -O relatime=on \ -O xattr=sa \ -O dedup=off \ - # -O com.sun:auto-snapshot=true \ -O mountpoint=/ \ rpool "$ZFS" @@ -219,19 +218,17 @@ if [[ "$USE_ECNRYPTION" = true ]] then cat < "$HARDWARE_CONFIG" networking.hostId = "$HOSTID"; - boot.kernelParams = [ "nohibernate" ]; boot.initrd.luks.devices."$LUKS_DEVICE_NAME".device = "/dev/disk/by-partuuid/$LINUX_DISK_UUID"; boot.zfs.devNodes = "$ZFS"; boot.supportedFilesystems = [ "zfs" ]; - boot.kernelParams = [ "zfs.zfs_arc_max=$ZFS_ARC_MAX" ]; + boot.kernelParams = [ "zfs.zfs_arc_max=$ZFS_ARC_MAX" "nohibernate" ]; CONFIG else cat < "$HARDWARE_CONFIG" networking.hostId = "$HOSTID"; - boot.kernelParams = [ "nohibernate" ]; boot.zfs.devNodes = "$ZFS"; boot.supportedFilesystems = [ "zfs" ]; - boot.kernelParams = [ "zfs.zfs_arc_max=$ZFS_ARC_MAX" ]; + boot.kernelParams = [ "zfs.zfs_arc_max=$ZFS_ARC_MAX" "nohibernate" ]; CONFIG fi diff --git a/machines/Testing-VM/default.nix b/machines/Testing-VM/default.nix index c65b01d..d9a50f7 100644 --- a/machines/Testing-VM/default.nix +++ b/machines/Testing-VM/default.nix @@ -1,4 +1,4 @@ -{ inputs, config, lib, pkgs, ... }: { +{ inputs, modulesPath, lib, ... }: { imports = [ "${modulesPath}/profiles/qemu-guest.nix" ./hardware-configuration.nix @@ -29,4 +29,6 @@ deviceSpecific.wireguard.enable = false; hardware.video.hidpi.enable = lib.mkForce false; + + boot.kernelPackages = lib.mkForce boot.zfs.package.latestCompatibleLinuxPackages; }