summaryrefslogtreecommitdiff
path: root/usr/src/man/man1m/lockfs.1m
blob: 3807d0461cabd1456eb9ba69164e39665b830166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
'\" te
.\"  Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved
.\" 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.
.\" 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.
.\" 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]
.TH LOCKFS 1M "Jan 2, 2008"
.SH NAME
lockfs \- change or report file system locks
.SH SYNOPSIS
.LP
.nf
\fB/usr/sbin/lockfs\fR [\fB-adefhnuw\fR] [\fB-c\fR \fIstring\fR] [\fIfile-system\fR]...
.fi

.SH DESCRIPTION
.sp
.LP
\fBlockfs\fR is used to change and report the status of file system locks.
\fBlockfs\fR reports the lock status and unlocks the file systems that were
improperly left locked.
.sp
.LP
Using \fBlockfs\fR to lock a file system is discouraged because this requires
extensive knowledge of SunOS internals to be used effectively and correctly.
.sp
.LP
When invoked with no arguments, \fBlockfs\fR lists the \fBUFS\fR file systems
that are locked. If \fIfile-system\fR is not specified, and \fB-a\fR is
specified, \fBlockfs\fR is run on all mounted, \fBUFS\fR type file systems.
.SH OPTIONS
.sp
.LP
The options are mutually exclusive: \fBwndheuf\fR. If you do specify more than
one of these options on a \fBlockfs\fR command line, the utility does not
protest and invokes only the last option specified. In particular, you cannot
specify a flush (\fB-f\fR) and a lock (for example, \fB-w\fR) on the same
command line. However, all locking operations implicitly perform a flush, so
the \fB-f\fR is superfluous when specifying a lock.
.sp
.LP
You must be super-user to use any of the following options, with the exception
of \fB-a\fR, \fB-f\fR and \fB-v\fR.
.sp
.LP
The following options are supported.
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.sp .6
.RS 4n
Apply command to all mounted, \fBUFS\fR type file systems. \fIfile-system\fR is
ignored when \fB-a\fR is specified.
.RE

.sp
.ne 2
.na
\fB\fB-c\fR \fIstring\fR\fR
.ad
.sp .6
.RS 4n
Accept a string that is passed as the comment field. The \fB-c\fR only takes
affect when the lock is being set using the \fB-d\fR, \fB-h\fR, \fB-n\fR,
\fB-u\fR, or \fB-w\fR options.
.RE

.sp
.ne 2
.na
\fB\fB-d\fR\fR
.ad
.sp .6
.RS 4n
Delete-lock (\fBdlock\fR) the specified \fIfile-system\fR. dlock suspends
access that could remove directory entries.
.RE

.sp
.ne 2
.na
\fB\fB-e\fR\fR
.ad
.sp .6
.RS 4n
Error-lock (\fBelock\fR) the specified \fIfile-system\fR. elock blocks all
local access to the locked file system and returns \fBEWOULDBLOCK\fR on all
remote access. File systems are elocked by \fBUFS\fR on detection of internal
inconsistency. They may only be unlocked after successful repair by \fBfsck\fR,
which is usually done automatically (see \fBmount_ufs\fR(1M)). elocked file
systems can be unmounted.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR\fR
.ad
.sp .6
.RS 4n
Force a synchronous flush of all data that is dirty at the time \fBfsflush\fR
is run to its backing store for the named file system (or for all file
systems.)
.sp
It is a more reliable method than using \fBsync\fR(1M) because it does not
return until all possible data has been pushed. In the case of \fBUFS\fR
filesystems with logging enabled, the log is also rolled before returning.
Additional data can be modified by the time \fBfsflush\fR exits, so using one
of the locking options is more likely to be of general use.
.RE

.sp
.ne 2
.na
\fB\fB-h\fR\fR
.ad
.sp .6
.RS 4n
Hard-lock (\fBhlock\fR) the specified \fIfile-system\fR. hlock returns an error
on every access to the locked file system, and cannot be unlocked. hlocked file
systems can be unmounted.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.sp .6
.RS 4n
Name-lock (\fBnlock\fR) the specified \fIfile-system\fR. nlock suspends
accesses that could change or remove existing directories entries.
.RE

.sp
.ne 2
.na
\fB\fB-u\fR\fR
.ad
.sp .6
.RS 4n
Unlock (\fBulock\fR) the specified \fIfile-system\fR. ulock awakens suspended
accesses.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.sp .6
.RS 4n
Enable verbose output.
.RE

