ZFS replication on localhost?

Status
Not open for further replies.

gaelic

Dabbler
Joined
Jun 7, 2011
Messages
10
Hey.

I'm pretty new to zfs and just started using freenas-8 (great piece of software).

I'm wondering if it is possible to replicate a zfs-volume from an internal harddrive to a usb/firewire/esata drive on the same machine?

I tried to follow the doc here: http://doc.freenas.org/index.php/Replication_Tasks

/mnt/data should be replicated to /mnt/backup-external

Values used:
mount point: /mnt/data
remote zfs-fs: backup-external
remote hostname: localhost
key: cat /data/ssh/replication.pub from the same machine

i did no ssh-keyscan and also did not enter the in authorized_keys (is it neccessary?)

On the data partition I also scheduled one daily snapshot at about midnight ... (is it neccessary to have snapshots for replication?)

Thanks for your answers :)
 

waggy

Cadet
Joined
Jun 14, 2011
Messages
3
I would also be interested in this.......have you seen my post (Help with config).......I can do it via windows shares and robocopy......but that is not the answer
 

gaelic

Dabbler
Joined
Jun 7, 2011
Messages
10
I managed to do it in the console by hand:

Code:
zfs send data1/public@manual-20110617 | zfs receive backup-external/public


Would be nice if it would also work automatically in the webgui (&with a cronjob)
 

SoftDux-Rudi

Contributor
Joined
Jun 2, 2011
Messages
108
I use rsync for this, which can be added to cron if needed:

rsync -avz --progress --compress /mnt/Storage1 /mnt/Backup


If you run this through cron, remove the "--progress" portion
 

fisheater

Explorer
Joined
Jun 29, 2011
Messages
53
Adding to this question:

If rsync is used to copy the content of one RAIDz to a second RAIDz in the same PC tower, does that also copy all of the ZFS snapshots?

I also am stymied by trying to get replication to work with SSH between two RAIDz within the same PC. Is it really necessary to setup and use SSH within the same PC tower?

I am using:

rsync -a --delete /mnt/FreeNASa/ /mnt/FreeNASa2

where -a represents: -r, --recursive recurse into directories, -l, --links copy symlinks as symlinks, -p, --perms preserve permissions, -t, --times preserve modification times, -g, --group preserve group, -o, --owner preserve owner (super-user only), -D same as --devices --specials




Curious about replication? This is a great summary from Sun:
http://www.google.ca/url?sa=t&source=web&cd=23&ved=0CDAQFjACOBQ&url=http%3A%2F%2Fwww.eecis.udel.edu%2F~bmiller%2Fcis361%2F2011s%2Fslides%2Fhw4%2F6-ZFS-sendrecv.pdf&ei=zCiJToiQLsnTiAKWlfHPDA&usg=AFQjCNGYVl8qMrpmrdin7JgQsJ43Kx9oEw

@SoftDux-Rudi
I have been trying to figure out rsync and have a noted this in your example. Thanks for posting it.
rsync -avz --progress --compress /mnt/Storage1 /mnt/Backup

“z and –compress” are the same command, so putting it twice is redundant.

See: http://ss64.com/bash/rsync.html
 

DeliveryGuy

Dabbler
Joined
Dec 6, 2011
Messages
35
Think I figured it out

So my values in the Freenas 8.0.2 GUI for replication tasks are as follows:

mount point: /mnt/data
remote zfs-fs: backup-external/backups
remote hostname: localhost
key: cat /data/ssh/replication.pub from the same machine

Where backup-external is the zfs volume that you want to backup to. The path to it should be /mnt/backup-external.

ssh into the local box. Then you need to su to the replication user.
Code:
 cd /mnt/backup-external | mkdir backups 

Then ssh to localhost. Hit yes to accept the fingerprint and then enter your password for the replication user. Then exit.

Now if you
Code:
tail -f /var/log/messages
, you should eventually see your replication task start working.

Once you see that it is no longer failing, you can check on the status of the replication using
Code:
 zfs list -t all 


Hope that helps.
 
Status
Not open for further replies.
Top