Table of Contents

Btrfs for root and ZFS for data with ssd cache

We have the following hardware:

And we want the following:

How can ZFS help here:

We will do this:

Steps followed

New system

Create a ZFS pool for main big data!

How to mount encrypted volume

Some tricks

offline l2arc (cache) or zil (log) devices

zpool offline poolname device
zpool offline -t poolname device (until next reboot)

online l2arc (cache) or zil (log) devices

zpool online poolname device

add l2arc (cache) or zil (log) devices

zpool add poolname cache device #cache
zpool add poolname log device  #log

remove l2arc (cache) or zil (log) devices

zpool remove poolname device

If a pool becomes damaged or some: Permanent error in some files

errors: Permanent errors have been detected in the following files: 

You can fix that be doing a short scrubing and then stopping:

sudo zpool scrub tardis
# wait a bit
sudo zpool scrub -s tardis

Then error messages are gone

In case you want to interchange (replace) a pool disk (no redundancy).

For example: if this disk is getting damaged: you may want to replace it with a new one, some files may be broken, but using:

sudo zpool replace tardis old_dev new_dev

This will copy everthing from the zfs from that disk to the new one, attach the new one and detach the old one. In this way, it is not necessary to copy the whole disk with dd.

Create a zfs pool using files instead of real disks

mkfile 100m file1
zpool create geekpool /file1

Create a ZFS raidz1 en degrated mode

https://www.reddit.com/r/zfs/comments/8enkt8/can_i_create_a_new_raidz_in_degraded_mode/

References

https://linuxhint.com/configuring-zfs-cache/

https://arstechnica.com/information-technology/2020/05/zfs-101-understanding-zfs-storage-and-performance/

https://www.howtoforge.com/tutorial/how-to-use-snapshots-clones-and-replication-in-zfs-on-linux/

https://docs.joyent.com/private-cloud/troubleshooting/disk-replacementhttps://docs.joyent.com/private-cloud/troubleshooting/disk-replacement

https://wiki.archlinux.org/index.php/btrfs#Subvolumes

https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Subvolumes

https://wiki.gentoo.org/wiki/Btrfs/Native_System_Root_Guide

https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Buster%20Root%20on%20ZFS.html

https://mohankumar-k.blogspot.com/2018/05/how-to-resolve-zpool-permanent-errors.html

https://docs.oracle.com/cd/E36784_01/html/E36835/gbbvf.html

https://www.thegeekdiary.com/zfs-tutorials-creating-zfs-pools-and-file-systems/

https://www.delphix.com/blog/delphix-engineering/openzfs-code-walk-metaslabs-and-space-maps

[10] https://www.mail-archive.com/zfs-discuss@opensolaris.org/msg22993.html

https://unix.stackexchange.com/questions/322352/create-raid-z2-in-degraded-state-possible