18.10 File System Repair

   

A system crash or improper shutdown may cause errors to the file system metadata. You need to repair a file system in such a case. The fsck command is used to check and repair file systems.

Repairing a File System Using the fsck Command

The fsck command is used to repair a file system. It is run automatically if your system crashes or has improperly shut down, and it can be run manually at any time if necessary. It checks the file system metadata integrity and repairs it if needed.

Before running fsck manually, you must unmount a file system. If fsck is run on JFS, it checks the intent log and commits any pending changes in the intent log. If run on HFS, it goes through a number of passes and reports any problems it encountered . It also suggests a solution for each problem and asks if you want to use that solution. You may answer "yes" or "no" for these questions depending on whether you want to implement a change.

If there are inconsistencies in the metadata area, the fsck command deletes some of the files. Some files may be put in the lost+found directory if they are not completely recognized by fsck . These files are also called orphan files. After running the fsck command, you should check the contents of the lost+found directory to note the files created by the fsck command. The names of these files may be different from the original files. You may use the file or strings command to find out information about these files. After fsck finishes its job, you need to restore the damaged files from a previous backup.

To check the JFS on the /dev/vg03/lvol4 file system, use the following fsck command. The file system must first be mounted using the umount command.

 fsck -F vxfs /dev/vg03/rlvol4 

There are some options that can be used with the fsck command. Some of these options are special to a particular type of file system and are listed in Table 18-5.

Table 18-5. Options Used with the fsck Command
Option Description
-F Type of file system. Use vxfs for the JFS and hfs for the HFS file systems. You may also use the fsck_vxfs command for the JFS file system and fsck_hfs for the HFS file system.
-n Assumes a "no" answer for fsck questions.
-y Assumes a "yes" answer for fsck questions.
-b Tells fsck to use an alternate superblock. The alternate superblocks are listed in the /var/adm/sbtab file. If this file is not accessible, use number 16, which is always the first alternate superblock (HFS only).
-f Forces fsck to run on a mounted file system (HFS only).
-o full Forces fsck to make a full check of the metadata instead of just replaying the intent log (JFS only).
-o nolog Prevents intent log replay (JFS only).

   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net