unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

FSCK(8)                     System Manager's Manual                    FSCK(8)



NAME
       fsck - file system consistency check and interactive repair

SYNOPSIS
       /usr/etc/fsck -p [ -f ] [ -w ] [ -l number ] [ filesystem...  ]

       /usr/etc/fsck [ -b block# ] [ -w ] [ -y ] [ -n ] [ -c ] [ filesystem...
       ]

DESCRIPTION
       fsck is a program that checks and repairs file system  consistency.  It
       can  operate  in two modes, "preen" and interactive.  "Preen" is a non-
       interactive mode which only repairs a subset of file  system  inconsis-
       tencies.   The  interactive  mode  allows users to audit and repair any
       inconsistencies.

   "Preen" Mode
       With the -p option, fsck audits and  automatically  repairs  ("preens")
       inconsistencies on a set of file systems.  If a list of file systems is
       specified on the command line, fsck sequentially checks each one;  oth-
       erwise,  fsck  reads the table /etc/fstab to determine the file systems
       to check.  It then inspects disks in parallel, taking advantage of  I/O
       overlap to check the file systems quickly.  The number of disks checked
       in parallel can be limited using the -l  option.   This  helps  systems
       that  do  not  have  sufficient memory to run enough fscks to check all
       disks in parallel.  Preen mode is normally used in the  /etc/rc  script
       during automatic reboot.

       Each  file  system's  super block clean flag is examined and only those
       file systems not marked clean or stable are checked.  A message identi-
       fying  the name of the device and its file system's state is printed if
       the clean flag indicates that checking is not  necessary.   If  the  -f
       (force)  option is in effect, fsck checks the file system regardless of
       the state of its clean flag.

       Only partitions marked in /etc/fstab with a file system type  of  "4.2"
       and  a  non-zero  pass  number  are checked.  If the force option is in
       effect, file systems  with  pass  number  1  (typically  /,  /usr,  and
       /usr/kvm)  are  checked  one  at  a  time.   When pass 1 completes, all
       remaining file systems are checked, running one process per disk drive.
       If  the force option is not in effect (the default case), all file sys-
       tems with non-zero pass numbers are checked in as parallel a manner  as
       possible.

       fsck  corrects  innocuous inconsistencies such as: unreferenced inodes,
       too-large link counts in inodes,  missing  blocks  in  the  free  list,
       blocks  appearing  in  the  free  list  and also in files, or incorrect
       counts in the super block, automatically.  It displays  a  message  for
       each  inconsistency  corrected  that identifies the nature of, and file
       system on which, the correction is to take place.   After  successfully
       correcting a file system, fsck sets the file system's super block clean
       flag to stable, prints the number of files on  that  file  system,  the
       number of used and free blocks, and the percentage of fragmentation.

       If  fsck  encounters other inconsistencies that it cannot fix automati-
       cally, it does not change the state of the super block clean  flag  and
       exits with an abnormal return status (and the reboot fails).  A list of
       file systems containing such uncorrectable inconsistencies  is  printed
       just before fsck exits.

       If  sent  a  QUIT  signal  while  preening  the  file systems listed in
       /etc/fstab, fsck finishes the file system checks,  then  exit  with  an
       abnormal  return status and the automatic reboot fails.  This is useful
       when you wish to finish the file system checks, but  do  not  want  the
       machine to come up multiuser.

   Interactive Mode
       Without  the -p option, fsck audits and interactively repairs inconsis-
       tent conditions on file systems.  File systems are  checked  regardless
       of  the state of their clean flag.  In this case, fsck asks for confir-
       mation before attempting any corrections.  Inconsistencies  other  than
       those  mentioned  above  can  often  result  in some loss of data.  The
       amount and severity of data lost can be determined from the  diagnostic
       output.

       The  default  action for each correction is to wait for the operator to
       respond either yes or no.  If the operator does not have write  permis-
       sion on the file system, fsck defaults to a -n (no corrections) action.

       If  no  file systems are given to fsck then a default list of file sys-
       tems is read from the file /etc/fstab.

       Inconsistencies checked in order are as follows:

              o  Blocks claimed by more than one inode or the free list.
              o  Blocks claimed by an inode or the free list outside the range
                 of the file system.
              o  Incorrect link counts.
              o  Incorrect directory sizes.
              o  Bad inode format.
              o  Blocks not accounted for anywhere.
              o  Directory  checks,  file pointing to unallocated inode, inode
                 number out of range.
              o  Super Block checks: more blocks for inodes than there are  in
                 the file system.
              o  Bad free block list format.
              o  Total free block and/or free inode count incorrect.
              o  Clean flag state.

       Orphaned  files  and directories (allocated but unreferenced) are, with
       the  operator's  concurrence,  reconnected  by  placing  them  in   the
       lost+found  directory.   The name assigned is the inode number.  If the
       lost+found directory does not exist, it is created.  If there is insuf-
       ficient space its size is increased.

       A  file system may be specified by giving the name of the cooked or raw
       device on which it resides, or by giving the name of its  mount  point.
       If  the latter is given, fsck finds the name of the device on which the
       file system resides by looking in /etc/fstab.

