ZFS: Difference between revisions

From David's Wiki
Line 22: Line 22:
* You should always use the id under <code>/dev/disk/by-id/</code>
* You should always use the id under <code>/dev/disk/by-id/</code>
** E.g. <code>/dev/disk/by-id/ata-diskA</code>
** E.g. <code>/dev/disk/by-id/ata-diskA</code>
==Alerts==
First [https://askubuntu.com/questions/1332219/send-email-via-gmail-without-other-mail-server-with-postfix setup postfix to send emails].<br>
Then [https://askubuntu.com/questions/770540/enable-zfs-zed-email-notifications-on-16-04 setup ZED notifications]


==Pros and Cons==
==Pros and Cons==

Revision as of 23:38, 8 February 2022

How to use ZFS:

Background

There are three levels to understand

  • zpools are a JBOD of one or more vdevs
  • vdevs are groups of drives, likely in raidz (or raidz2, raidz3) or mirror.
  • datasets are filesystems stored on a zpool, similar to partitions
  • zvol is a virtual block device on a zpool without a filesystem

Usage

# Create a zpool with a mirror vdev.
zpool create -f -o ashift=12 -o compression=lz4 $zpool_name mirror \
  ata-diskA \
  ata-diskB

# Create a dataset.
zfs create -o encryption=aes-256-gcm -o keyformat=passphrase $zpool_name/$dataset_name
Notes
  • You should always use the id under /dev/disk/by-id/
    • E.g. /dev/disk/by-id/ata-diskA

Alerts

First setup postfix to send emails.
Then setup ZED notifications

Pros and Cons

VS Snapraid + btrfs + mergerfs

Pros
  • ZFS has realtime parity.
  • ZFS can work while degraded.
  • ZFS snapshots with send and receive.
  • ZFS has encryption on per-dataset.
  • ZFS handles everything altogether including parity on permissions
Cons
  • The main con is that ZFS is less expandable.
    • You can only expand by replacing every drive or adding entire vdevs.
  • If many drives die, i.e. >2 for raidz2, you lose all your data.

Resources