Reski's hobbies blog place…

This is not just about me, but also bout my family
February 12th, 2012 by ayah

ZFS Send & Receive

ZFS have abilities to save snapshot as file object or save snapshot to other remote.
As I will focus on save snapshot to other remote, only two simple commands that involve here which are zfs send, zfs receive.

The basic concept is send snapshot that you want to send to other remote by ssh protocol and make the remote understand that you gonna give the snapshot

so the commands will be

zfs send [name of the snapshot] | ssh [username]@[remote (ip or hostname)] zfs receive [name of zfs volume]

for example

zfs send DV/Sn03 | ssh reski@zfsserver zfs receive DV/Sn03

If you receive error such as zfs command not found, the solution is that you write full path of zfs in the remote size.

zfs send DV/Sn03 | ssh reski@zfsserver /usr/sbin/zfs receive DV/Sn03

if you receive error such as cannot receive new filesystem stream: permission denied, the solution is that you have to assigned some kind of some ACL permissions to that ZFS volume (remote side). Basic permissions for this remote replication are mount, create and receive

zfs allow everyone mount,create,receive DV/Sn03

* as prerequisite : you should define DV/Sn03 first before you do zfs allow

Additional notes, to send incremental updates, just modify above command

zfs send - [name of the first snapshot] [name of the second snapshot] | ssh [username]@[remote (ip or hostname)] zfs receive [name of zfs volume]

for example

zfs send -i DV/Sn03@1 DV/Sn03@2 | ssh reski@zfsserver zfs receive DV/Sn03

additional note:
if you find message like this

cannot receive new filesystem stream: destination 'VD03/dataVM' exists
must specify -F to overwrite it

it means you have to do it like this

zfs send -i DV/Sn03@1 DV/Sn03@2 | ssh reski@zfsserver zfs receive -F DV/Sn03

Reference :

      http://docs.huihoo.com/opensolaris/solaris-zfs-administration-guide/html/ch06s03.html
      http://www.markround.com/archives/38-ZFS-Replication.html
      http://docs.oracle.com/cd/E19082-01/817-2271/gfwqj/index.html