Freenas to Freenas Rsync with SSH

Status
Not open for further replies.

blackjackz

Cadet
Joined
May 19, 2014
Messages
8
Bare with me here, i'm still kind of new to FreeBSD/Freenas

So here is what I have currently. Two freenas boxes, each on entirely different sites, no point to point or vpn link set up directly. but they do have dynamic DNS attached to them which goes through a pfsense firewall.

What I have tried to do and I have had working is the rsync module, which is not secure at all. But it works. I want to get the rysnc over ssh working between the two freenas. So basically freenas1 pushes dataset1 to freenas2 and then freenas2 pushes dataset2 to freenas1. Each freenas has a dataset to sync to the other.

I have followed the tutorial here http://doc.freenas.org/9.3/freenas_tasks.html#rsync-tasks with no luck. I understand how rsync is supposed to work but I think i'm getting lost in the configuration. I was trying to attach an RSA key to a user other than the root user but didnt have any luck there either.

I searched the forums and unless I'm completely missing it (which is more than likely the case) I dont see any tutorial or guide on how to do this. I'm sure i'm not the first person to want to do this.

If someone could baby step me through getting one side to work i'm sure I can figure out the other. If I missed anything I'll add it to the post.

Thanks
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
This seems better handled by ZFS replication.
 

blackjackz

Cadet
Joined
May 19, 2014
Messages
8
so does the zfs replication copy an entire data set or is it just copying the snapshot? my snapshots are quite small and I cant see how that contains all my data.
 

stefanb

Patron
Joined
Dec 12, 2014
Messages
200
Hi,
ZFS replication just copies the snapshot(s) data.
ZFS can't resume if connection lost, snapshot has to be sent again. Could be a problem having a weak internet connection.
S.
 

blackjackz

Cadet
Joined
May 19, 2014
Messages
8
So if its just copying the snapshot data its not moving much data at all, only the changes in files. Still it wouldn't be moving the majority of the data initially?
 
Joined
Jan 9, 2015
Messages
430
I have a script that runs every night to rsync to old FreeNAS 0.7 boxes together over ssh and the Internet. I don't remember that syntax off hand, but I would Google "rsync over ssh". If you haven't got the answer by tomorrow night I'll post the syntax for you. That is the soonest I'll be back at that machine.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
So if its just copying the snapshot data its not moving much data at all, only the changes in files. Still it wouldn't be moving the majority of the data initially?

Yes, it will move all of the data initially. After that only the changes. And not even the changes in files. Only the changes in blocks of the files. ;)
 

blackjackz

Cadet
Joined
May 19, 2014
Messages
8
hmm, so I have ZFS replication working from one site to another, and I can see the snapshots and the data in the dataset. However, I keep getting an error about how "The replication failed for the local ZFS Data/Backups because the remote system
has diverged snapshots with us."

anyone seen this before? I did some googling without much luck
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Th means the snapshots on the remote system has snapshots that don't exist with the local system. Basically you need to stop and look at your snapshot and replication processes between the local and remote server and such. This is 99% of the time the result of user error, such as creating snapshots that shouldn't be created in the remote system.
 

blackjackz

Cadet
Joined
May 19, 2014
Messages
8
Ah so I'm guessing I have the snapshot names that are the same on each freenas and its seeing that they do not match up. Is there a way to change the snapshot naming convention?
 
Last edited:

1.21gigawatts

Explorer
Joined
Jan 6, 2013
Messages
62
Th means the snapshots on the remote system has snapshots that don't exist with the local system. Basically you need to stop and look at your snapshot and replication processes between the local and remote server and such. This is 99% of the time the result of user error, such as creating snapshots that shouldn't be created in the remote system.

Can someone expand on this a little? Say I have two identical systems, each with a pool called MainPool. If I create an automatic snapshot on machine A to run hourly with replication to machine B, that will, I think, run OK. If I create ANY other snapshots on Machine B of its own MainPool, will that cause an error?

If it does cause an error, what would be the proper way to make snapshots of Machine B's Mainpool?? If the above scenario does not cause an error, what then is the condition that would cause an error? Would it be enough to simply give Machine B's pool a different name?

Obviously, I'm somewhat confused here...
 

depasseg

FreeNAS Replicant
Joined
Sep 16, 2014
Messages
2,874
First realize that you can choose the pool and dataset that you want the ZFS replication to go. You could replicate A's Mainpool to B Mainpool, so that you have an exact copy of everything. You could also create a dataset under B's Mainpool called Mainpool-From-A.

The other issue getting tossed around is snapshots. Yes, you can take a snapshot of the replication destination, but then you will get the error mentioned above.

So if you want an exact Mainpool - A to Mainpool - B replica, then don't use snapshots on B (there isn't a need, because the snapshots from A get replicated. If you also have sotrage on B that you want to snapshot, put that dataset on it's own snapshot schedule and make sure to exclude the replication destination.
 
Status
Not open for further replies.
Top