ZFS Linux CheatSheet

Installing ZFS on linux debian/ubuntu

sudo apt install zfsutils-linux

Creating ZFS pools and datasets

# Create mirrored pool with 2 disks
# Default mount location /pool_name
sudo zpool create pool_name mirror /dev/sdb /dev/sdc

# Create mirrored pool with 2 disks
# Custom mount location
sudo zpool create -m /mnt/mount_name pool_name mirror /dev/sdb /dev/sdc

# Create striped pool with 2 disks
# Default mount location /pool_name
sudo zpool create pool_name /dev/sdb /dev/sdc

# Create new dataset
sudo zfs create pool name/dataset name

Basic ZFS commands

zfs list # list all pools and datasets
zpool status  # view status of pools
zpool list -v 

Snapshots

# List snapshots
zfs list -t snapshot

# Create new snapshot
zfs snapshot pool_name/dataset_name@snapshot_name

# Rollback snapshot
zfs rollback -r pool_name/dataset_name@snapshot_name

# Delete snapshot
zfs destroy pool_name/dataset_name@snapshot_name

Other commands

# List available non imported pools
zpool import

# Force import of non properly exported pool
sudo zpool import -f pool_name

# Scrub pool
sudo zpool scrub pool_name

# Set custom mountpoint for dataset
sudo zfs set mountpoint=/path/to/mount pool_name/dataset_name