{{{#!highlight sh # ZFS DRIVES=$(echo /dev/sd{a..j}) for i in $DRIVES; do # Clear any existing partition table echo sudo sgdisk --zap-all $i echo sudo sgdisk --largest-new=1 $i done # TODO: should give whole disks to ZFS DRIVE_PARTITIONS=$(echo /dev/sd{e,d,c,f,h,g,i,j}1) NAME=archive CACHE_DISKS="nvme-SAMSUNG_MZQL2960HCJR-00A07*-part3" DATA_DISKS="ata-TOSHIBA_MG08ACA16TEY_*" ## create main array, 1-disk party raidz # use ashift=12 for 4K sector disks sudo zpool create -o ashift=12 -f $NAME raidz /dev/disk/by-id/${DATA_DISKS} # no parity disk raid0 equivalent sudo zpool create -o ashift=12 -f $NAME /dev/disk/by-id/${DATA_DISKS} ## add cache sudo zpool add -f $NAME cache /dev/disk/by-id/${CACHE_DISKS} ## list devices zpool status -v sudo zfs set xattr=sa ${NAME} sudo zfs set compression=lz4 ${NAME} sudo zfs set atime=off ${NAME} sudo zfs set relatime=off ${NAME} # See https://blog.programster.org/zfs-record-size about setting recordsize #sudo zfs set recordsize=16K ${NAME} # For BitTorrent sudo zfs set recordsize=1M ${NAME} # For long-term storage # Deduplication. Requires system w/ large amount of RAM sudo zfs set dedup=on ${NAME} ## show pool information from member device, e.g. /dev/sde sudo zdb -l /dev/sde1 ## get all parameters sudo zfs get all ${NAME} ROOT=/mnt mount /dev/md1 /mnt mount /dev/md0 /mnt/boot mount -o bind /proc /mnt/proc mount -o bind /sys /mnt/sys mount -o bind /run /mnt/run mount -o bind /dev /mnt/dev installimage -n geta -r yes -l 1 -p /boot:ext3:1G,/:xfs:128G -f yes -t yes -d nvme0n1,nvme1n1 -i /root/images/Debian-1101-bullseye-amd64-base.tar.gz }}} == References == https://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/ https://openzfs.github.io/openzfs-docs/Performance%20and%20Tuning/Workload%20Tuning.html#bit-torrent [[https://www.delphix.com/blog/delphix-engineering/zfs-raidz-stripe-width-or-how-i-learned-stop-worrying-and-love-raidz| ZFS RAIDZ stripe width, or: How I Learned to Stop Worrying and Love RAIDZ]]: Use RAID-Z. Not too wide. Enable compression. [[https://klarasystems.com/articles/openzfs-draid-finally/|dRAID, Finally!]]: Intro to dRAID, ZFS RAID w/ fixed record size to enable faster resilvers.