Quick & Easy: Setting up ZFS raidz on Ubuntu

Simple guide to ZFS

Install zfs

sudo apt install zfs-dkms zfs-zed zfsutils-linux

Locate the drives you want into your array

sudo ls /dev/disk/by-id | grep "ata"

Create a raidz1 (similar to raid5) pool with data as the name of the pool

sudo zpool create data raidz1 device1 device2 device3 device4

check pool status

sudo zpool status

verify the pool with scrub

sudo zpool scrub data

sudo zpool scrub -s data (cancel a scrub)

add weekly scrub task to crontab

sudo crontab -l | { cat; echo "@weekly zpool scrub data"; } | crontab -

add scrub task on reboot to crontab

sudo crontab -l | { cat; echo "@reboot sleep 25 && zpool scrub data"; } | crontab -

replace failed drive

sudo ls /dev/disk/by-id/ | grep "ata"
sudo zpool replace old-disk new-disk
sudo watch -n1 zpool status

Tweaks to improve Samba & small files access

destroy the pool (REMOVES DATA!)

sudo zpool destroy data (removes data!)

More Resources


DigitalOcean Referral Badge
Keep my site online & receive a $100 60-day credit at DigitalOcean for your VPS Hosting
Cheaper Games on Instant-Gaming
Proudly published with Ghost | Header Image by GUWEIZ@DeviantArt Creative Commons Licence