如何在NFS上使用扩展文件属性? [英] How to use Extended File Attributes on NFS?

查看:582
本文介绍了如何在NFS上使用扩展文件属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 NFS_Server-NFS_Client 系统. 我的客户端被安装到NFS_Server 目录. 我想使用扩展文件属性(xattr)通过NFS_Client挂载目录更改NFS_Server目录文件的属性.

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: 权限被拒绝

root@ubuntu:/mnt/nfs/var/nfs# setfattr -n user.comment -v "some comment" test.txt setfattr: nfs.txt: Permission denied

我的问题是:

  • 是否可以通过NFS使用扩展文件属性?

  • is it possible to use Extended File Attributes via NFS?

如果可能的话,我该怎么办?

if possible, how can I do this?

更新:

服务器端:

$ more  /etc/exports file has:    
/var/nfs        192.168.56.123(rw,sync,no_subtree_check)

客户端:

$ 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)

谢谢...

推荐答案

您可以使用 fuse_xattrs (a融合文件系统层)以模拟NFS共享上的扩展属性(xattrs).基本上,您必须这样做:

You can use fuse_xattrs (a fuse filesystem layer) to emulate extended attributes (xattrs) on NFS shares. Basically you have to do:

  1. 安装NFS共享.例如:/mnt/shared_data
  2. 安装保险丝xattr层: $ fuse_xattrs /mnt/shared_data /mnt/shared_data_with_xattrs
  1. mount the NFS share. e.g.: /mnt/shared_data
  2. mount the fuse xattr layer: $ fuse_xattrs /mnt/shared_data /mnt/shared_data_with_xattrs

现在,可以使用xattrs在/mnt/shared_data_with_xattrs上访问/mnt/shared_data上的所有文件.扩展属性将存储在sidecar文件中.扩展属性不会作为扩展属性存储在服务器文件系统中,而是将存储在Sidecar文件中.

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.

免责声明:我是fuse_xattrs的作者.

disclaimer: I'm the author of fuse_xattrs.

这篇关于如何在NFS上使用扩展文件属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