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"
  • sudo ls /dev/disk/by-id/ | grep ata | grep -v part[1-9] | tr '\n' ' '

Create raidz1 (similar to raid5) Samba/CIFS Pool for Windows Clients

  • zpool create -O casesensitivity=insensitive data raidz1 device1 device2 device3 device4
  • zfs get casesensitivity data (should be insensitive for windows)
  • check pool status sudo zpool status
  • Verify the pool with scrub sudo zpool scrub data
  • Cancel a scrub sudo zpool scrub -s data
  • add monthly scrub task to crontab sudo crontab -l | { cat; echo "@monthly zpool scrub data"; } | crontab -

add scrub task on reboot to crontab

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

Samba Config

[data]
path = /data
read only = no
browsable = yes
guest ok = no
writable = yes

replace failed drive

sudo ls /dev/disk/by-id/ | grep "ata"
sudo zpool replace data 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

Samba