|LOCKFS(8)||Maintenance Commands and Procedures||LOCKFS(8)|
/usr/sbin/lockfs [-adefhnuw] [-c string] [file-system]...
lockfs is used to change and report the status of file system locks. lockfs reports the lock status and unlocks the file systems that were improperly left locked.
Using lockfs to lock a file system is discouraged because this requires extensive knowledge of SunOS internals to be used effectively and correctly.
When invoked with no arguments, lockfs lists the UFS file systems that are locked. If file-system is not specified, and -a is specified, lockfs is run on all mounted, UFS type file systems.
The options are mutually exclusive: wndheuf. If you do specify more than one of these options on a lockfs command line, the utility does not protest and invokes only the last option specified. In particular, you cannot specify a flush (-f) and a lock (for example, -w) on the same command line. However, all locking operations implicitly perform a flush, so the -f is superfluous when specifying a lock.
You must be super-user to use any of the following options, with the exception of -a, -f and -v.
The following options are supported.
It is a more reliable method than using sync(8) because it does not return until all possible data has been pushed. In the case of UFS filesystems with logging enabled, the log is also rolled before returning. Additional data can be modified by the time fsflush exits, so using one of the locking options is more likely to be of general use.
The following operands are supported.
See largefile(7) for the description of the behavior of lockfs when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
In the following examples, filesystem is the pathname of the mounted-on directory (mount point). Locktype is one of "write," "name," "delete," "hard," or "unlock". When enclosed in parenthesis, the lock is being set. Comment is a string set by the process that last issued a lock command.
The following example shows the lockfs output when only the -a option is specified.
example# /usr/sbin/lockfs -a
Example 2 Using lockfs -w
The following example shows the lockfs output when the -w option is used to write lock the /var file system and the comment string is set using the -c option. The -a option is then specified on a separate command line.
example# /usr/sbin/lockfs -w -c "lockfs: write lock example" /var example# /usr/sbin/lockfs -a
|/var||write||lockfs: write lock example|
Example 3 Using lockfs -u
The following example shows the lockfs output when the -u option is used to unlock the /var file system and the comment string is set using the -c option.
example# /usr/sbin/lockfs -uc "lockfs: unlock example" /var example# /usr/sbin/lockfs /var
|/var||unlock||lockfs: unlock example|
file system :Deadlock condition detected/avoided
file system: Device busy
|January 2, 2008||OmniOS|