Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
System Administration Commandslockfs(1M)


NAME

 lockfs - change or report file system locks

SYNOPSIS

 /usr/sbin/lockfs [-adefhnuw] [-c string] [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.

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 following options (described below) 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.

OPTIONS

 

The following options are supported. You must be super-user to use any of the following options, with the exception of -a.

-a
Apply command to all mounted, UFS type file systems. file-system is ignored when -a is specified.
-c string
Accept a string that is passed as the comment field. The -c only takes affect when the lock is being set using the -d, -h, -n, -u, or -w options.
-d
delete-lock (dlock) the specified file-system. dlock suspends access that could remove directory entries.
-e
error-lock (elock) the specified file-system. elock blocks all local access to the locked file system and returns EWOULDBLOCK on all remote access. File systems are elocked by UFS on detection of internal inconsistency. They may only be unlocked after successful repair by fsck, which is usually done automatically (see mount_ufs(1M)). elocked file systems can be unmounted.
-f
Flush all transactions out of the log and write the transactions to the master file system. This option is valid only if logging has been enabled on the file system.
-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.

OPERANDS

 

The following operands are supported.

file-system
A list of path names separated by white spaces.

USAGE

 

See largefile(5) for the description of the behavior of lockfs when encountering files greater than or equal to 2 Gbyte ( 231 bytes).

EXAMPLES

 Example 1. lockfs with the a option.
 

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

FilesystemLocktype Comment
/unlock 
/varunlock 

example#

Example 2. lockfs with the w option.
 

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#

Example 3. lockfs with the u option.
 

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#

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
AvailabilitySUNWcsu

SEE ALSO

 

kill(1), mount_ufs(1M), fs_ufs(4), attributes(5), largefile(5)

System Administration Guide: Basic Administration

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.9Go To TopLast Changed 13 Feb 1998

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.