ZFS: Create a raidz Filesystem

Last Updated on

ZFS supports a type of RAID-5 redundancy called raidz. This redundancy works at the ZFS pool level and affects all created filesystems in that pool. According to the Sun docs, raidz offers “better distribution of parity [than RAID-5] and eliminates the ‘RAID-5 write hole’ (in which data and parity become inconsistent after a power loss).” Creating RAID volumes in most volume managers (like VeritasVM) requires learning a new language describing the various components involved. ZFS only requires one command.

Creating a raidz pool is similar to creating a normal pool. Only the addition of the ‘raidz’ keyword is required:

zpool create rex raidz c1t0d3 c1t0d4 c1t0d5 c1t0d6

This command creates a raidz pool named “rex” consisting of four disks. One aspect that is slightly different in a ZFS raidz pool versus other RAID-5 filesystems is that the reported available disk space does not subtract the space required by parity. Consider the following “zfs list” output before and after creating a 10G file in a raidz filesystem.

# zfs list
rex 219K 76.8G 49K /rex
# cd /rex
# mkfile 10g bigfile
# zfs list
rex 13.4G 63.4G 13.4G /rex

Although the file added only 10G to the filesystem, the change in the used space is 13.4G, so the parity is reflected in the usage. This is important to keep in mind as you monitor your filesystem.


About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.