Skip to content
JayBeeDe edited this page Jan 6, 2024 · 1 revision

ZFS is a file system and a logical volume management software

ZFS

ZFS

Definitions

Dataset

The root of the pool is technically a dataset as well.

File system

A ZFS dataset is most often used as a file system

Volume

ZFS can also create volumes, which are block devices

to put other FS on top of ZFS

volume is a "dataset type" with a specified size

Copies

When set to a value greater than 1, the copies property instructs ZFS to maintain multiple copies of each block in the File System or Volume.

Dataset: Quotas vs Reservations

Dataset quotas are used to restrict the amount of space that can be consumed by a particular dataset.

Reference Quotas work in very much the same way, but only count the space used by the dataset itself, excluding snapshots and child datasets.

Similarly, user and group quotas can be used to prevent users or groups from using all of the space in the pool or dataset.

Reservations guarantee a minimum amount of space will always be available on a dataset. The reserved space will not be available to any other dataset. This feature can be especially useful to ensure that free space is available for an important dataset or log files.

ZFS Raid Layout vs classical Raid

ZFS

With RAIDZ, there is no fixed proportion of parity to the data.

In RAIDZ, recordsize block of data is compressed first. Compressed data is distributed across the disks, along with a parity block. So for each file, the FS needs to consult metadata to find out:

  • where the file record is
  • where the parity is.

Types of failures

Drive Failures

  • Fail-Stop

When hardware failed or certain sectors are reporting errors when read

  • Silent data corruption

Drive returns incorrect data without any warning and without any method to discern that the data is in fact incorrect.

Contrary to traditional RAID, RAIDZ can reconstruct damaged data by the way of a checksum.

Loss of Metadata

Since classical RAID have regular data blocks sizes and parity blocks, metadata can be recovered / are not crucial. For RAIDZ, it is not possible to recover from a loss of metadata.

Write hole

Is a general system RAID failure. Could be either HW, FW or SW issue depending on whether the RAID nature. Occurs when power and/or HW, FW or RAID SW failed mid-write. Power failure can be avoided thanks to UPS or battery. Nevertheless workarounds are not 100% effective since, firmware crashes could occurs. With RAIDZ, the following elements make the write hole issue go away:

  • Transactions
  • Copy-on-write
  • Checksums

Rebuild speed

Rebuild for traditional RAID requires all the block to be rebuild: used and free. This uses to be faster than RAIDZ.

RAIDZ requires only used data blocks to be rebuild. This takes usually more time, but can be faster than traditional RAID, only in the case not many used blocks.

ZFS Specific commands

zfs list; zpool status
zpool create -o ashift=12 new-pool /dev/sda /dev/sdb
#RAID0
zpool create -o ashift=12 new-pool mirror /dev/sda /dev/sdb
#RAID1
zpool create -o ashift=12 new-pool raidz1 /dev/sda /dev/sdb /dev/sdc
#RAIDZ-1
zpool create -o ashift=12 new-pool raidz2 /dev/sda /dev/sdb /dev/sdc /dev/sdd
#RAIDZ-2
zpool add -new-pool log <device-part1> cache <device-part2>
#Add cache and log to an existing pool
zpool destroy new-pool
#remove existing pool
zpool add new-pool spare /dev/sde
#add spare to existing pool

zfs
guid

autoexpand=on | off
autoreplace=on | off
failmode=wait | continue | panic

Source

https://www.klennet.com/notes/2019-07-04-raid5-vs-raidz.aspx

Clone this wiki locally