1*d7b84b20Swiz.\" $NetBSD: extattrctl.8,v 1.5 2011/06/17 18:20:40 wiz Exp $ 2e1afed9cSthorpej.\" 3e1afed9cSthorpej.\" Copyright (c) 2000-2001 Robert N. M. Watson 4e1afed9cSthorpej.\" All rights reserved. 5e1afed9cSthorpej.\" 6e1afed9cSthorpej.\" This software was developed by Robert Watson for the TrustedBSD Project. 7e1afed9cSthorpej.\" 8e1afed9cSthorpej.\" Redistribution and use in source and binary forms, with or without 9e1afed9cSthorpej.\" modification, are permitted provided that the following conditions 10e1afed9cSthorpej.\" are met: 11e1afed9cSthorpej.\" 1. Redistributions of source code must retain the above copyright 12e1afed9cSthorpej.\" notice, this list of conditions and the following disclaimer. 13e1afed9cSthorpej.\" 2. Redistributions in binary form must reproduce the above copyright 14e1afed9cSthorpej.\" notice, this list of conditions and the following disclaimer in the 15e1afed9cSthorpej.\" documentation and/or other materials provided with the distribution. 16e1afed9cSthorpej.\" 17e1afed9cSthorpej.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18e1afed9cSthorpej.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19e1afed9cSthorpej.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20e1afed9cSthorpej.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21e1afed9cSthorpej.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22e1afed9cSthorpej.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23e1afed9cSthorpej.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24e1afed9cSthorpej.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25e1afed9cSthorpej.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26e1afed9cSthorpej.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27e1afed9cSthorpej.\" SUCH DAMAGE. 28e1afed9cSthorpej.\" 29e1afed9cSthorpej.\" $FreeBSD: src/usr.sbin/extattrctl/extattrctl.8,v 1.24 2005/02/09 18:04:40 ru Exp $ 30e1afed9cSthorpej.\" 31e1afed9cSthorpej.\" Developed by the TrustedBSD Project. 32e1afed9cSthorpej.\" Support for file system extended attribute. 33e1afed9cSthorpej.\" 34*d7b84b20Swiz.Dd June 17, 2011 35e1afed9cSthorpej.Dt EXTATTRCTL 8 36e1afed9cSthorpej.Os 37e1afed9cSthorpej.Sh NAME 38e1afed9cSthorpej.Nm extattrctl 39e1afed9cSthorpej.Nd manage UFS1 extended attributes 40e1afed9cSthorpej.Sh SYNOPSIS 41e1afed9cSthorpej.Nm 42e1afed9cSthorpej.Cm start 43e1afed9cSthorpej.Ar path 44e1afed9cSthorpej.Nm 45e1afed9cSthorpej.Cm stop 46e1afed9cSthorpej.Ar path 47e1afed9cSthorpej.Nm 48e1afed9cSthorpej.Cm initattr 49e1afed9cSthorpej.Op Fl f 50e1afed9cSthorpej.Op Fl p Ar path 51e1afed9cSthorpej.Ar attrsize 52e1afed9cSthorpej.Ar attrfile 53e1afed9cSthorpej.Nm 54e1afed9cSthorpej.Cm showattr 55e1afed9cSthorpej.Ar attrfile 56e1afed9cSthorpej.Nm 57e1afed9cSthorpej.Cm enable 58e1afed9cSthorpej.Ar path 59e1afed9cSthorpej.Ar attrnamespace 60e1afed9cSthorpej.Ar attrname 61e1afed9cSthorpej.Ar attrfile 62e1afed9cSthorpej.Nm 63e1afed9cSthorpej.Cm disable 64e1afed9cSthorpej.Ar path 65e1afed9cSthorpej.Ar attrnamespace 66e1afed9cSthorpej.Ar attrname 67e1afed9cSthorpej.Sh DESCRIPTION 68e1afed9cSthorpejThe 69e1afed9cSthorpej.Nm 70e1afed9cSthorpejutility 71e1afed9cSthorpejis the management utility for extended attributes over the UFS1 file system. 72e1afed9cSthorpejIt allows the starting and stopping of extended attributes on a file system, 73e1afed9cSthorpejas well as initialization of attribute backing files, and enabling and 74e1afed9cSthorpejdisabling of specific extended attributes on a file system. 75e1afed9cSthorpej.Pp 76e1afed9cSthorpejThe first argument on the command line indicates the operation to be 77e1afed9cSthorpejperformed. 78e1afed9cSthorpejOperation must be one of the following: 79e1afed9cSthorpej.Bl -tag -width indent 80e1afed9cSthorpej.It Cm start Ar path 81e1afed9cSthorpejStart extended attribute support on the file system named using 82e1afed9cSthorpej.Ar path . 83971a82acSwizThe file system must be a UFS1 file system, and the 84971a82acSwiz.Dv UFS_EXTATTR 85*d7b84b20Swizkernel option must have been enabled. 86*d7b84b20SwizIf 87448e1c49Smanu.Pa .attribute/user 88448e1c49Smanuand 89448e1c49Smanu.Pa .attribute/system 90*d7b84b20Swizexist at the filesystem root, extended attributes backed by files 91*d7b84b20Swizin these directories will be automatically enabled. 92*d7b84b20SwizNote that extended attributes can be automatically started at mount 93*d7b84b20Swiztime by using the 94448e1c49Smanu.Cm -o extattr 95448e1c49Smanuoption to 96448e1c49Smanu.Xr mount 8 . 97e1afed9cSthorpej.It Cm stop Ar path 98e1afed9cSthorpejStop extended attribute support on the file system named using 99e1afed9cSthorpej.Ar path . 100e1afed9cSthorpejExtended attribute support must previously have been started. 101e4e7c434Sjoerg.It Cm initattr Oo Fl f Oc Oo Fl p Ar path Oc Ar attrsize attrfile 102e1afed9cSthorpejCreate and initialize a file to use as an attribute backing file. 103e1afed9cSthorpejYou must specify a maximum per-inode size for the attribute in bytes in 104e1afed9cSthorpej.Ar attrsize , 105e1afed9cSthorpejas well as the file where the attribute will be stored, using 106e1afed9cSthorpej.Ar attrfile . 107e1afed9cSthorpej.Pp 108e1afed9cSthorpejThe 109e1afed9cSthorpej.Fl f 110e1afed9cSthorpejargument may be used to indicate that it is alright to overwrite an 111e1afed9cSthorpejexisting attribute backing file; otherwise, if the target file exists, 112e1afed9cSthorpejan error will be returned. 113e1afed9cSthorpej.Pp 114e1afed9cSthorpejThe 115e1afed9cSthorpej.Fl p Ar path 116e1afed9cSthorpejargument may be used to preallocate space for all attributes rather than 117e1afed9cSthorpejrelying on sparse files to conserve space. 118e1afed9cSthorpejThis has the advantage of guaranteeing that space will be available 119e1afed9cSthorpejfor attributes when they are written, preventing low disk space conditions 120e1afed9cSthorpejfrom denying attribute service. 121e1afed9cSthorpej.Pp 122e1afed9cSthorpejThis file should not exist before running 123e1afed9cSthorpej.Cm initattr . 124448e1c49Smanu.Pp 125*d7b84b20SwizWhen a user attempts to set a 126448e1c49Smanu.Dq user 127448e1c49Smanuor 128448e1c49Smanu.Dq system 129448e1c49Smanuextended attribute that lacks a backing file, 130448e1c49Smanuthe kernel will attempt to automatically create it, provided 131448e1c49Smanu.Pa .attribute/user 132448e1c49Smanuor 133448e1c49Smanu.Pa .attribute/system 134*d7b84b20Swizexist and are writable by the requesting user. 135e1afed9cSthorpej.It Cm showattr Ar attrfile 136e1afed9cSthorpejShow the attribute header values in the attribute file named by 137e1afed9cSthorpej.Ar attrfile . 138e1afed9cSthorpej.It Cm enable Ar path attrnamespace attrname attrfile 139e1afed9cSthorpejEnable an attribute named 140e1afed9cSthorpej.Ar attrname 141e1afed9cSthorpejin the namespace 142e1afed9cSthorpej.Ar attrnamespace 143e1afed9cSthorpejon the file system identified using 144e1afed9cSthorpej.Ar path , 145e1afed9cSthorpejand backed by initialized attribute file 146e1afed9cSthorpej.Ar attrfile . 147971a82acSwizAvailable namespaces are 148971a82acSwiz.Dq user 149971a82acSwizand 150971a82acSwiz.Dq system . 151e1afed9cSthorpejThe backing file must have been initialized using 152e1afed9cSthorpej.Cm initattr 153e1afed9cSthorpejbefore its first use. 154e1afed9cSthorpejAttributes must have been started on the file system prior to the 155e1afed9cSthorpejenabling of any attributes. 156e1afed9cSthorpej.It Cm disable Ar path attrnamespace attrname 157e1afed9cSthorpejDisable the attributed named 158e1afed9cSthorpej.Ar attrname 159e1afed9cSthorpejin namespace 160e1afed9cSthorpej.Ar attrnamespace 161e1afed9cSthorpejon the file system identified by 162e1afed9cSthorpej.Ar path . 163971a82acSwizAvailable namespaces are 164971a82acSwiz.Dq user 165971a82acSwizand 166971a82acSwiz.Dq system . 167e1afed9cSthorpejThe file system must have attributes started on it, and the attribute 168e1afed9cSthorpejmost have been enabled using 169e1afed9cSthorpej.Cm enable . 170e1afed9cSthorpej.El 171e1afed9cSthorpej.Sh EXAMPLES 172e1afed9cSthorpej.Dl extattrctl start / 173e1afed9cSthorpej.Pp 174e1afed9cSthorpejStart extended attributes on the root file system. 175e1afed9cSthorpej.Pp 176e1afed9cSthorpej.Dl extattrctl initattr 17 /.attribute/system/md5 177e1afed9cSthorpej.Pp 178971a82acSwizCreate an attribute backing file in 179971a82acSwiz.Pa /.attribute/system/md5 , 180971a82acSwizand set the maximum size of each attribute to 17 bytes, with a 181971a82acSwizsparse file used for storing the attributes. 182e1afed9cSthorpej.Pp 183e1afed9cSthorpej.Dl extattrctl enable / system md5 /.attribute/system/md5 184e1afed9cSthorpej.Pp 185e1afed9cSthorpejEnable an attribute named md5 on the root file system, backed from the file 186971a82acSwiz.Pa /.attribute/system/md5 . 187e1afed9cSthorpej.Pp 188e1afed9cSthorpej.Dl extattrctl disable / md5 189e1afed9cSthorpej.Pp 190e1afed9cSthorpejDisable the attribute named md5 on the root file system. 191e1afed9cSthorpej.Pp 192e1afed9cSthorpej.Dl extattrctl stop / 193e1afed9cSthorpej.Pp 194e1afed9cSthorpejStop extended attributes on the root file system. 195e1afed9cSthorpej.Sh SEE ALSO 196*d7b84b20Swiz.Xr getextattr 1 , 197e1afed9cSthorpej.Xr extattr_get_file 2 , 198e1afed9cSthorpej.\" .Xr ffs 7 , 199e1afed9cSthorpej.Xr extattr 9 200e1afed9cSthorpej.Sh HISTORY 201971a82acSwizExtended attribute support was developed as part of the TrustedBSD 202971a82acSwizProject, and introduced in 203e1afed9cSthorpej.Fx 5.0 204e1afed9cSthorpejand 205e1afed9cSthorpej.Nx 4.0 . 206971a82acSwizIt was developed to support security extensions requiring additional 207*d7b84b20Swizlabels to be associated with each file or directory. 208*d7b84b20SwizBacking file autocreation was added in 209*d7b84b20Swiz.Nx 6.0 . 210e1afed9cSthorpej.Sh AUTHORS 211971a82acSwiz.An Robert N M Watson 212e1afed9cSthorpej.Sh BUGS 213e1afed9cSthorpej.Nm 214e1afed9cSthorpejworks only on UFS1 file systems. 215971a82acSwizThe kernel support for extended attribute backing files and this 216971a82acSwizcontrol program should be generalized for any file system that 217971a82acSwizlacks native extended attribute support. 218