ZFS rename and replication

onlineforums

Explorer
Joined
Oct 1, 2017
Messages
56
How does FreeNAS handle replication when a dataset is renamed? Is the "original" before renaming kept using up disk space on the replication destination? Is ZFS smart enough to know that the new dataset name is the same as the replication destination old dataset name? What about when using zfs rename simply to move the dataset to a different location in the pool?

Example:

CURRENT: tank/replicate/current/ABC
AFTER ZFS RENAME: tank/replicate/archive/ABC
command: zfs rename tank/replicate/current/ABC tank/replicate/archive/ABC

What I'm trying to achieve is MOVING (using zfs rename) dataset "ABC" from the "current" dataset to the "archive" dataset once "ABC" dataset is no longer active. The replication from source FreeNAS is recursive from tank/replicate to a destination FreeNAS server.

If ABC dataset is 1GB, using the zfs rename on the original source dataset will keep it as 1GB but I'm not sure how the replication destination will handle it. Anyone know? Alternatively is there a better way to accomplish getting a dataset inactive (i'm thinking using ACL's and options as read-only may be an option)
 

onlineforums

Explorer
Joined
Oct 1, 2017
Messages
56
I decided to test this out on some dummy data myself and would like some feedback.

Test 1
Using same example scenario in original post I did the following #1 Test:

Origination Replication
SOURCE
: tank/replicate/current/ABC
DESTINATION: tank2/replicate/current/ABC

On source used zfs rename: zfs rename tank/replicate/current/ABC tank/replication/archive/ABC

Second Replication after source zfs rename
SOURCE
: tank/replicate/archive/ABC
DESTINATION: tank2/replicate/current/ABC
DESTINATION: tank2/replicate/archive/ABC

The destination has TWO separate datasets, one in the "current" and one in the "archive" of the same size of ABC dataset. In other words, duplicated data and using twice the disk space because it didn't simply rename/move on the destination or remove the ABC dataset in the current dataset.

Test 2
To start over fresh I deleted the "replicate" dataset and sub-datasets and started over using same original formatting example scenario I did the following #2 Test:

Origination Replication
SOURCE
: tank/replicate/current/ABC
DESTINATION: tank2/replicate/current/ABC

On source used zfs rename: zfs rename tank/replicate/current/ABC tank/replication/archive/ABC
On destination used zfs rename: zfs rename tank2/replicate/current/ABC tank2/replication/archive/ABC

Second Replication after zfs rename on both source and destination
SOURCE
: tank/replicate/archive/ABC
DESTINATION: tank2/replicate/archive/ABC

Running zfs list and zfs list -t snapshots for #2 Test does NOT show duplicated data and using twice the disk space. It is as if ZFS replication looked at the destinations archive/ABC because that is what its source showed and because it was there only the changes would have been sent over.


Comments? Suggestions?
 
Top