fix zfs installation script

This commit is contained in:
Dmitriy Kholkin 2022-09-29 20:57:27 +03:00
parent 6222bc290d
commit 7c2bbb4df7
2 changed files with 10 additions and 11 deletions

View File

@ -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 <<CONFIG > "$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 <<CONFIG > "$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

View File

@ -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;
}