5. File system checking

#fsck : Due to improper shutdown of the systems some times the file system gets corrupted and to check the corrupted file system, we can use utility called "fsck" (file system checking).
  • It always in raw format (rdsk)
  • It is always run on unmounted file system.
  • It refers "/etc/vfstab" file to check in what way the file system check has to be done. i.e. either sequential or parallely.
Options of "fsck":
1. # fsck -m: This is to check the inconsistency of a file system.
2. # fsck -y: This option used to check and repair the inconsistency of file system.

Note: Before running "fsck" ensure that file system is permanent (i.e. in vfstab), the entry should be in "/etc/vfstab".

File system configuration:
# df -h
# umountall
# df -h
# vi /etc/vfstab

To check the inconsistency of the file system:
# fsck -m /dev/rdsk/c0t0d0s4
// yes, it is good, ok

To corrupt the file system:
# dd if=/dev/zero of=/dev/rdsk/c0t0d0s4 bs=512 count=32
# fsck -m /dev/rdsk/c0t0d0s4
//now its corrupted

To repair file system:
# fsck -F ufs -y -o b=32 /dev/rdsk/c0t0d0s4

File checking is done in two way
1. Sequentially
2. Parellely

6 phases:
phase 1= check blocks & sizes
phase 2=check path names
phase 3a=check connectivity
phase 3b=verify shadows/ACLs
phase 4=check reference counts
phase 5=check cylinder groups