1lockfs(1M) System Administration Commands lockfs(1M)
2
3
4
6 lockfs - change or report file system locks
7
9 /usr/sbin/lockfs [-adefhnuw] [-c string] [file-system]...
10
11
13 lockfs is used to change and report the status of file system locks.
14 lockfs reports the lock status and unlocks the file systems that were
15 improperly left locked.
16
17
18 Using lockfs to lock a file system is discouraged because this requires
19 extensive knowledge of SunOS internals to be used effectively and cor‐
20 rectly.
21
22
23 When invoked with no arguments, lockfs lists the UFS file systems that
24 are locked. If file-system is not specified, and -a is specified,
25 lockfs is run on all mounted, UFS type file systems.
26
28 The options are mutually exclusive: wndheuf. If you do specify more
29 than one of these options on a lockfs command line, the utility does
30 not protest and invokes only the last option specified. In particular,
31 you cannot specify a flush (-f) and a lock (for example, -w) on the
32 same command line. However, all locking operations implicitly perform a
33 flush, so the -f is superfluous when specifying a lock.
34
35
36 You must be super-user to use any of the following options, with the
37 exception of -a, -f and -v.
38
39
40 The following options are supported.
41
42 -a
43
44 Apply command to all mounted, UFS type file systems. file-system is
45 ignored when -a is specified.
46
47
48 -c string
49
50 Accept a string that is passed as the comment field. The -c only
51 takes affect when the lock is being set using the -d, -h, -n, -u,
52 or -w options.
53
54
55 -d
56
57 Delete-lock (dlock) the specified file-system. dlock suspends
58 access that could remove directory entries.
59
60
61 -e
62
63 Error-lock (elock) the specified file-system. elock blocks all
64 local access to the locked file system and returns EWOULDBLOCK on
65 all remote access. File systems are elocked by UFS on detection of
66 internal inconsistency. They may only be unlocked after successful
67 repair by fsck, which is usually done automatically (see
68 mount_ufs(1M)). elocked file systems can be unmounted.
69
70
71 -f
72
73 Force a synchronous flush of all data that is dirty at the time
74 fsflush is run to its backing store for the named file system (or
75 for all file systems.)
76
77 It is a more reliable method than using sync(1M) because it does
78 not return until all possible data has been pushed. In the case of
79 UFS filesystems with logging enabled, the log is also rolled before
80 returning. Additional data can be modified by the time fsflush
81 exits, so using one of the locking options is more likely to be of
82 general use.
83
84
85 -h
86
87 Hard-lock (hlock) the specified file-system. hlock returns an error
88 on every access to the locked file system, and cannot be unlocked.
89 hlocked file systems can be unmounted.
90
91
92 -n
93
94 Name-lock (nlock) the specified file-system. nlock suspends
95 accesses that could change or remove existing directories entries.
96
97
98 -u
99
100 Unlock (ulock) the specified file-system. ulock awakens suspended
101 accesses.
102
103
104 -v
105
106 Enable verbose output.
107
108
109 -w
110
111 Write-lock (wlock) the specified file-system. wlock suspends writes
112 that would modify the file system. Access times are not kept while
113 a file system is write-locked.
114
115
117 The following operands are supported.
118
119 file-system
120
121 A list of path names separated by whitespace. Note that file-system
122 can be a directory rather than the specific name of a file system,
123 such as / or /usr. For example, if you specify /export/home as an
124 argument to a lockfs command and /export/home is mounted on the
125 root (/) file system, the lockfs command will take effect on the
126 root file system.
127
128
130 See largefile(5) for the description of the behavior of lockfs when
131 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
132
134 Example 1 Using lockfs -a
135
136
137 In the following examples, filesystem is the pathname of the mounted-on
138 directory (mount point). Locktype is one of "write," "name," "delete,"
139 "hard," or "unlock". When enclosed in parenthesis, the lock is being
140 set. Comment is a string set by the process that last issued a lock
141 command.
142
143
144
145 The following example shows the lockfs output when only the -a option
146 is specified.
147
148
149 example# /usr/sbin/lockfs -a
150
151
152
153
154
155
156 Filesystem Locktype Comment
157 / unlock
158 /var unlock
159
160
161 example#
162
163
164
165 Example 2 Using lockfs -w
166
167
168 The following example shows the lockfs output when the -w option is
169 used to write lock the /var file system and the comment string is set
170 using the -c option. The -a option is then specified on a separate
171 command line.
172
173
174 example# /usr/sbin/lockfs -w -c "lockfs: write lock example" /var
175 example# /usr/sbin/lockfs -a
176
177
178
179
180
181
182 Filesystem Locktype Comment
183 / unlock
184 /var write lockfs: write lock example
185
186
187 example#
188
189
190
191 Example 3 Using lockfs -u
192
193
194 The following example shows the lockfs output when the -u option is
195 used to unlock the /var file system and the comment string is set using
196 the -c option.
197
198
199 example# /usr/sbin/lockfs -uc "lockfs: unlock example" /var
200 example# /usr/sbin/lockfs /var
201
202
203
204
205
206
207 Filesystem Locktype Comment
208 /var unlock lockfs: unlock example
209
210
211 example#
212
213
214
216 See attributes(5) for descriptions of the following attributes:
217
218
219
220
221 ┌─────────────────────────────┬─────────────────────────────┐
222 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
223 ├─────────────────────────────┼─────────────────────────────┤
224 │Availability │SUNWcsu │
225 └─────────────────────────────┴─────────────────────────────┘
226
228 kill(1), mount_ufs(1M), sync(1M), attributes(5), largefile(5),
229 ufs(7FS),
230
231
232
233
235 file system: Not owner
236
237 You must be root to use this command.
238
239
240 file system :Deadlock condition detected/avoided
241
242 A file is enabled for accounting or swapping, on file system.
243
244
245 file system: Device busy
246
247 Another process is setting the lock on file system.
248
249
250
251
252SunOS 5.11 2 Jan 2008 lockfs(1M)