Saturday, 23 April 2016

How to check and repair Unix file system ?


fsck 
is a Unix utility for checking and repairing file system inconsistencies .

File system can become inconsistent due to several reasons and the most common is abnormal shutdown due to hardware failure , power failure or switching off the system without propershutdown. Due to these reasons the superblock in a file system is not updated and has mismatched information relating to system data blocks,free blocks and inodes.

fsck operates in two modes :
Interactive – fsck examines the file system andstops at each error it finds in the file system and gives the problemdescription and ask for user response whether to correct the problem orcontinue without making any change to the file system.

Non interactive – fsck tries to repair all theproblems it finds in a file system without stopping for user responseuseful in case of a large number of inconsistencies in a file systembut has the disadvantage of removing some useful files which aredetected to be corrupt.

fsck   [ -F fstype]  [-V]  [-yY]  [-o options]  special

-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.

special  
Block or character device name of the file system to be checked/repaired 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.