System Administration Guide, Volume 1

How to Fix a UFS File System fsck Cannot Repair

Sometimes you need to run fsck a few times to fix a file system because problems corrected on one pass might uncover other problems not found in earlier passes. fsck does not keep running until it comes up clean, so you must rerun it manually.

Pay attention to the information displayed by fsck. It might help you fix the problem. For example, the messages might point to a bad directory. If you delete the directory, you might find that fsck runs cleanly.

If fsck still cannot repair the file system, you can try to use the fsdb, ff, clri, and ncheck commands to figure out and fix what is wrong. See fsdb(1M), ff(1M), clri(1M), and ncheck(1M) for information about how to use these commands. You might, ultimately, need to re-create the file system and restore its contents from backup media. See Chapter 44, Restoring Files and File Systems (Tasks) for information about restoring complete file systems.

If you cannot fully repair a file system but you can mount it read-only, try using cp, tar, or cpio to retrieve all or part of the data from the file system.

If hardware disk errors are causing the problem, you might need to reformat and divide the disk into slices again before re-creating and restoring file systems. Hardware errors usually display the same error again and again across different commands. The format command tries to work around bad blocks on the disk. If the disk is too severely damaged, however, the problems might persist, even after reformatting. See format(1M) for information about using the format command. See Chapter 30, SPARC: Adding a Disk (Tasks) or Chapter 31, IA: Adding a Disk (Tasks) for information about installing a new disk.