winnielinnie
MVP
- Joined
- Oct 22, 2019
- Messages
- 3,641
I have finally accepted defeat. Naively I believed that ZFS could serve as a replacement for third-party sync / backup tools by leveraging snapshots and replications. However, after trying every possible combination, it appears that this isn't the case, and other users (elsewhere) have accepted the same thing:
---
Currently, I have a simple setup of clients (non-ZFS) rsync'ing to TrueNAS (ZFS), and from TrueNAS replicating to backups (ZFS).
The problem: Unlike ZFS, rsync (and practically every backup / sync tool out there) is not record-based; it's file-based. Which means moving files and folders around, renaming large files, renaming folders, re-organizing the directories, etc, will cause the next rsync to inefficiently delete and transfer everything all over again. However, if it was pure ZFS, only metadata actually changed between the previous snapshot, and thus a replication takes mere seconds to complete.
So with a new laptop in hand, I had the idea to make my data drive ZFS, with the following setup in mind:
I discovered the problem lies in step #2.
I have a task / snapshot on TrueNAS (aptly named "backup_YYYYmmddHHMM") which I use to essentially replicate all the datasets on the pool to a separate offsite pool. (The simplicity makes it intuitive, as a single "backup" snapshot is a point in time for all datasets in the pool that are safely backed up elsewhere.)
The issue is that replications appear to only work one way. Everything moves this direction or that direction, but not both.
Because the dataset on TrueNAS has a snapshot "backup_202108190000" (used as an all-inclusive pool-wide backup to be saved elsewhere), the next time I try to replicate from the client, it complains that the "destination has been modified." The only way around this is to force a rollback (with the recv -F option), which will destroy the backup snapshot, and thus kills any hope to do future incremental replications from TrueNAS to my offsite backup pool.
---
Likewise, if I try to do a "two-way" replication, where I replicate from TrueNAS to my client PC first, and then replicate from my client PC to TrueNAS with the regular snapshots, it will undo any changes to my client PC up to the point in time since the last time I ran a backup replication to the offsite pool!
---
I don't quite understand why ZFS cannot operate by accepting snapshots from a client, while also making its own snapshots locally to the same dataset, as long as they all share common base snapshots?
If you look at the table above, apparently an incremental send from @auto002 to @auto003 is not allowed, and neither is an incremental send from @auto005 to @auto006.
---
Currently, I have a simple setup of clients (non-ZFS) rsync'ing to TrueNAS (ZFS), and from TrueNAS replicating to backups (ZFS).
- Client (ext4, XFS, Btrfs) regularly rsync's to a dataset on TrueNAS
- TrueNAS (ZFS) makes periodic snapshots of this dataset
- TrueNAS (ZFS) replicates this dataset's snapshots to another backup pool (ZFS)
- Client continues to rsync regularly over the network, life is good
The problem: Unlike ZFS, rsync (and practically every backup / sync tool out there) is not record-based; it's file-based. Which means moving files and folders around, renaming large files, renaming folders, re-organizing the directories, etc, will cause the next rsync to inefficiently delete and transfer everything all over again. However, if it was pure ZFS, only metadata actually changed between the previous snapshot, and thus a replication takes mere seconds to complete.
So with a new laptop in hand, I had the idea to make my data drive ZFS, with the following setup in mind:
- Client (ZFS) takes periodic snapshots and replicates to TrueNAS (ZFS)
- TrueNAS (ZFS) replicates this dataset's snapshots to another backup pool (ZFS)
- Client continues to replicate regularly over the network, life is good?
I discovered the problem lies in step #2.
I have a task / snapshot on TrueNAS (aptly named "backup_YYYYmmddHHMM") which I use to essentially replicate all the datasets on the pool to a separate offsite pool. (The simplicity makes it intuitive, as a single "backup" snapshot is a point in time for all datasets in the pool that are safely backed up elsewhere.)
The issue is that replications appear to only work one way. Everything moves this direction or that direction, but not both.
Because the dataset on TrueNAS has a snapshot "backup_202108190000" (used as an all-inclusive pool-wide backup to be saved elsewhere), the next time I try to replicate from the client, it complains that the "destination has been modified." The only way around this is to force a rollback (with the recv -F option), which will destroy the backup snapshot, and thus kills any hope to do future incremental replications from TrueNAS to my offsite backup pool.
---
Likewise, if I try to do a "two-way" replication, where I replicate from TrueNAS to my client PC first, and then replicate from my client PC to TrueNAS with the regular snapshots, it will undo any changes to my client PC up to the point in time since the last time I ran a backup replication to the offsite pool!
---
I don't quite understand why ZFS cannot operate by accepting snapshots from a client, while also making its own snapshots locally to the same dataset, as long as they all share common base snapshots?
CLIENT | TRUENAS |
@auto001 ---> zfs send (full) ---> | @auto001 |
@auto002 ---> zfs send -i @auto001 @auto002 ---> | @auto002 |
@backup001 (created locally, replicate from here everything to offsite pool) | |
@auto003 ---> zfs send -i @auto002 @auto003 ---> | @auto003 |
@auto004 ---> zfs send -i @auto003 @auto004 ---> | @auto004 |
@auto005 ---> zfs send -i @auto004 @auto005 ---> | @auto005 |
@backup002 (created locally, replicate from here everything to offsite pool) | |
@auto006 ---> zfs send -i @auto005 @auto006 ---> | @auto006 |
And so on... | And so on... |
If you look at the table above, apparently an incremental send from @auto002 to @auto003 is not allowed, and neither is an incremental send from @auto005 to @auto006.
Last edited: