diff --git a/scripts/zfs/install/01-configure.sh b/scripts/zfs/install/01-configure.sh index ac51115..9d919b4 100755 --- a/scripts/zfs/install/01-configure.sh +++ b/scripts/zfs/install/01-configure.sh @@ -182,7 +182,7 @@ function create_system_dataset () # Generate zfs hostid print "Generate hostid" - zgenhostid + zgenhostid -f # Set bootfs print "Set ZFS bootfs" @@ -209,7 +209,10 @@ function import_pool () { print ":: Import zpool" zpool import -d /dev/disk/by-id -R /mnt zroot -N -f - zfs load-key zroot + if [[ -f /etc/zfs/zroot.key ]]; + then + zfs load-key zroot + fi } function mount_system () diff --git a/scripts/zfs/install/02-install.sh b/scripts/zfs/install/02-install.sh index 0caa07a..0195458 100755 --- a/scripts/zfs/install/02-install.sh +++ b/scripts/zfs/install/02-install.sh @@ -158,7 +158,11 @@ EOF print ":: Copy ZFS files" cp /etc/hostid /mnt/etc/hostid cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache - cp /etc/zfs/${zpoolname}.key /mnt/etc/zfs + if [[ -f /etc/zfs/zroot.key ]]; + then + cp /etc/zfs/${zpoolname}.key /mnt/etc/zfs + fi + ### Configure username if [[ -d /mnt/home/${user} ]]; @@ -237,7 +241,7 @@ EOSF cpanm --notest --installdeps . # Create swap - zfs create -V 8GB -b \$(getconf PAGESIZE) -o compression=zle -o logbias=throughput -o sync=always -primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false zroot/swap + zfs create -V 8GB -b \$(getconf PAGESIZE) -o compression=zle -o logbias=throughput -o sync=always -o primarycache=metadata -o secondarycache=none -o com.sun:auto-snapshot=false zroot/swap mkswap -f /dev/zvol/zroot/swap swapon /dev/zvol/zroot/swap echo '/dev/zvol/zroot/swap none swap discard 0 0' > /etc/fstab