unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



fsck(8)								      fsck(8)



NAME

  fsck,	ufs_fsck - Check and repair UFS	file systems

SYNOPSIS

  /usr/sbin/fsck [fs_options] [filesystem...]

OPTIONS

  The following	options	are interpreted	by fsck:

  -b block
      Uses the specified block number as the super block for the file system.
      Block 32 is usually an alternate super block.

  -B  Converts UFS Version 4 back to UFS Version 3. When you use the -B
      option on	a UFS Version 4	file system, it	will be	marked as a Version 3
      file system if there are no files	or directories with more than 32767
      hardlinks	or 32765 subdirectories.

  -c  If the file system is in the old (static table) format, this option
      converts it to the new (dynamic table) format. If	the file system	is in
      the new format, this option converts it to the old format, provided
      that the old format can support the file system configuration.  In
      interactive mode,	fsck lists the direction of the	conversion and asks
      if the conversion	should be done.	If you answer "no," no further opera-
      tions are	done on	the file system. If the	-p option is specified,	the
      direction	of the conversion is listed and	the conversion is performed
      without user interaction if possible. The	-p option should be used if
      all the file systems are being converted simultaneously. The format of
      a	file system can	be determined from the first line of output from the
      dumpfs command.

  -f  Forces fsck to check the root file system, even when the file system is
      mounted as writable. Use this option with	caution, because running fsck
      on a mounted root	file system can	cause its files	to become out of syn-
      chronization with	running	system data.  If the problem occurs, the fsck
      program displays a message recommending you reboot the system.

  -l number
      Limits the number	of parallel checks to the number specified.  By
      default, the limit is the	number of disks	running	one process per	disk.
      If a smaller limit is given, the disks are checked using a round
      robin-type schedule, one file system at a	time.

  -m mode
      Uses the mode specified in octal as the permission bits to use when
      creating the lost+found directory	rather than the	default	777. In	par-
      ticular, systems that do not want	to have	lost files accessible by all
      users on the system should use a more restrictive	set of permissions,
      such as 700.

  -n  Answers "no" to all the prompts except for the "CONTINUE?" prompt. The
      option does not write to the lost+found file in the file system.	If
      you do not have write permission on the file system, fsck	defaults to
      the behavior of the -n option.

  -o  Causes fsck to unconditionally check the file system even	if the file
      system's clean byte is set.  That	is, a file system is checked even if
      it has been unmounted cleanly.

  -p  Noninteractively corrects	the following file system inconsistencies:
      unreferenced inodes, link	counts in inodes that are too large, missing
      blocks in	the free map, blocks in	the free map that are also in files,
      and wrong	counts in the super-block.

  -v  Causes more extensive messages to	be displayed during the	file system
      checks (verbose mode).

  -y  Answers "yes" to all the prompts.	This option should be used with	cau-
      tion because the integrity of the	file system data can be	corrupted by
      answering	"yes" to all the prompts.

