How to use Extended File Attributes on NFS?
Solution 1
You can use fuse_xattrs (a fuse filesystem layer) to emulate extended attributes (xattrs) on NFS shares. Basically you have to do:
- mount the NFS share. e.g.:
/mnt/shared_data
- mount the fuse xattr layer:
$ fuse_xattrs /mnt/shared_data /mnt/shared_data_with_xattrs
Now all the files on /mnt/shared_data
can be accessed on /mnt/shared_data_with_xattrs
with xattrs support. The extended attributes will be stored on sidecar files. The extended attributes are not going to be stored on the server filesystem as extended attributes, they are going to be stored in sidecar files.
Sadly this is only a work-around.
disclaimer: I'm the author of fuse_xattrs.
Solution 2
(This article is old, but I came across this article when looking for this functionality, and it doesn't represent the current state.)
As others have mentioned, there is no support for extended attributes in NFS. However, there is significant interest in it, to the extent there is a proposed standard (RFC 8276).
Solution 3
Extended attributes are not supported by nfs.There is no handler for user attributes in nfs kernel module.For more information read RFC for nfsv4.
Solution 4
The NFS code in Linux 5.9 has finally presented support for user extended attributes (user xattrs).
The NFS server updates for Linux 5.9 have support for user-extended attributes on NFS. This is the functionality outlined via IETF's RFC 8276 for handling of file-system extended attributes in NFSv4. "This feature allows extended attributes (hereinafter also referred to as xattrs) to be interrogated and manipulated using NFSv4 clients. Xattrs are provided by a file system to associate opaque metadata, not interpreted by the file system, with files and directories. Such support is present in many modern local file systems. New file attributes are provided to allow clients to query the server for xattr support, with that support consisting of new operations to get and set xattrs on file system objects."
Source: https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.9-NFS-Server-User-Xattr
![Celik](https://i.stack.imgur.com/K5KA4.jpg?s=256&g=1)
Comments
-
Celik about 2 years
I have an NFS_Server - NFS_Client system. My client is mounted to an NFS_Server directory. I want to change the attribute of NFS_Server directory's files via NFS_Client mounted directory by using Extended File Attributes (xattr).
When I tried to set an attribute from the client side, it gives the following answer:
root@ubuntu:/mnt/nfs/var/nfs#
setfattr -n user.comment -v "some comment" test.txt
setfattr: nfs.txt:
Permission deniedMy question is:
is it possible to use Extended File Attributes via NFS?
if possible, how can I do this?
UPDATE:
Server side:
$ more /etc/exports file has: /var/nfs 192.168.56.123(rw,sync,no_subtree_check)
Client side:
$ root@ubuntu:/# mount -t nfs 192.168.56.130:/var/nfs on /mnt/nfs/var/nfs type nfs (rw,vers=4,addr=192.168.56.130,clientaddr=192.168.56.123)
thank you...
-
AlvaroAV over 9 yearsWhile this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
-
Celik over 8 yearswhich link @AlvaroAV? Can you share it?
-
Tom Aranda over 6 yearsWhile this may answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
-
Drew over 6 yearsI'm sorry, I don't know what you're looking for @TomAranda--I provide the link, the essential part of the answer is that there is no support for extended attributes in NFS. I also don't just have a link--the link is described as a proposed standard (the implication being that it's a proposed standard for the support of extended attributes). I even described the link with the RFC number in case the link rots, which seems really unlikely in this case. Can you elaborate?
-
tudor -Reinstate Monica- about 5 yearsCan you please accept @loloiccl's pull requests? They look kinda important. github.com/fbarriga/fuse_xattrs/pulls
-
corford over 3 yearsIt looks like Linux 5.9 will finally support user extended attributes for NFS. Server PR: lkml.org/lkml/2020/8/9/137 , Client PR: lkml.org/lkml/2020/8/14/712
-
Erik Sjölund over 3 yearsNFS support for Extended file attributes (xattr) was added in Linux 5.9 (released 11 October 2020)