zpool

create single disk

ls -l /dev/disk/by-id/ | awk '{ print $9 " --> " $11}'

ata-WDC_WD80EZAZ-11TDBA0_1SGXH0MZ --> ../../sdp
ata-WDC_WD80EZAZ-11TDBA0_1SGXH0MZ-part1 --> ../../sdp

disk1=/dev/sdp
disk_id_1=/dev/disk/by-id/ata-WDC_WD80EZAZ-11TDBA0_1SGXH0MZ

parted $disk_id_1 mklabel gpt
parted -a optimal $disk_id_1 mkpart primary 0% 100%

zpool create -f -o ashift=12 -m /mnt/data \
-O compression=on \
-O casesensitivity=sensitive \
-O atime=off \
-O normalization=formD \
data mirror $disk1 $disk2

A note on those create parameters:

Param Meaning
ashift=12 Necessary for 4K Drives, otherwise you get shit performance
compression=on enables basic compression to save storage space (default=lz4)
casesensitivity=sensitive allows folders with names like "Folder", "folder" and "foLdEr" t
atime=off disables the creation of events in zfs when files are accessed. reduces disk access and event creation leading to a cleaner pool.
normalization=formD normalizes filenames based on UTF-8.
-m /mnt/data equivalent of zfs set mountpoint=/mnt/data but invoked on creation. Default mountpoint is just /<poolname>

Note: always use /dev/disk/by-id for pool creation and zpool import -d /dev/disk/by-id <poolname> for imports

encryption

zpool set feature@encryption=enabled <pool>

remove unavailable

zpool import
pool: arc02
id: 11385699030229332549
state: FAULTED
status: The pool metadata is corrupted.
action: The pool cannot be imported due to damaged devices or data.
The pool may be active on another system, but can be imported using
the '-f' flag.
see: http://zfsonlinux.org/msg/ZFS-8000-72
config:
arc02                     FAULTED  corrupted data
wwn-0x50014ee2b585bf2e  ONLINE
zpool labelclear -f /dev/disk/by-id/wwn-0x50014ee2b585bf2e-part1
zpool labelclear -f /dev/disk/by-id/ata-WDC_WD80EZAZ-11TDBA0_1SGWT1AZ

sharing via nfs

zfs get sharenfs <pool>

zfs set \
sharenfs="async,insecure,no_subtree_check,all_squash,anonuid=0,anongid=100,rw=@192.168.8.0/24" \
<pool>

# check what the nfs export looks like:
cat /proc/fs/nfsd/exports
/mnt/<pool> 192.168.8.0/24(rw, no_root_squash, sync, wdelay, no_subtree_check, uuid=3c6f584e:0016ed25:00000000:00000000, sec=1)


192.168.0.0/16(rw,async,insecure,no_subtree_check,all_squash,anonuid=0,anongid=100)