setfacl: /mnt/nfs/filename.txt: Operation not supported
I was backing up a disk to a NFS server with rsync, and noticed that my posix ACL's were not being copied. The NFS server was mounted as version 4.1 and I was using rsync with the flags -aP.
Manually setting an ACL on a file from the client machine on the NFS server resulted in the error:
The underlying fs on the server needs to support ACL's.
In my case fs on the server was ZFS and posixacl was enabled.
Using setfacl directly on the server was successful.
Solution:
With NFS 4.x you CANNOT use posix ACL's. You can use the special nfs4_setfacl provided by the nfs4-acl-tools package. This is completely useless when you want to backup files to NFS with rsync etc.
You need to use NFS version 3, so mount your NFS share with the -o vers=3 option.
Also you need to use rsync with -A so it copies the ACL's.
From the rsync manpage:
My mount command:
Manually setting an ACL on a file from the client machine on the NFS server resulted in the error:
setfacl: /mnt/nfs/filename.txt: Operation not supported
The underlying fs on the server needs to support ACL's.
In my case fs on the server was ZFS and posixacl was enabled.
$ zfs set acltype=posixacl pool/backup
Using setfacl directly on the server was successful.
Solution:
With NFS 4.x you CANNOT use posix ACL's. You can use the special nfs4_setfacl provided by the nfs4-acl-tools package. This is completely useless when you want to backup files to NFS with rsync etc.
You need to use NFS version 3, so mount your NFS share with the -o vers=3 option.
Also you need to use rsync with -A so it copies the ACL's.
From the rsync manpage:
-A, --acls
This option causes rsync to update the destination ACLs to be the same as the source ACLs. The option also implies --perms.
My mount command:
mount -t nfs -o vers=3,rsize=32768,wsize=32768,intr,noatime 192.168.2.6:/backup /mnt/nfs/My rsync commands (the 2e command is neat trick to copy subdirs in parallel):
# Single subdir sync (--delete-during because I want to delete old files from the destination)
rsync -aAP --delete-during /source/subdir/ /mnt/nfs/source/subdir/
# Parallel sync of all subdirs, 6 threads
SOURCE="/source/" && find $SOURCE -maxdepth 1 -mindepth 1 -type d | xargs -t -n1 -P6 -I% rsync -aAP --delete-during % /mnt/nfs$SOURCE