Quick & Easy: Setting up ZFS raidz on Ubuntu
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 raidz1 (similar to raid5) Samba/CIFS Pool (casesensitivity mixed pool) for Windows Clients
zpool create -O casesensitivity=mixed data raidz1 device1 device2 device3 device4
zfs get casesensitivity data
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
zfs set xattr=sa data
- http://www.nerdblog.com/2013/10/zfs-xattr-tuning-on-linux.html
zfs set atime=off data
- https://www.unixtutorial.org/zfs-performance-basics-disable-atime/
destroy the pool (REMOVES DATA!)
sudo zpool destroy data (removes data!)
More Resources
- Checking ashift on existing pools – charsiurice (wordpress.com)
- https://blog.khmersite.net/2013/09/changing-zfs-pool-to-use-disk-id-instead-of-disk-assignment/
- https://www.unixtutorial.org/getting-started-with-zfs-ubuntu-20-04/
- https://thesmarthomejourney.com/2022/02/07/zfs-alert-via-pushover/
- https://docs.oracle.com/cd/E36784_01/html/E36835/gbctx.html
- https://news.ycombinator.com/item?id=23455772
Samba