Talk: ZFS

From NixOS Wiki
Jump to: navigation, search

Add boot.initrd.supportedFilesystems = ["zfs"]; ?

What about recommending to also add

boot.initrd.supportedFilesystems = ["zfs"];


I think recommending to add this would allow you in the far future to use zfs as filesystem without forcing to add grub support for zfs if you don't need it.

I currently have open to revert back to that behaviour like it's been in 20.09 (adding a zfs filesystem also adds support to grub, more exactly the original behaviour was to always enable zfs support in grub even without any zfs filesystem)

--Mohe2015 (talk) 15:46, 22 March 2021 (UTC)

Multiple Encrypted Pools Issue

I tried following the "Import and unlock multiple encrypted pools/dataset at boot" section (and friends) but could not get it to work, with the dataset either not being mounted, or the boot aborting with a permission error. What finally fixed it for me:

 # Create pool like so:
 zpool create <your-other-options> -O keyformat=passphrase pool_name $DISK_HDD

And use this for

       cat <<EOF > /root/.profile
       if pgrep -x "zfs" > /dev/null
         zpool import hdd  # Import pool like in example
         sleep 3           #  <---- THIS IS THE IMPORTANT PART
         zfs load-key -a
         killall zfs
         echo "zfs not running -- maybe the pool is taking some time to load for some unforseen reason."

Long story short, I think the example on the ZFS page should include the sleep.

Unable to follow instructions from "Laying out the filesystem hierarchy"

I tried following the instructions from ZFS#Laying_out_the_filesystem_hierarchy but the system never fully booted and had errors about being unable to mount "/home" or "/root".

The fix was to use a legacy mountpoint instead, while also reducing the number of ZFS data sets to a minimum and using "/" as a ZFS data set instead of tmpfs. --Grische (talk) 12:45, 26 February 2022 (UTC)

Inclusion of /var/persist

Looking over the post, there is no mention of creating a /var/persist directory. I'd personally recommend adding it as a separate volume/dataset which is autosnapshotted in case it is needed.

# zfs create -o canmount=on rpool/nixos/var/persist

--Keksbg (talk) 21:55, 29 March 2022 (UTC)

best practice