Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

kill(1)

ufsdump(1M)

fs_ufs(4)

lockfs(1M)

NAME

lockfs − change or report file system locks

SYNOPSIS

/usr/sbin/lockfs [ −dhnuw ] [ −c string ] [ −a ] [ file-system ... ]

DESCRIPTION

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. 

file-system is a list of pathnames separated by white space.  If file-system is not specified, and −a is specified, lockfs is run on all mounted, ufs type file systems. 

When invoked with no arguments, lockfs lists the ufs file systems that are locked. 

OPTIONS

You must be super-user to use any of the following options, with the exception of the −a option. 

−a Apply command to all mounted, ufs type file systems.  file-system is ignored when −a is specified. 

−d delete-lock (dlock) the specified file-system. dlock suspends access that could remove directory entries.

−h Hard-lock (hlock) the specified file-system. hlock returns an error on every access to the locked file system, and cannot be unlocked. hlocked file systems can be unmounted.

−n Name-lock (nlock) the specified file-system. nlock suspends accesses that could change or remove existing directories entries.

−u Unlock (ulock) the specified file-system. ulock awakens suspended accesses.

−w Write-lock (wlock) the specified file-system. wlock suspends writes that would modify the file system. Access times are not kept while a file system is write-locked.

−c string
Accept a string that is passed as the comment field. The −c only takes affect when the lock is being set using either the d, h, n, u, or w options. 

EXAMPLES

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
Filesystem     Locktype     Comment
/                       unlock
/var                 unlock
example#

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
Filesystem     Locktype     Comment
/                       unlock
/var                 write             lockfs: 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
Filesystem     Locktype     Comment
/var                 unlock         lockfs: unlock example
example#

SEE ALSO

kill(1), ufsdump(1M), fs_ufs(4)

SunOS 5.1 Routine System Administration Guide

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.

SunOS 5.1/SPARC  —  Last change: 17 Mar 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026