zpool setup

2024

Install on Debian

  • Debian - install zfs

codename=$(lsb_release -cs);echo "deb http://deb.debian.org/debian $codename-backports main contrib non-free"|sudo tee -a /etc/apt/sources.list
sudo apt update -y
sudo apt install -y linux-headers-amd64
sudo apt install -y -t stable-backports zfsutils-linux

Create a zpool

Single, encrypted disk

Creating a ZFS pool with a single disk and data encryption

zpool create -O encryption=on -O keyformat=passphrase myencryptedpool /dev/sdb

To check if the encryption is active and its properties.

zfs get encryption,keyformat,keylocation myencryptedpool

To unplug the disk and put it on another computer

# Unplug
zfs unmount /myencryptedpool
zpool export myencryptedpool

# Plugin
zpool import myencryptedpool
zfs load-key backup
zfs mount backup

Replacing a faulty disk

  • List of devices

sudo fdisk -l
lsblk
  • Find device ids

ls -rtl /dev/disk/by-id
  • Do the replacement

sudo zpool replace zfspool 12349527577240784111 scsi-360022480139c3432add22462c9895933

Managing Data Corruption

  • Integrity check

zpool scrub tank
  • Get status of the pool

zpool status -v tank