8980 BIOS clock is sometimes one hour fast
[unleashed.git] / usr / src / man / man1m / lockfs.1m
blob3807d0461cabd1456eb9ba69164e39665b830166
1 '\" te
2 .\"  Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH LOCKFS 1M "Jan 2, 2008"
7 .SH NAME
8 lockfs \- change or report file system locks
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB/usr/sbin/lockfs\fR [\fB-adefhnuw\fR] [\fB-c\fR \fIstring\fR] [\fIfile-system\fR]...
13 .fi
15 .SH DESCRIPTION
16 .sp
17 .LP
18 \fBlockfs\fR is used to change and report the status of file system locks.
19 \fBlockfs\fR reports the lock status and unlocks the file systems that were
20 improperly left locked.
21 .sp
22 .LP
23 Using \fBlockfs\fR to lock a file system is discouraged because this requires
24 extensive knowledge of SunOS internals to be used effectively and correctly.
25 .sp
26 .LP
27 When invoked with no arguments, \fBlockfs\fR lists the \fBUFS\fR file systems
28 that are locked. If \fIfile-system\fR is not specified, and \fB-a\fR is
29 specified, \fBlockfs\fR is run on all mounted, \fBUFS\fR type file systems.
30 .SH OPTIONS
31 .sp
32 .LP
33 The options are mutually exclusive: \fBwndheuf\fR. If you do specify more than
34 one of these options on a \fBlockfs\fR command line, the utility does not
35 protest and invokes only the last option specified. In particular, you cannot
36 specify a flush (\fB-f\fR) and a lock (for example, \fB-w\fR) on the same
37 command line. However, all locking operations implicitly perform a flush, so
38 the \fB-f\fR is superfluous when specifying a lock.
39 .sp
40 .LP
41 You must be super-user to use any of the following options, with the exception
42 of \fB-a\fR, \fB-f\fR and \fB-v\fR.
43 .sp
44 .LP
45 The following options are supported.
46 .sp
47 .ne 2
48 .na
49 \fB\fB-a\fR\fR
50 .ad
51 .sp .6
52 .RS 4n
53 Apply command to all mounted, \fBUFS\fR type file systems. \fIfile-system\fR is
54 ignored when \fB-a\fR is specified.
55 .RE
57 .sp
58 .ne 2
59 .na
60 \fB\fB-c\fR \fIstring\fR\fR
61 .ad
62 .sp .6
63 .RS 4n
64 Accept a string that is passed as the comment field. The \fB-c\fR only takes
65 affect when the lock is being set using the \fB-d\fR, \fB-h\fR, \fB-n\fR,
66 \fB-u\fR, or \fB-w\fR options.
67 .RE
69 .sp
70 .ne 2
71 .na
72 \fB\fB-d\fR\fR
73 .ad
74 .sp .6
75 .RS 4n
76 Delete-lock (\fBdlock\fR) the specified \fIfile-system\fR. dlock suspends
77 access that could remove directory entries.
78 .RE
80 .sp
81 .ne 2
82 .na
83 \fB\fB-e\fR\fR
84 .ad
85 .sp .6
86 .RS 4n
87 Error-lock (\fBelock\fR) the specified \fIfile-system\fR. elock blocks all
88 local access to the locked file system and returns \fBEWOULDBLOCK\fR on all
89 remote access. File systems are elocked by \fBUFS\fR on detection of internal
90 inconsistency. They may only be unlocked after successful repair by \fBfsck\fR,
91 which is usually done automatically (see \fBmount_ufs\fR(1M)). elocked file
92 systems can be unmounted.
93 .RE
95 .sp
96 .ne 2
97 .na
98 \fB\fB-f\fR\fR
99 .ad
100 .sp .6
101 .RS 4n
102 Force a synchronous flush of all data that is dirty at the time \fBfsflush\fR
103 is run to its backing store for the named file system (or for all file
104 systems.)
106 It is a more reliable method than using \fBsync\fR(1M) because it does not
107 return until all possible data has been pushed. In the case of \fBUFS\fR
108 filesystems with logging enabled, the log is also rolled before returning.
109 Additional data can be modified by the time \fBfsflush\fR exits, so using one
110 of the locking options is more likely to be of general use.
114 .ne 2
116 \fB\fB-h\fR\fR
118 .sp .6
119 .RS 4n
120 Hard-lock (\fBhlock\fR) the specified \fIfile-system\fR. hlock returns an error
121 on every access to the locked file system, and cannot be unlocked. hlocked file
122 systems can be unmounted.
126 .ne 2
128 \fB\fB-n\fR\fR
130 .sp .6
131 .RS 4n
132 Name-lock (\fBnlock\fR) the specified \fIfile-system\fR. nlock suspends
133 accesses that could change or remove existing directories entries.
137 .ne 2
139 \fB\fB-u\fR\fR
141 .sp .6
142 .RS 4n
143 Unlock (\fBulock\fR) the specified \fIfile-system\fR. ulock awakens suspended
144 accesses.
148 .ne 2
150 \fB\fB-v\fR\fR
152 .sp .6
153 .RS 4n
154 Enable verbose output.
158 .ne 2
160 \fB\fB-w\fR\fR
162 .sp .6
163 .RS 4n
164 Write-lock (\fBwlock\fR) the specified \fIfile-system\fR. wlock suspends writes
165 that would modify the file system. Access times are not kept while a file
166 system is write-locked.
169 .SH OPERANDS
172 The following operands are supported.
174 .ne 2
176 \fB\fIfile-system\fR\fR
178 .sp .6
179 .RS 4n
180 A list of path names separated by whitespace. Note that \fIfile-system\fR can
181 be a directory rather than the specific name of a file system, such as \fB/\fR
182 or \fB/usr\fR. For example, if you specify \fB/export/home\fR as an argument to
183 a \fBlockfs\fR command and \fB/export/home\fR is mounted on the root (\fB/\fR)
184 file system, the \fBlockfs\fR command will take effect on the root file system.
187 .SH USAGE
190 See \fBlargefile\fR(5) for the description of the behavior of \fBlockfs\fR when
191 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
192 .SH EXAMPLES
194 \fBExample 1 \fRUsing \fBlockfs\fR \fB-a\fR
197 In the following examples, \fIfilesystem\fR is the pathname of the mounted-on
198 directory (mount point). \fBLocktype\fR is one of "\fBwrite\fR," "\fIname\fR,"
199 "\fIdelete\fR," "\fIhard\fR," or "\fIunlock\fR". When enclosed in parenthesis,
200 the lock is being set. \fBComment\fR is a string set by the process that last
201 issued a lock command.
205 The following example shows the \fBlockfs\fR output when only the \fB-a\fR
206 option is specified.
209 .in +2
211 example#  \fB/usr/sbin/lockfs -a\fR
213 .in -2
220 l l l
221 l l l .
222 Filesystem      Locktype         Comment
223 /       unlock  
224 /var    unlock  
228 .in +2
230 example#
232 .in -2
236 \fBExample 2 \fRUsing \fBlockfs\fR \fB-w\fR
239 The following example shows the \fBlockfs\fR output when the \fB-w\fR option is
240 used to write lock the \fB/var\fR file system and the comment string is set
241 using the \fB-c\fR option.  The \fB-a\fR option is then specified on a separate
242 command line.
245 .in +2
247 example#  \fB/usr/sbin/lockfs -w -c "lockfs: write lock example" /var\fR
248 example#  \fB/usr/sbin/lockfs -a\fR
250 .in -2
257 l l l
258 l l l .
259 Filesystem      Locktype        Comment
260 /       unlock  
261 /var    write   lockfs: write lock example
265 .in +2
267 example#
269 .in -2
273 \fBExample 3 \fRUsing \fBlockfs\fR \fB-u\fR
276 The following example shows the \fBlockfs\fR output when the \fB-u\fR option is
277 used to unlock the \fB/var\fR file system and the comment string is set using
278 the \fB-c\fR option.
281 .in +2
283 example#  \fB/usr/sbin/lockfs -uc "lockfs: unlock example" /var\fR
284 example#  \fB/usr/sbin/lockfs /var\fR
286 .in -2
293 l l l
294 l l l .
295 Filesystem      Locktype        Comment
296 /var    unlock  lockfs: unlock example
300 .in +2
302 example#
304 .in -2
307 .SH SEE ALSO
310 \fBkill\fR(1), \fBmount_ufs\fR(1M), \fBsync\fR(1M), \fBattributes\fR(5),
311 \fBlargefile\fR(5), \fBufs\fR(7FS),
314 \fI\fR
315 .SH DIAGNOSTICS
317 .ne 2
319 \fB\fIfile system\fR\fB: Not owner\fR\fR
321 .sp .6
322 .RS 4n
323 You must be root to use this command.
327 .ne 2
329 \fB\fIfile system\fR \fB:Deadlock condition detected/avoided\fR\fR
331 .sp .6
332 .RS 4n
333 A file is enabled for accounting or swapping, on \fIfile system\fR.
337 .ne 2
339 \fB\fIfile system\fR\fB: Device busy\fR\fR
341 .sp .6
342 .RS 4n
343 Another process is setting the lock on \fIfile system\fR.