ZFS Raid and RAIDZ techniques
Within Solaris with UFS file systems we can create RAID volumes with the aid of a volume manager (SDS/VxVM, etc). With the introduction of ZFS we can now apply RAID techniques without the need for additional software components. ZFS has the capability of creating RAID devices out of the box.
Basic ZFS Pool
- Dynamic strip — This a very basic pool which can be created with a single disk or a concatenation of disk.
- Single whole-disk pool:
# zpool create testraid c4t0d1 # zpool list NAME SIZE ALLOC FREE CAP HEALTH ALTROOT rpool 9.94G 6.13G 3.81G 61% ONLINE - testraid 504M 78.5K 504M 0% ONLINE -
- Concatenated ZFS pool:
# zpool create testraid c4t0d1 c4t0d2 # zpool list NAME SIZE ALLOC FREE CAP HEALTH ALTROOT rpool 9.94G 6.13G 3.81G 61% ONLINE - testraid 1.97G 80K 1.97G 0% ONLINE - # zpool status testraid pool: rpool state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM rpool ONLINE 0 0 0 c3t0d0 ONLINE 0 0 0 errors: No known data errors
pool: testraid state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM testraid ONLINE 0 0 0 c4t0d1 ONLINE 0 0 0 c4t0d2 ONLINE 0 0 0 errors: No known data errors
- Single whole-disk pool:
- Mirrored pool — A mirrored pool provides you the redundancy which enables us to store multiple copies of data on different disks. Here you can also detach a disk from the pool as the data will be available on the another disks.
- 2 way mirror
# zpool create testraid mirror c4t0d0 c4t1d0 # zpool status testraid pool: testraid state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM testraid ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c4t0d0 ONLINE 0 0 0 c4t1d1 ONLINE 0 0 0 errors: No known data errors
- 3 way mirror
# zpool destroy testraid # zpool create testraid mirror c4t0d0 c4t1d0 c4t2d0 # zpool status testraid pool: testraid state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM testraid ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 c4t0d0 ONLINE 0 0 0 c4t1d0 ONLINE 0 0 0 c4t2d0 ONLINE 0 0 0 errors: No known data errors
- 2 way mirror
RAID-Z Pools
We can also have a pool similar to a RAID-5 configuration called RAIDZ. There are of 3 types of RAIDZ within ZFS.
- RAIDZ1 — Single parity — Minimum two disks required — If one disk fails, data can be retrieved using the other disk and parity. For example:
# zpool create testraid raidz1 c5t0d1 invalid vdev specification: raidz1 requires at least 2 devices # zpool create testraid raidz1 c5t0d1 c5t0d2 # zpool status testraid pool: testraid state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM testraid ONLINE 0 0 0 raidz1-0 ONLINE 0 0 0 c5t0d1 ONLINE 0 0 0 c5t0d2 ONLINE 0 0 0 errors: No known data errors
- RAIDZ2 — Double parity — Minimum three disks required — If two disks fail data can be retrieved using the other disks and parity. For example:
# zpool create testraid raidz2 c5t0d1 c5t0d2 invalid vdev specification: raidz2 requires at least 3 devices # zpool create testraid raidz2 c5t0d1 c5t0d2 c5t0d3 # zpool status testraid pool: testraid state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM testraid ONLINE 0 0 0 raidz2-0 ONLINE 0 0 0 c5t0d1 ONLINE 0 0 0 c5t0d2 ONLINE 0 0 0 c5t0d3 ONLINE 0 0 0 errors: No known data errors
- RAIDZ3 — Triple parity — Minimum four disks required — If three disks fail, data can be retrieved using the other disks and parity. For example:
# zpool create testraid raidz3 c5t0d1 c5t0d2 c5t0d3 invalid vdev specification: raidz3 requires at least 4 devices # zpool create testraid raidz3 c5t0d1 c5t0d2 c5t0d3 c5t1d1 # zpool status pool: testraid state: ONLINE scan: none requested config: NAME STATE READ WRITE CKSUM testraid ONLINE 0 0 0 raidz3-0 ONLINE 0 0 0 c5t0d1 ONLINE 0 0 0 c5t0d2 ONLINE 0 0 0 c5t0d3 ONLINE 0 0 0 c5t1d1 ONLINE 0 0 0 errors: No known data errors