ZFS - zfs recv

Hi.
I've just added user "test" on backup server.
I gave this users more privilages with zfs.

Code:
# zfs allow test create,destroy,mount,snapshot,receive,mountpoint,allow,clone,promote,rename,rollback,send,share,canmount ZFSrootBS/backup

# zfs allow ZFSrootBS/backup
---- Permissions on ZFSrootBS/backup ---------------------------------
Local+Descendent permissions:
user test allow,canmount,clone,create,destroy,mount,mountpoint,promote,receive,rename,rollback,send,share,snapshot

After that I tried to send snapshot from primary to backup server.

Code:
# zfs send -v ZFSroot/home/mail/mail.pl@2012-02-07 | ssh test@backup zfs recv -vF ZFSrootBS/backup/mail
cut
received 11.7GB stream in 194 seconds (61.5MB/sec)
cannot mount '/backup/mail5': failed to create mountpoint

Am I missing something?

Thanks in advance.
 
The user test isn't allowed to mount filesystems, regardless of what you set with ZFS.

Try setting in /etc/sysctl.conf:
Code:
vfs.usermount=1

Mind you, this will mean every user can mount filesystems.

The user also needs to be able to create a directory in /backup/ for the mountpoint.
 
Another way you could do this, but it's not a 'zfs way' is to use sudo.

Add something like this with visudo
Code:
Cmnd_Alias ZFS = /sbin/zfs

test ALL = NOPASSWD: ZFS

Then change your zfs recv command to

# zfs send -v ZFSroot/home/mail/mail.pl@2012-02-07 | ssh test@backup sudo zfs recv -vF ZFSrootBS/backup/mail

That way you don't need to allow all users to mount. But if you don't currently use sudo and/or you like doing things the way zfs intended this method may be undesirable.
 
Hi,

if it is your intention to send subsequent snapshots as incrementals then this menthod will work fine, except from the initial send as you have found out. In that instance simply do the first non-incrememental send as root,

thanks Andy.
 
I know this "tricks" but thanks anyway :)
Just wonder if I could do this in "pure ZFS way".
I guess not (not yet) :)
 
Back
Top