by Octabrain · 4y ago · 0 comments
Fedora + BTRFS + Deja dup daily backups have been my default for months now, but I am tempted to give it a go to perhaps Ubuntu JJ + ZFS + Deja dup. Not that I have any issues with my current setup. It's just for the sake of, you know, try new things.
* The cpu usage can be higher if you use compression.
* I used to setup the main pool with SSD cache with HDD data store. It's okay for most use case except slow first time open of applications. But for demanding games it usually has very bad performance.
* ZFS also manage cache by itself so it needs some memory. Personally I'd like to set a cap for it, because otherwise when I open some memory hungry program it tries to write cache onto disk which sometimes makes the system slow. This happens when I only use SSD as cache. Not sure if it can be better with all SSD solution.
* I ran into problem with docker as well. But after change some configurations it works perfectly.
* I use zfs snapshot and zfs send/recv for backups and it is really awesome. I've written a blog about my personal offsite backup solution that you may find useful: https://www.binwang.me/2021-09-19-Personal-ZFS-Offsite-Onlin...
I'm not familiar with Deja dup, but the usual method of backing up a ZFS filesystem is to snapshot it and then stream the snapshot (just a file, can be compressed) into the remote store of your choice.
The usual way is ZFS send and receive to another ZFS server. But almost no cloud storage provider supports that, other than rsync.net (and zfs.rent), which starts with $60/month. So you have to set up and manage another ZFS server with secure remote access, PIA if you ask me.
For a while now, my backup process has been essentially to run
zfs send -L -c -P "${snap}" | zstd - > "${out}"
gsutil -o GSUtil:parallel_composite_upload_threshold=150M cp "${out}" "${gcs_path}/"
It seems to work well. Am I carrying some unrecognised risk that I wouldn't be carrying if I were backing up into another ZFS filesystem? How does that risk balance against the risk of data loss on the backup server? i.e. I am pretty sure GCS won't lose my data, but not quite so sure about the other services you mention.Snapshots are incremental, so management of your retention period is an active process and may require combining older snapshots together when you drop them.
With a zfs server on the other end you can zfs send / recv the other way to restore, and it correctly manages deleted snapshots.
The error occurs in transit or on client side, not necessarily on remote.
Also managing a chain of incrementals can get unwieldy.
Ask r/zfs.
- no overlayfs yet (https://github.com/openzfs/zfs/pull/9414) - the docker zfs driver is very slow and buggy - best to create a sparse zvol with ext4/xfs/btrfs and use this for /var/lib/docker
- no directio yet (https://github.com/openzfs/zfs/pull/10018) - not sure if this is so useful beyond specialized databases that utilize that.
- no idmapped mounts yet (https://github.com/openzfs/zfs/pull/13671) - this would be useful for lxc/lxd
- async dmu (https://github.com/openzfs/zfs/pull/12166) - complicated patchset would transform a lot of operations into callbacks and probably increase performance for a lot of workloads.
- namespace delegation was recently merged: https://github.com/openzfs/zfs/commit/4ed5e25074ffec266df385... with idmapped mounts it should be possible to have zfs datasets / snapshots inside a unprivileged lxc-container which could be super cool for lightweight container things.
caveats:
- no swap on zvol at the moment (https://github.com/openzfs/zfs/issues/7734) - this is some hairy memory allocation problem beneath it and I don't really use swap - just something to be aware off.
- arc vs. pagecache / performance (https://github.com/openzfs/zfs/issues/13736) - zfs is usally very fast but there are some edge-cases where it's not at the moment.
That's great. I had a conversation with the owner of rsync.net about why they require zfs-enabled customers run on a separate bhyve VM (thus requiring a large minimum). Iirc it boils down to zfs destroy permissions somehow affecting other tenants. I see mention of zfs destroy in the linked patch, I'm curious how that relates to rsync's experience and requirements.
And a hard disk array with 4 drives in raidz (like raid 5).
Main advantages: * I moved my root drive to another drive and did it entirely online without needing to cp or dd everything just add new drive to pool, remove old drive (and wait until it's done, but you can keep using it while it copies) * It's way faster than MD, md spends 10s of hours initializing or resilivering big drives. zfs just formats it and your good to go. * Subvolumes and snapshops are great. You can give a folder different file system properties. (Eg make /var/log compressed and disable it for /var/cache/pacman because it's already compressed) * Docker is quicker. * Although BTRFS has snapshots I do find ZFS's more intuitive. (eg subvolume can be nomount in ZFS which allows you to organize and apply options recursively easier)
Check for bugs in Ubuntu ZFS before installing updating. They do it differently than other OpenZFS options.
I'm not currently using ZFS send for backups. So I can't compare it to Deja dup.
No real complaints except that it complicates updating Arch: kernel updates usually have to be delayed 24-48 hours while the ZFS packages get rebuilt, or in some cases patched upstream. syncoid/sanoid also poses a problem because it relies on a few Perl packages from the AUR that are a pain to rebuild.
I know the Arch devs loathe people doing partial updates, but occasionally delaying a kernel update for the sake of ZFS has yet to bite me in the ass. I would strongly advise against DKMS, though. Use a binary module or build the package yourself. The majority of problems I had with Arch+ZFS boiled down to misuse of zfs-dkms.
zfs-dkms + "linux-lts" (longterm kernel) seems to work better than zfs-dkms + linux (stable kernel) if you're intending to do frequent system updates - I've been running this on several machines for years with no issues.
Separately, at work I managed to persuade them to configure our two new servers with ZFS, each with 168 drives for a total (after RAID) of 1.5PB each. Works like a charm, and is quite happy to saturate a 10Gb ethernet connection when accessing from another server, with transparent compression turned on. I would not hesitate to recommend ZFS to anyone.
On the other hand it's not that hard to export and re-import a ZFS file system from a workstation or laptop to defragment manually - it's harder to do that with a NAS with lots of drives when you don't have a second set of drives just hanging around.
I honestly use ext4 for everything based on ignorance and familiarity.
Checksums if the mobile hardware is damaged, snapshots if you delete something in your daily driver, native encryption if laptop is stolen, backup of work data via ZFS send if you have a ZFS server, compression to use limited disk space in laptops, errors can be fixed with copies=2, etc.
- I can easily create new subvolumes (filesystems or block devices), for different mount points, containers, other distributions, VM disks...
- The free space is shared between all of them, no need to anticipate a partitioning layout
- I have a service that automatically snapshots some of them, others not
- I love the ZFS tools, I'm very happy to use them on all my machines
- I use NixOS everywhere and so it's also easier to share the same conf on all my machines
- I can send volumes easily from one machine to the other (zfs send)
I probably miss other things, but I also love consistency ;)
The scripts in that post are a little outdated, so if you would like to see updated ones, contact me [2].
The end result is a setup that:
* Has parallel upload to saturate my slow upload connection.
* Allows resume with `make -j<cores>`
* Allows me to backup things that are only on my server, such as my Gitea instance [3], to my desktop, thus having my server and desktop serve as backups to each other.
* Allows me to delete snapshots older than a certain number of snapshots (set to 60).
* Has automatic loading and unloading of encryption keys, to reduce the exposure time. (However, I wish raw sends on encrypted datasets worked. But it is nice that I can load the keys and download individual files instead, which I've already had to do.)
Perhaps I should add an update post to [1]. If there's enough interest, I will.
Edit: I should make clear that my ZFS is only my home directory. I do not use it as a root or boot filesystem because it runs off of a mirror of hard drives, and my root/boot drive is an SSD and can be destroyed without pain because all of my configs are in a repo in my home directory. Thus, it would be trivial to rebuild my system.
[1]: https://gavinhoward.com/2021/02/adventures-in-backing-up-dat...
I love it but two problem I ran into on Ubuntu:
1. Docker failed bcs of the custom implementation in Ubuntu (Don't remeber the specifics).
2. I repeatedly run into the problem that rpool (root) or bpool are supposedly full and automatic snapshots break.
I hope those problems get fixed soon.
https://openzfs.github.io/openzfs-docs/Basic%20Concepts/dRAI...
Expand your ZFS array over a network. It's not expansion, BUT it can be used to grow a pool size.