README.extattr 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. $FreeBSD$
  2. UFS Extended Attributes Copyright
  3. The UFS Extended Attributes implementation is copyright Robert Watson, and
  4. is made available under a Berkeley-style license.
  5. About UFS Extended Attributes
  6. Extended attributes allow the association of additional arbitrary
  7. meta-data with files and directories. Extended attributes are defined in
  8. the form name=value, where name is an nul-terminated string in the style
  9. of a filename, and value is a binary blob of zero or more bytes. The UFS
  10. extended attribute service layers support for extended attributes onto a
  11. backing file, in the style of the quota implementation, meaning that it
  12. requires no underlying format changes in the filesystem. This design
  13. choice exchanges simplicity, usability and easy deployment for
  14. performance. When defined, extended attribute names exist in a series of
  15. disjoint namespaces: currently, two namespaces are defined:
  16. EXTATTR_NAMESPACE_SYSTEM and EXTATTR_NAMESPACE_USER. The primary
  17. distinction lies in the protection model: USER EAs are protected using the
  18. normal inode protections, whereas SYSTEM EAs require privilege to access
  19. or modify.
  20. Using UFS Extended Attributes
  21. Support for UFS extended attributes is natively available in UFS2, and
  22. requires no special configuration. For reliability, administrative,
  23. and performance reasons, if you plan to use extended attributes, it
  24. is recommended that you use UFS2 in preference to UFS1.
  25. Support for UFS extended attributes may be enabled for UFS1 by adding:
  26. options UFS_EXTATTR
  27. to your kernel configuration file. This allows UFS-based filesystems to
  28. support extended attributes, but requires manual administration of EAs
  29. using the extattrctl tool, including the starting of EA support for each
  30. filesystem, and the enabling of individual attributes for the file
  31. system. The extattrctl utility may be used to initialize backing files
  32. before first use, to start and stop EA service on a filesystem, and to
  33. enable and disable named attributes. The command lines for extattrctl
  34. take the following forms:
  35. extattrctl start [path]
  36. extattrctl stop [path]
  37. extattrctl initattr [-f] [-p path] [attrsize] [attrfile]
  38. extattrctl enable [path] [attrnamespace] [attrname] [attrfile]
  39. extattrctl disable [path] [attrnamespace] [attrname]
  40. In each case, [path] is used to indicate the mounted filesystem on which
  41. to perform the operation. [attrnamespace] refers to the namespace in
  42. which the attribute is being manipulated, and may be "system" or "user".
  43. The [attrname] is the attribute name to use for the operation. The
  44. [attrfile] argument specifies the attribute backing file to use. When
  45. using the "initattr" function to initialize a backing file, the maximum
  46. size of attribute data must be defined in bytes using the [attrsize]
  47. field. Optionally, the [-p path] argument may be used to indicate to
  48. extattrctl that it should pre-allocate space for EA data, rather than
  49. creating a sparse backing file. This prevents attribute operations from
  50. failing in low disk-space conditions (which can be important when EAs are
  51. used for security purposes), but pre-allocation will consume space
  52. proportional to the product of the defined maximum attribute size and
  53. number of attributes on the specified filesystem.
  54. Manual configuration increases administrative overhead, but also
  55. introduces the possibility of race conditions during filesystem mount, if
  56. EAs are used to support other features, as starting the EAs manually is
  57. not atomic with the mount operation. To address this problem, an
  58. additional kernel option may be defined to auto-start EAs on a UFS file
  59. system based on special directories at mount-time:
  60. options UFS_EXTATTR_AUTOSTART
  61. If this option is defined, UFS will search for a ".attribute"
  62. sub-directory of the filesystem root during the mount operation. If it
  63. is found, EA support will be started for the filesystem. UFS will then
  64. search for "system" and "user" sub-directories of the ".attribute"
  65. directory for any potential backing files, and enable an EA for each valid
  66. backing file with the name of the backing file as the attribute name.
  67. For example, by creating the following tree, the two EAs,
  68. posix1e.acl_access and posix1e.acl_default will be enabled in the system
  69. namespace of the root filesystem, reserving space for attribute data:
  70. mkdir -p /.attribute/system
  71. cd /.attribute/system
  72. extattrctl initattr -p / 388 posix1e.acl_access
  73. extattrctl initattr -p / 388 posix1e.acl_default
  74. On the next mount of the root filesystem, the attributes will be
  75. automatically started.