Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct approach to sync full tree of zfs #210

Open
Peter2121 opened this issue Dec 10, 2024 · 6 comments
Open

Correct approach to sync full tree of zfs #210

Peter2121 opened this issue Dec 10, 2024 · 6 comments

Comments

@Peter2121
Copy link

I would like to create a script to sync the full tree of all zfs filesystems of a newly installed FreeBSD.

The list of the filesystems is as follows:

zroot
zroot/ROOT
zroot/ROOT/default
zroot/home
zroot/home/peter
zroot/tmp
zroot/usr
zroot/usr/ports
zroot/usr/src
zroot/var
zroot/var/audit
zroot/var/crash
zroot/var/log
zroot/var/mail
zroot/var/tmp

Another filesystems could be created during install or after it (for example, zroot/home/<user> or zroot/ROOT/default/<update>). The existing zrep configuration should continue to work in such case, only new filesystems need to be added to the sync list.

As I understand, the recursive replication is not reliable, the filesystems should be synced one-by-one. As I mentioned in #166, zrep data is propagated to the child filesystems, so the only approach would be ZREPTAG defined separately for EVERY filesystem to sync. It looks a bit hard to manage and snapshot deletion needs to be debugged/validated, so I would like to ask if any other approach looks possible before starting developing this solution.

@ppbrown
Copy link
Member

ppbrown commented Dec 10, 2024 via email

@ppbrown
Copy link
Member

ppbrown commented Dec 10, 2024 via email

@Peter2121
Copy link
Author

some of those filesystems are a waste of time and space to back up

Sure, I don't plan to sync (for example) zroot/tmp

This gives you the advantage that when and if you have a full system meltdown, you can then rebuild a newer OS installation cleanly

To accelerate recovery, it would be nice to be able to back-sync most of filesystems. Like this, one can just boot a live-system on a VM with minimal system installed (for example, VM created from a template) and sync remote data to them. A simple script permits to restore the whole VM very fast (only the network is the bottleneck).

Dont have a separate one for /home/peter

Since 14.1 (?) there are one ZFS dataset per user and one dataset for /home

Anyway, I can imagine another root dataset, for example zdata/NFSROOT with many children organized in many levels like zdata/NFSROOT/db/mariadb/prod zdata/NFSROOT/documents/sales and so on...

@ppbrown
Copy link
Member

ppbrown commented Dec 10, 2024 via email

@Peter2121
Copy link
Author

As you've mentioned in #165

yeah... Im not happy with the way things work.... but zrep depends on ZFS. and recursive syncs with ZFS are.... tricky.

I always recommend that people do syncs individually, not recursive, whenever possible.

...I don't try to use -R following your recommendations ;)

@ppbrown
Copy link
Member

ppbrown commented Dec 10, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants