[Discuss] ZFS for an Encrypted External Disk: My Experience and Notes

markw at mohawksoft.com markw at mohawksoft.com
Thu Jul 28 10:52:15 EDT 2022


ZFS Uses:

ZFS is really great for backups. We all know that the best backup is two
copies. My previous company had a product strategy that allows incremental
backups backups "forever" and always resulted in a "full."

Configure your "master" or server using ZFS.
Configure your replication target also with ZFS.

Enable compression on both. Most of the time the overhead is negligible
and saves both disk and I/O.

Create your first snapshot.
Use zfs send to replicate your zfs data to your replication target using
the snapshot.

Backup:
    (time passes)
    Create a new snapshot
    Use ZFS send to send an incremental backup to the replication target
based on the difference between the previous  and new snapshot.

    Delete previous snapshot if you no longer need it.
    goto Backup


You can put this behavior in a cron job. This only backs up the changes
between snapshots at the block level. It creates a "crash consistent"
backup on the replication target.


ZFS and KVM:
Do you use KVM or QEMU? Well, ZFS is AWESOME for this as well. The QCOW2
format is ridiculously slow. ZFS ZVOLS are fantastic, you can allocate
them as "sparse"

zfs create -V 128G -s zpool001/rocky8dev
zfs set compression=lz4 zpool001/rocky8dev

The above creates a block device "/dev/zpool001/rocky8dev" It is sparsely
allocated so that its takes almost no space when created. (-s)
Then we enable compression.

In KVM, use /dev/zpool001/rocky8dev as the storage for the virtual machine.

Install normally.

Using a ZFS ZVOL is faster than QCOW2, uses less space than QCOW2, creates
a device that can be inspected and modified by the host system with
standard tools. It has all the benefits of a RAW device as well as the
benefits the QCOW2 does badly: Snapshots, rollback, and sparse allocation.


RaspberryPI
I have even used ZFS ZVOLS with iscsi to share them on my network to
RaspberryPI systems configured to boot from the iscsi volume.

I have created ZVOLs exactly the size of a raspberry PI SDcard. Dumped a
configuration from SDcard to ZVOL. With snapshots, I can track changes.
You can use "zdb" to find all the blocks that have changed between
snapshots and revert only the blocks that have changed to restore an
SDcard to a previous version. Its a time save and reduces the total number
of writes to the SDcard.


> On Wed, 27 Jul 2022 16:13:31 -0400
> markw at mohawksoft.com wrote:
>
>> A stripe over two mirrors is not as reliable as RAID6. If you have 4
>> drives arranged in two mirrors, each mirror can only survive the loss
>> of one drive. So, your system, if it loses 2 drives, has a 33.33%
>> chance of losing half its data.
>
> If I cared that much about fault tolerance then I'd be running one
> 4-way mirror instead of two 2-way mirrors. As is, if I lose two drives
> out of the four before I can replace and resilver one, all I'm really
> out is the most recent backups of my daily drivers and the time needed
> to restore my backups which are kept on auxiliary storage.
>
> --
> \m/ (--) \m/
> _______________________________________________
> Discuss mailing list
> Discuss at lists.blu.org
> http://lists.blu.org/mailman/listinfo/discuss
>




More information about the Discuss mailing list