DESCRIPTION

  The fsck command is a	front-end program for the ufs_fsck program, which
  checks and repairs UFS file systems. Do not use this command for AdvFS file
  systems:  instead, see advfs(4).

  The fsck program has more consistency	checks than its	check, dcheck,
  fcheck, and icheck predecessors combined.

  You must be root to use this command.

  If you do not	specify	a file system in the command line, the fsck command
  checks the file systems in the /etc/fstab file.

  With one exception, the fsck command cannot be used on an active file	sys-
  tem. The command checks to determine whether the partition to	be checked,
  or an	overlapping partition, is in use.  The exceptional case	occurs when
  you run the command on an active root	file system and	specify	the -f
  option. Use this option with caution,	because	it can cause the data on the
  running system (the in-memory	data) to become	unsynchronized from the	file
  system data (the on-disk data).

  The fsck program interactively repairs inconsistent file system conditions.
  If the file system is	found to be consistent,	the number of files, blocks
  used,	and free blocks	are reported.  If the file system is inconsistent,
  you are prompted before each correction is attempted.	For each corrected
  inconsistency, one or	more lines are displayed, identifying the file system
  on which the correction takes	place and the type of correction.  After suc-
  cessfully correcting a file system, the fsck program displays	the number of
  files	on that	file system, the number	of used	and free blocks, and the per-
  centage of fragmentation.

  The default behavior of the fsck program is to interactively check the fol-
  lowing UFS file system inconsistencies:

       Blocks claimed by more than one inode or	the free map
       Blocks claimed by an inode outside the range of the file	system
       Incorrect link counts
       Size checks: directory size not of proper format; partially truncated file
       Bad inode format
       Blocks not accounted for	anywhere
       Directory checks: file pointing to unallocated inode; inode number out of range;	. (dot)	or .. (dot dot)	not the	first two entries of a directory or having the wrong inode number
       Super Block checks: more	blocks for inodes than there are in the	file system
       Bad free	block map format
       Total free block	and/or free inode count	incorrect

  If you use the -p option, the	fsck program noninteractively attempts to
  correct specific file	system inconsistencies.	 The corrections are made
  only if they can be done safely. The fsck program can	noninteractively
  correct the following	file system inconsistencies:

       Unreferenced inodes
       Link counts in inodes that are too large
       Missing blocks in the free map
       Blocks in the free map that are also in files
       Wrong counts in the super-block.

  If fsck encounters any other inconsistencies,	it exits with an abnormal
  return status	and a subsequent reboot	will fail.

  The system makes sure	that only a restricted class of	innocuous incon-
  sistencies can occur unless hardware or software failures intervene.

  Note that some of the	corrective actions can result in a loss	of data.  The
  amount and severity of data lost can be determined from the diagnostic out-
  put.

  At system boot, fsck -p runs automatically and reads the /etc/fstab file to
  determine which file systems to check. Only partitions that are mounted rw
  or ro	and have a non-zero pass (1 or more) number are	checked.  File sys-
  tems that have a pass	number 1 (usually only the root	file system) are
  checked one at a time.  When pass 1 completes, the remaining pass numbers
  are processed	with one parallel fsck process running per disk	drive in the
  same pass.

  The per disk drive logic is based on the /dev/disk/dsk0a syntax where	dif-
  ferent partition letters are treated as being	on the same disk drive.	 Par-
  titions layered on top of an LSM device may not follow this naming conven-
  tion.	 Where LSM is used, you	can use	unique pass numbers in the /etc/fstab
  file to sequence the fsck checks.

  If a QUIT signal is sent, fsck finishes the file system checks and then
  exits	with an	abnormal return	status that causes the automatic reboot	to
  fail.	This is	useful if you want to finish the file system checks during an
  automatic reboot but do not want the machine to come up multiuser after the
  checks complete.

  If the fsck default program fails (terminates	with a non-zero	value),	fsck
  terminates with the exit value.  This	ensures	that the auto-reboot depen-
  dencies, such	as those commonly used in the run command script, continue to
  function.

  If orphaned files or directories (allocated but unreferenced)	are found,
  you are asked	if you want to reconnect the files and directories that	are
  not empty by putting them in the lost+found directory.  The program indi-
  cates	whether	the file or directory is empty or not empty.  The fsck pro-
  gram reconnects directories that are not empty and assigns the inode number
  for the name.	 If the	lost+found directory does not exist, it	is created,
  and if it has	insufficient space, the	size is	increased. Empty files and
  directories are removed unless you specify the -n option.

ERRORS

  The following	message	indicates that the system is avoiding a	potential
  panic	by skipping the	file system check:

       /dev/disk/dsk2g:	skipping filesystem already mounted (read-write) on '/usr'

  The following	message	indicates that the file	system is mounted:


       /dev/disk/dsk2g on /usr:	Device busy

  The following	message	indicates that the partition you are checking is
  open:


       ERROR: /dev/rdisk/dsk3a or an overlapping partition is open
       fsck cannot be run on an	active filesystem

EXAMPLES

  The following	is an example of an /etc/fstab file that is used in the	exam-
  ples in this section:

       /dev/disk/dsk2a	   /	       ufs rw 1	1
       /dev/disk/dsk0g	   /usr	       ufs rw 1	2
       /dev/disk/dsk2b	   swap1       ufs sw 0	2
       /dev/disk/dsk0b	   /public     ufs sw 0	2
       /dev/disk/dsk2g	   /var	       ufs rw 1	2
       /dev/disk/dsk3c	   /usr/users  ufs rw 1	2

  The following	command	checks all the file systems in the /etc/fstab file
  but makes no corrections:

       # fsck -n

  The following	example	checks a file system found in the /etc/fstab file and
  checks a file	system that is not found in the	/etc/fstab file:

       # fsck  /dev/rdisk/dsk3c	 /dev/rdisk/dsk1a

  The following	command	noninteractively checks	the file systems in the
  /etc/fstab file:

       # fsck -p

FILES

  /usr/sbin/fsck
      Specifies	the command path.

  /usr/sbin/ufs_fsck
      Specifies	the command path.

  /etc/fstab
      Contains the default list	of file	systems	to check.

SEE ALSO

  Commands: newfs(8)