User:Nathanlkoch/Tutorials/TrueNASzfs to Gentoo
TrueNAS Encrypted ZFS Pool to Gentoo
This document should assist you in mounting a encrypted zfs pool from TrueNAS onto Gentoo.
For the use of this document my pools name is SpacePool
Install and Configure
Do the kernel bits and install zfs-kmod.
Mount to pool
Do a quick fdisk -l. It will show you all your drives and uuid information. It will also show you the name of your ZFS pool.
zpool import -f SpacePool
It's kind enough to know I have multiple disks in the set. Very nifty.
Save the key
In TrueNAS you want to store your encryption keys. The file will save to something like this "dataset_NAMEOFDATASET_keys.json". Save it somewhere to the disk. Open it and remove everything not in between the quotations. Leaving just the encryption key. I saved mine to something easy to find.
Set the key
Set the key to the proper pool.
zfs set keylocation=file:///etc/spacepool.key SpacePool
Load the key
zfs load-key -a
-a will load all available keys.
Set mount point
zfs set mountpoint=/home/USER/Space SpacePool/Backup
Mount the Dataset
A simple "zfs list" will show you all configured datasets.
zfs mount SpacePool/Backup
Mount at boot
/etc/systemd/system/zfs-load-key.service [Unit] Description=Load encryption keys DefaultDependencies=no After=zfs-import.target Before=zfs-mount.service [Service] Type=oneshot RemainAfterExit=yes ExecStart=/sbin/zfs load-key -a StandardInput=tty-force [Install] WantedBy=zfs-mount.service
systemctl enable zfs-import-cache.service
systemctl enable zfs-mount.service
systemctl enable zfs.target
systemctl enable zfs-load-key
systemctl enable zfs-import.target