ZFS远程SSH非root用户备份
zfs could backup its dataset/filesystem by using command:
# zfs send tank/data@snap1 | zfs recv spool/ds01
You can also backup to another computer on the LAN/WAN with ssh encryption:
host1# zfs send tank/dana@snap1 | ssh host2 zfs recv newtank/dana
While in Ubuntu, this command can not use sudo to get root right, and ZoL is not full implementation of ZFS Allow, so here is the workaround:
Add below content into /etc/sudoers.d/zfs
remuser ALL = (root) NOPASSWD:/sbin/zfs recv *
remuser is the user name on remote host.
Start zfs send:
localhost# zfs send tank/example@snap1 | ssh remuser@remhost sudo zfs recv -F backuppool/fs
增量备份:
localhost# zfs send -i tank/example@snap1 tank/example@snap2 | ssh remuser@remhost sudo zfs recv -F backuppool/fs