ZFS

From TBP Wiki
Jump to: navigation, search

ZFS—previously Zettabyte File System—features:

  • logical volume management (pooled storage) with checkpoints,
  • copy-on-write,
  • snapshots, clones (writable snapshots) and bookupdate-initramfs -u -k allmarks (lightweight change markers),
  • scrubbing (data integrity verification and automatic repair),
  • RAID-Z,
  • a maximum 16 exabyte file size,
  • a maximum 256 quadrillion zettabyte storage with no limit on number of filesystems (datasets) or files.

For an overview of ZFS concepts see zfsconcepts(7).

For an overview of ZFS storage pools see zpoolconcepts(7), see also zpool(8).

ZFS is licensed under the Common Development and Distribution License (CDDL). Because the CDDL is incompatible with the GNU General Public License (GPL), it is not possible for ZFS to be included in the Linux kernel. This requirement, however, does not prevent a native Linux kernel module from being developed and distributed by a third party, as is the case with OpenZFS (previously named ZFS on Linux).

As a result of ZFS not being included in the Linux kernel (with other words, ZFS kernel modules are out-of-tree), and Arch Linux is a rolling release distribution:

   OpenZFS project must keep up with Linux kernel versions.
   After making stable OpenZFS release—ArchZFS maintainers release them.
   There will often be brief periods when the kernel-specific packages in the ArchZFS repository are not in sync with those in the Arch Linux repositories. This situation locks down the normal rolling update process by unsatisfied dependencies because the new kernel version, proposed by update, is unsupported by ArchZFS.
   So you might prefer to use the Dynamic Kernel Module Support (DKMS) package, but ZFS modules may fail to compile with the latest kernel if it is unsupported by OpenZFS.


Encrypted zpools on LUKS

This shows how to encrypt a drive, enroll it to automatically unlock at boot using TPM, and set up a zpool on that encrypted drive.   !!!!!!!THIS IS DESTRUCTIVE!!!!!!!

Unmount:

   zfs umount XXXXX

Export:

   zpool export XXXXX

Destroy pool (irreversible!):

   zpool destroy XXXXX

Wipe signatures:

   wipefs -a /dev/sdX

Set up the encryption:

   cryptsetup luksFormat /dev/sdX
   cryptsetup luksOpen /dev/sdX cryptXXXXX

Enroll in TPM:

   systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+7 /dev/sdX

Create the zpool:

   zpool create -o ashift=12 XXXXX /dev/mapper/cryptXXXXX
   zfs set mountpoint=/mnt/XXXXX XXXXX
   zpool status XXXXX

  Get the blkid for the crypttab:

   blkid -s UUID -o value /dev/sdX

Add to /etc/crypttab:

   crypttank2 UUID=$(UUID goes here!) none luks,tpm2-device=auto
   update-initramfs -u -k all

Reboot when finished.