.sp
.ne 2
.na
\fB\fB-w\fR\fR
.ad
.sp .6
.RS 4n
Write-lock (\fBwlock\fR) the specified \fIfile-system\fR. wlock suspends writes
that would modify the file system. Access times are not kept while a file
system is write-locked.
.RE

.SH OPERANDS
.sp
.LP
The following operands are supported.
.sp
.ne 2
.na
\fB\fIfile-system\fR\fR
.ad
.sp .6
.RS 4n
A list of path names separated by whitespace. Note that \fIfile-system\fR can
be a directory rather than the specific name of a file system, such as \fB/\fR
or \fB/usr\fR. For example, if you specify \fB/export/home\fR as an argument to
a \fBlockfs\fR command and \fB/export/home\fR is mounted on the root (\fB/\fR)
file system, the \fBlockfs\fR command will take effect on the root file system.
.RE

.SH USAGE
.sp
.LP
See \fBlargefile\fR(5) for the description of the behavior of \fBlockfs\fR when
encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
.SH EXAMPLES
.LP
\fBExample 1 \fRUsing \fBlockfs\fR \fB-a\fR
.sp
.LP
In the following examples, \fIfilesystem\fR is the pathname of the mounted-on
directory (mount point). \fBLocktype\fR is one of "\fBwrite\fR," "\fIname\fR,"
"\fIdelete\fR," "\fIhard\fR," or "\fIunlock\fR". When enclosed in parenthesis,
the lock is being set. \fBComment\fR is a string set by the process that last
issued a lock command.

.sp
.LP
The following example shows the \fBlockfs\fR output when only the \fB-a\fR
option is specified.

.sp
.in +2
.nf
example#  \fB/usr/sbin/lockfs -a\fR
.fi
.in -2
.sp

.sp

.sp
.TS
l l l
l l l .
Filesystem	Locktype	 Comment
/	unlock	
/var	unlock	
.TE

.sp
.in +2
.nf
example#
.fi
.in -2
.sp

.LP
\fBExample 2 \fRUsing \fBlockfs\fR \fB-w\fR
.sp
.LP
The following example shows the \fBlockfs\fR output when the \fB-w\fR option is
used to write lock the \fB/var\fR file system and the comment string is set
using the \fB-c\fR option.  The \fB-a\fR option is then specified on a separate
command line.

.sp
.in +2
.nf
example#  \fB/usr/sbin/lockfs -w -c "lockfs: write lock example" /var\fR
example#  \fB/usr/sbin/lockfs -a\fR
.fi
.in -2
.sp

.sp

.sp
.TS
l l l
l l l .
Filesystem	Locktype	Comment
/	unlock	
/var	write	lockfs: write lock example
.TE

.sp
.in +2
.nf
example#
.fi
.in -2
.sp

.LP
\fBExample 3 \fRUsing \fBlockfs\fR \fB-u\fR
.sp
.LP
The following example shows the \fBlockfs\fR output when the \fB-u\fR option is
used to unlock the \fB/var\fR file system and the comment string is set using
the \fB-c\fR option.

.sp
.in +2
.nf
example#  \fB/usr/sbin/lockfs -uc "lockfs: unlock example" /var\fR
example#  \fB/usr/sbin/lockfs /var\fR
.fi
.in -2
.sp

.sp

.sp
.TS
l l l
l l l .
Filesystem	Locktype	Comment
/var	unlock	lockfs: unlock example
.TE

.sp
.in +2
.nf
example#
.fi
.in -2
.sp

.SH SEE ALSO
.sp
.LP
\fBkill\fR(1), \fBmount_ufs\fR(1M), \fBsync\fR(1M), \fBattributes\fR(5),
\fBlargefile\fR(5), \fBufs\fR(7FS),
.sp
.LP
\fI\fR
.SH DIAGNOSTICS
.sp
.ne 2
.na
\fB\fIfile system\fR\fB: Not owner\fR\fR
.ad
.sp .6
.RS 4n
You must be root to use this command.
.RE

.sp
.ne 2
.na
\fB\fIfile system\fR \fB:Deadlock condition detected/avoided\fR\fR
.ad
.sp .6
.RS 4n
A file is enabled for accounting or swapping, on \fIfile system\fR.
.RE

.sp
.ne 2
.na
\fB\fIfile system\fR\fB: Device busy\fR\fR
.ad
.sp .6
.RS 4n
Another process is setting the lock on \fIfile system\fR.
.RE