From CaveLab

ZFS is a combined file system and logical volume manager designed by Sun Microsystems. ZFS is scalable, and includes extensive protection against data corruption, support for high storage capacities, efficient data compression, integration of the concepts of filesystem and volume management, snapshots and copy-on-write clones, continuous integrity checking and automatic repair, RAID-Z, native NFSv4 ACLs, and can be very precisely configured. (source: Wikipedia)



sudo zpool create testpool -o ashift=12 raidz1 /dev/disk/by-id/ata-ST2000DM001-1CH164_W1E5ETF9 /dev/disk/by-id/ata-ST2000DM001-1CH164_Z1E68GLR /dev/disk/by-id/ata-ST2000DM001-1CH164_Z1E6CQPW
sudo zpool status
Make sure that you create your pools such that the vdevs have the correct alignment shift for your storage device’s size. if dealing with flash media, this is going to be either 12 (4K sectors) or 13 (8K sectors). http://open-zfs.org/wiki/Performance_tuning


sudo zpool add (-n) (-f) tank0 -o ashift=12 raidz2 /dev/disk1 /dev/disk2 /dev/disk3 /dev/disk4
  • n: dry-run, shows what the new configuration will look like
  • f: required if the disks are of different sizes


sudo zfs set compression=lz4 testpool
sudo zfs get compression testpool
Size reduced with compression:
  • VirtualBox VM: 48G → 34G
  • Documents, photos, videos, etc: 395G → 388G


zpool iostat testpool 1
zfs get space (pool/dataset)


zpool scrub files

Replace disk

zpool replace (-f) testpool /dev/disk/old /dev/disk/new
  • f: forces use of new disk, even if its appears to be in use


sudo zpool destroy tank


# Create
sudo zfs create testpool/test

# Remove
sudo zfs destroy testpool/test (-r)

# List
sudo zfs list


# Create
sudo zfs snap testpool/test@snap

# Destroy
sudo zfs destroy testpool/test@snap

# List
sudo zfs list -t snapshot

Send and receive

# local
zfs send tank/data@snap1 | zfs recv spool/ds01

# allow regular user to send
sudo zfs allow username send,snapshot,mount tank/data
# remote
zfs send tank/dana@snap1 | ssh host2 zfs recv spool/ds01

# allow regular user to receive
sudo zfs allow username receive,create,mount spool
Delegating mount rights to a regular user doesn't work in Linux...