NFSv4.2 extended attributes (xattr) allow clients to use their own, user-defined metadata for files and directories.
An extended attribute is a key-value pair that can be set on a file or directory. With Linux, the key name of an extended attribute is in the format <namespace>.<attribute name>, for example: user.category.
Note
Although the VAST cluster does not enforce any limitations on the namespaces, your Linux client may only support the
usernamespace.
Extended attributes are supported for regular files and directories. When extended attribute operations are performed via hardlinks or symlinks, the attributes are applied to the target file. Applying extended attributes to the symlink itself is not supported.
Prerequisites
The tenant must have NFSv4.2 protocol support enabled (in VAST Web UI: Element Store -> Tenants -> open a tenant -> Advanced Protovol Settings tab -> Enable NFSv4.2).
Extended Attributes Naming Rules
Characters that can be included in an attribute key name or value depend on the view policy setting named Allowed characters (in VAST Web UI: Element Store -> View Policies -> open a view policy -> Advanced tab):
If Allowed characters is set to Lowest Common Denominator:
Attribute key names may include only ASCII characters except for the following characters: 0x00 - 0x1F, \ / : * ? " < > | , + = [ ] ;
Attribute values may include any ASCII characters.
If Allowed characters is set to Native Protocol Limit, the VAST cluster does not impose any additional limitations on the allowed characters.
Both attribute keys and values are case-sensitive and can contain white spaces.
The maximum length of an attribute name or value depends on a similar view policy setting, Name length limit (in VAST Web UI: Element Store -> View Policies -> open a view policy -> Advanced tab):
If Name length limit is set to Lowest Common Denominator:
Attribute key names can be up to 128 characters (including the namespace prefix).
Attribute values can be up to 256 characters.
If Name length limit is set to Native Protocol Limit:
Attribute key names can be up to 1024 characters (including the namespace prefix).
Attribute values can be up to 3750 characters.
Supported Request Types
The VAST cluster supports the following types of requests for managing extended attributes:
GETXATTR - Get the value of an extended attribute for a file or directory
SETXATTR - Set or modify the value of an extended attribute for a file or directory
LISTXATTRS - List all extended attributes set on a file or directory
REMOVEXATTR - Remove the value of an extended attribute for a file or directory
Required Permissions
Operations with extended attributes require appropriate permissions. The following table shows the permission mapping across access protocols. For S3, the permissions are granted by allowing the listed S3 request types in an identity or bucket policy.
Operation | NFSv4.2 | NFSv3 | SMB | S3 |
Get the value of an extended attribute set for a file or directory | ACCESS4_XAREAD | r | FILE_READ_EA | GetObjectTagging |
Set, modify or remove the value of an extended attribute for a file or directory | ACCESS4_XAWRITE | w | FILE_WRITE_EA | PutObjectTagging DeleteObjectTagging |
List all extended attributes set on a file or directory | ACCESS4_XALIST | r | FILE_READ_EA | GetObjectTagging |
Limitations
The following rules and limitations apply:
Extended attributes are supported for the NFSv4.2 protocol only.
The VAST cluster does not enforce any limitation on the maximum number of extended attributes per file. However, some clients may have such a limitation when listing extended attributes.
Examples
The following bash examples show how to manage NFSv4 extended attributes on a file named abc.txt that resides on an NFSv4-enabled view:
To set an extended attribute named
myattributewith a value ofmyvalue:setfattr -n 'user.myattribute' -v 'myvalue' abc.txtTo list extended attributes set on the file:
getfattr -d abc.txtTo remove the
myattributeextended attribute from the file:setfattr -x 'user.myattribute' abc.txt