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 by an application such as ufsdump(1M) . This could occur if ufsdump(1M) is killed using kill(1) .
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.
You must be super-user to use any of the following options, with the exception of -a.
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 -aexample#
Filesystem Locktype Comment / unlock /var unlock
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 FilesystemLocktypeComment/unlock/varwritelockfs: write lock example example#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 FilesystemLocktypeComment/varunlocklockfs: unlock example example#See Also
kill(1) , mount_ufs(1M) , ufsdump(1M) , fs_ufs(4)
Diagnostics
- file system: Not owner
- You must be root to use this command.
- file system :Deadlock condition detected/avoided
- A file is enabled for accounting or swapping, on file system.
- file system: Device busy
- Another process is setting the lock on file system.