HOME

  Solaris Forum  

  Newsletter  

 Tell a Friend

  Bookmark

Google Web adminschoice.com 
redarrow1.gif (101 bytes)redarrow1.gif (101 bytes) Day Light Saving Change in USA - Summary of changes with links to patches and information.
redarrow1.gif (101 bytes)redarrow1.gif (101 bytes) Application Monitoring - Challenges , best practices and implementation of application monitoring is discussed.
redarrow1.gif (101 bytes)Unix Commands - A quick reference to commonly used unix commands .
redarrow1.gif (101 bytes)Solaris Network Configuartion - Simplified : Quick reference to setting up network in Solaris system
Performance Monitoring -  iostat , vmstat & netstat - Introduction to performance monitoring tools with example and command  syntax.
crontab in Unix - A Quick Reference to setting up and using cron jobs in unix .
Veritas Volume Manager-1
Using vxdiskadm to add &  manage disks & disk groups .
Veritas Volume Manager-2
Using vxassist to create ,configure &  manage volumes .
Admin's Guide to Solstice Disk Suite: Complete practical reference including root mirroring and trouble shooting.
Securing Solaris
A few suggestions to make your Solaris system secure from internal and external intrusion.
 
Solaris Installation
Step by step guide to Solaris Installation.
Jumpstart Server
Network  installation of Solaris over one or multiple systems. 
Booting Process
Details of Solaris  booting process. 
Booting Problems in Solaris
Common booting related error messages and their possible solution
DNS Server
Setting up DNS server
Trouble Shooting DNS  Some of the configuration and nslookup related errors explained.
NIS+
Server , Clients setup and commands. 
OpenBoot Parameters
Reference table of important parameters and their values.
Solaris Error Messages
Alphabetical listing of common Solaris Error Messages and their explanation
Checking & Repairing File systems with fsck   fsck operation ,syntax and explanation of some common error messages
Vi Quick  Reference   
vi basics for  reference
explanations.
 
Open Directory   
Unix , Solaris Administration 
Sun.com   
BigAdmin
 
 
 
FAQs
unix , unix programming , VI  ,Sendmail  , Bind
ssh ,BASH ,Security, Secure unix programming, Unix socket 
SCSI
Solaris 2Solaris x86  ,NIS+ FreeBSD ,RedHat , HPUX
:
Unix
Unix History and timeline ,
Overview of the UNIX 
Microsoft Windows NT Server 4.0 versus UNIX
Overview of Unix Commands 
Unix for advance Users ,
Unix Bourne Shell Guide with Ksh ,
Korn Shell
BASH reference Guide
:
Solaris Documentation
Solaris 7 System Administration Collection
Solaris 8 System Administrator Collection
Solaris 9 System Administartion Collection
Creating Solaris Packages
Multibooting Solaris 
:
Sun
Sun System Handbook
Sun Hardware Info.
:
Documentation Home
Sun , BSD  ,Linux ,Hp,Veritas
:
Patches & Softwares
Solaris Patches , 
Solaris Freeware
GNU Software
big brother  , 
webmin .com
bugzilla.org
:
Certification Info 
Sun  ,Red Hat , HP

Checking and Repairing File system with fsck

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

Modes of operation :

fsck operates in two modes interactive and non interactive :

interactive : the fsck examines the file system and stops at each error it finds in the file system and gives the problem description and ask for user response usually whether to correct the problem or continue without making any change to the file system. 

noninteractive  :fsck tries to repair all the problems it finds in a file system without stopping for user response useful in case of a large number of inconsistencies  in a  file system but has the disadvantage of removing  some useful files which are detected to be corrupt .

If file system is found to have problem at the booting time non interactive fsck fsck is run and all errors which are considered safe to correct are corrected. But if still file system has problems the  system boots in single user mode asking for user to manually run the fsck to correct the problems in file system

Running fsck :

 fsck should always be run in a single  user mode which ensures proper repair of file system . If it is run in a busy system where the file system is changing constantly fsck may see the changes as inconsistencies  and may corrupt the file system .

if the system can not be brought in a single user mode  fsck should be run on the partitions ,other than root & usr , after unmounting them . Root & usr partitions can not be unmounted . If the system fails to come up due to root/usr files system corruption the system can booted with CD and root/usr partitions can be repaired using fsck. 

command syntax:  

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.

special -  Block or character device name of the file system to be                 checked/repaired - for example /dev/rdsk/c0t3d0s4 .Character device should be used for consistencies check & repair

phases

fsck checks the file system in a series of 5 pages and checks a specific functionality of file system in each phase.

** phase 1 - Check Blocks and Sizes

** phase 2 - Check Pathnames

** phase 3 - Check Connectivity

** phase 4 - Check Reference Counts

** phase 5 - Check Cylinder Groups

 

Error messages & Corrective action :

1.Corrupted superblock - fsck fails to run 

If the superblock is corrupted the file system still can be repaired using alternate superblock which are formed while making new file system .

the first alternate superblock number is 32 and others superblock numbers can be found using the following command :

newfs -N /dev/rdsk/c0t0d0s6

for example to run fsck using first alternate superblock following command is used 

fsck -F ufs -o b=32 /dev/rdsk/c0t0d0s6

2.Link counter adjustment : fsck finds mismatch between directory inode link counts and actual directory links and prompts for adjustment in case of interactive operation .Link count adjustments are considered to be a safe operation in a file system and should be repaired by giving 'y' response to the adjust ? prompt during fsck.

3.Free Block count  salvage : During fsck the number of free blocks listed in a superblock  and actual unallocated free blocks count does not match .fsck inform this mismatch and asks to salvage free block count to synchronize the superblock count. This error can be corrected without any potential problem to the file system or  files.

4.Unreferenced file reconnection : While checking connectivity fsck finds some inodes which are allocated but not referenced -not attached to any directory . Answering y to reconnect message by fsck links these files to the lost+found directory with their inode number as their name . 

To get more info about the files in lost+found 'file' command can be used to see the type of files and subsequently they can be opened in their applications or text editors to find out about  their contents. If the file is found to be correct it can be used after copying to some other directory and renaming it. 

Next Steps :

The fsck topic here paid a brief visit to some of general aspects of  fsck but a detailed document on fsck is comming up to cover most of the error messages  and there explanation so watch out if you are looking for more details.

 fsck is covered  in most of the sysadmin books and you can buy some of the books from amazon.com or besttechbooks.com which is a amazon affiliate site with focus obly on technical books.

 

 

 

click here to send your feedback about this article .

Copyright © 2000-2005 , Adminschoice.com .

 

 

 

 

 
 
InventioConsulting Offering Unix , Solaris & IT Training Services throughout the UK.