Checking and Repairing File system with fsck

fsck is the command used in UNIX for checking filesystem for any inconsistencies, usually caused by abnormal shutdown. These abnormal shutdown may be caused by some hardware failure or power failure.

fsck also has options to repair filesystem as well.


fsck  [ -F fstype]  [-V]    [-yY]    [-o optionsspecial

-F fstype     type of file system to be repaired ( ufs , vxfs etc)

-V verify the command line syntax but do not run the command 

-y or -Y  Run the command in non interactive mode – repair all errors encountered without waiting for user response.

-o options  Three options can be  specified with -o flag

b=n   where n is the number of next super block  if primary super block is corrupted in a file system .

p option used to make safe repair options during the  booting process.

   force the file system check regardless of its clean flag.

Most  *NIX machines has fsck, but special attention should be made when dealing with Sparc hardware or Solaris UNIX in general.

When doing fsck, make sure that you are checking the ‘raw’ device and not just the logical disk.

Check this out to determine the raw device of a solaris server. We’ll post more of the topic soon.

Leave a Reply

Your email address will not be published. Required fields are marked *