OPTIONS
       -b     Use the block specified immediately after the flag as the  super
              block  for  the  file  system.   Block 32 is always an alternate
              super block.

       -f     Force checking of file systems regardless of the state of  their
              super block clean flag .

       -l number
              Limits  the  number  of fscks that are run concurrently in preen
              mode.  (See -p.)

       -w     Check writable file systems only.

       -y     Assume a yes response to  all  questions  asked  by  fsck;  this
              should  be used with extreme caution, as it is a free license to
              continue, even after severe problems are encountered.

       -n     Assume a no response to all questions asked by fsck; do not open
              the file system for writing.

       -p     Audit  and  automatically repair inconsistencies on file systems
              whose state is either active or unknown.  If  no  other  options
              are  specified,  fsck inspects file systems listed in /etc/fstab
              in parallel, simultaneously checking one file system  per  disk.
              If file systems are specified on the command line, inspection is
              sequential.

       -c     If the file system is in the old (static table) format,  convert
              it  to the new (dynamic table) format.  If the file system is in
              the new format, convert it to the old format  provided  the  old
              format  can  support the file system configuration.  In interac-
              tive mode, fsck lists the direction the conversion is to be made
              and  asks  whether the conversion should be done.  If a negative
              answer is given, no further operations are done on the  filesys-
              tem.   In  preen mode, the direction of the conversion is listed
              and done if possible without user  interaction.   Conversion  in
              preen mode is best used when all the file systems are being con-
              verted at once.  The format of a file system can  be  determined
              from the first line of output from dumpfs(8)

FILES
       /etc/fstab          default list of file systems to check
       /etc/mtab           list of mounted file systems

EXIT STATUS
       0      Either no errors detected or all errors were corrected.

       2      A  QUIT signal was caught while preening the file systems listed
              in /etc/fstab; abort the reboot procedure.

       4      Errors on the root or a mounted file system were corrected.  The
              system must be rebooted.

       8      Some uncorrected errors exist on one or more of the file systems
              checked, there was a syntax error,  or  some  other  operational
              error occurred.

       12     An INTERRUPT signal was caught during processing.

DIAGNOSTICS
       The  diagnostics produced by fsck are fully enumerated and explained in
       the System and Network Administration Manual with the  following  addi-
       tions.

       1.     After checking a file system in non-preening mode, the question:
                  CLEAN FLAG IN SUPERBLOCK IS WRONG; FIX?
              is  asked  if  the  file system's clean state is wrong.  A "yes"
              response instructs fsck to reset this state to active  if  there
              are  inconsistencies,  or  to stable if there are no uncorrected
              inconsistencies.  A "no" response instructs fsck  to  leave  the
              existing state unchanged.

       2.     When fsck is run in preen mode, the file systems that need addi-
              tional attention are normally scrolled off the screen.  With the
              enhanced  version  of  fsck  these  file  systems listed as fsck
              exits.  This provides the user with a list of the the file  sys-
              tems that require attention.  An example follows:
                      .
                      .
                      .
                  /dev/rsd6a: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.

                  THE FOLLOWING FILE SYSTEMS HAD AN UNEXPECTED INCONSISTENCY:
                      /dev/rsd6a (/sd6a), /dev/rsd6b (/sd6b)
                      Reboot failed...help!


CAVEAT
       Because  super block consistency checks are not made when the -b option
       is used, it is recommended that -b be augumented with the -n option  to
       verify  fsck actions.  Once you are satisfied that the fsck actions are
       correct, then remove the -n.

SEE ALSO
       fs(5), fstab(5), dumpfs(8), newfs(8),  mkfs(8),  panic(8S),  reboot(8),
       rexecd(8C), ypserv(8)

       System and Network Administration



                                 18 June 1991                          FSCK(8)