Use getfattr in bash shell to View File Extension attributes

Source: Internet
Author: User
Tags symlink glusterfs

Use getfattr in bash shell to View File Extension attributes
Getfattr is used to obtain extended attributes of a file and return a series of key-value pairs. For details, refer to Linux Man Page. Common OPTIONS

-n name, --name=nameDump the value of the named extended attribute extended attribute.-d, --dumpDump the values of all extended attributes associated with pathname.-e en, --encoding=enEncode values after retrieving them. Valid values of en are "text", "hex", and "base64". Values encoded as text strings are enclosed in double quotes ("), while strings encoded as hexidecimal and base64 are prefixed with 0x and 0s, respectively.-h, --no-dereferenceDo not dereference symlinks. Instead of the file a symlink refers to, the symlink itself is examined. Unless doing a logical (-L) traversal, do not traverse symlinks to directories.-m pattern, --match=patternOnly include attributes with names matching the regular expression pattern. The default value for pattern is "^user\\.", which includes all the attributes in the user namespace. Specify "-" for including all attributes. Refer to attr(5) for a more detailed discussion of namespaces.--absolute-namesDo not strip leading slash characters ('/'). The default behaviour is to strip leading slash characters.--only-valuesDump out the extended attribute value(s) only.-R, --recursiveList the attributes of all files and directories recursively.-L, --logicalLogical walk, follow symbolic links to directories. The default behaviour is to follow symbolic link arguments unless --no-dereference is given, and to skip symbolic links encountered in subdirectories. Only effective in combination with -R.-P, --physicalPhysical walk, do not follow symbolic links to directories. This also skips symbolic link arguments. Only effective in combination with -R.--versionPrint the version of getfattr and exit.--helpPrint help explaining the command line options.

 

Run the getfattr-m command to view all extended attributes. -d-e hex -- absolute-names $ (vs_quick_lookup.sh vm-disk-1.qcow2 | grep $ (hostname) | awk-F ":" '{print $2}') Result: # file: /sf/data/vs/local/V1gACv-8aPk-GDhe-nNnx-6uoD-isPj-ia9fSO/c93f1a03-ca0a-41cf-bca2-f723b35122ed/images/cluster/ljr. vm/vm-disk-1.qcow2trusted.afr.vs_vol_rep2-client-10 = 0x0000000000000000000000000000trusted. afr. vs_vol_rep2-client-11 = 0x0000000000000000000000 00trusted. gfid = 0x4751bfcc6ad6406d8e00a973d45a9d4euser. glusterfs. bd = 0x6c76323a313138425131333730323400user. glusterfs. wcache = 0x0000000000000000 option Description:-m. matches the extended attributes of all formats. The default value is user. xxx, that is, "^ user \. ". -D-e hex uses hexadecimal encoding dump to output the value of the corresponding extended attribute -- absolute-names does not filter the path separator ('/') view the specified extended property getfattr-n' trusted. gfid '-d-e hex -- absolute-names $ (vs_quick_lookup.sh vm-disk-1.qcow2 | grep $ (hostname) | awk-F ":"' {print $2} ') Result: # file:/sf/data/vs/local/V1gACv-8aPk-GDhe-nNnx-6uoD-isPj-ia9fSO/c93f1a03-ca0a-41cf-bca2-f723b35122ed/images/cluster/ljr. vm/vm-disk-1.qcow2trusted.gfid = 0x4751bfcc6ad6406d8e00a973d45a9d4e option Description:-n specifies the name of the extension property

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.