Solaris Express 12/05: The file system check utility, fsck, has been enhanced to include features from the FreeBSD 4.9 version of the fsck program, as well as other enhancements.
The fsck utility in this Solaris release includes the following improvements:
Checks and repairs file systems more thoroughly and provides improved error messages. For example, in some scenarios, fsck determines what structures are missing and replaces them appropriately.
Automatically searches for backup superblocks.
Reports when fsck needs to be rerun.
When clearing directories, fsck now attempts to recover directory contents immediately and therefore, reduces the time spent rerunning this utility.
If fsck finds duplicate blocks, and not all files that reference the duplicate blocks were cleared, fsck reports the inode numbers at the end of the fsck run. Then, you can use the find command to review the inodes that are damaged.
Improved error messages regarding the status of extended attributes and other special files, such as device files and ACL entries, are included.
Includes a -v option to enable more verbose messages.
In addition, the newfs and mkfs commands have been updated to include new options for displaying a file system's superblock information in text or dumping the superblock information in binary format.
newfs [ -S or -B ] /dev/rdsk/... |
Displays the file system's superblock in text
Dumps the file system's superblock in binary
mkfs [ -o calcsb or -o calcbinsb ] /dev/rdsk/... size |
Displays the file system's superblock in text
Dumps the file system's superblock in binary
The fsck utility uses this superblock information to search for backup superblocks.
The following sections describe specific fsck enhancements and their corresponding error messages. For step-by-step instructions on using the fsck utility to repair a damaged superblock, see How to Restore a Bad Superblock ( Solaris Express Release).
The following fsck error message examples illustrate the automatic backup superblock discovery feature.
If a file system has a damaged superblock and it was created with newfs or mkfs customized parameters, such as ntrack or nsect, using fsck's automatically discovered superblock for the repair process could damage your file system.
In the case of a file system that was created with customized parameters and it has a bad superblock, fsck provides the prompt to cancel the fsck session:
CANCEL FILESYSTEM CHECK? |
If the file system was created with the newfs command and fsck responds that just the primary superblocks are corrupted, then consider letting fsck restore the superblock.
# fsck /dev/dsk/c1t2d0s0 ** /dev/rdsk/c1t2d0s0 BAD SUPERBLOCK AT BLOCK 16: BLOCK SIZE LARGER THAN MAXIMUM SUPPORTED LOOK FOR ALTERNATE SUPERBLOCKS WITH MKFS? no LOOK FOR ALTERNATE SUPERBLOCKS WITH NEWFS? yes FOUND ALTERNATE SUPERBLOCK 32 WITH NEWFS USE ALTERNATE SUPERBLOCK? yes FOUND ALTERNATE SUPERBLOCK AT 32 USING NEWFS If filesystem was created with manually-specified geometry, using auto-discovered superblock may result in irrecoverable damage to filesystem and user data. CANCEL FILESYSTEM CHECK? no ** Last Mounted on ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3a - Check Connectivity ** Phase 3b - Verify Shadows/ACLs ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cylinder Groups CORRECT GLOBAL SUMMARY SALVAGE? y UPDATE STANDARD SUPERBLOCK? y 81 files, 3609 used, 244678 free (6 frags, 30584 blocks, 0.0% fragmentation) ***** FILE SYSTEM WAS MODIFIED ***** |
If the file system was created with the mkfs command and fsck responds that just the primary superblocks are corrupted, then consider letting fsck restore the superblock.
# fsck /dev/dsk/c1t2d0s0 ** /dev/rdsk/c1t2d0s0 BAD SUPERBLOCK AT BLOCK 16: BLOCK SIZE LARGER THAN MAXIMUM SUPPORTED LOOK FOR ALTERNATE SUPERBLOCKS WITH MKFS? yes FOUND ALTERNATE SUPERBLOCK 32 WITH MKFS USE ALTERNATE SUPERBLOCK? yes FOUND ALTERNATE SUPERBLOCK AT 32 USING MKFS If filesystem was created with manually-specified geometry, using auto-discovered superblock may result in irrecoverable damage to filesystem and user data. CANCEL FILESYSTEM CHECK? no ** Last Mounted on ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3a - Check Connectivity ** Phase 3b - Verify Shadows/ACLs ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cylinder Groups CORRECT GLOBAL SUMMARY SALVAGE? y UPDATE STANDARD SUPERBLOCK? y 81 files, 3609 used, 243605 free (117 frags, 30436 blocks, 0.0% fragmentation) ***** FILE SYSTEM WAS MODIFIED ***** |
The following example illustrates what would happen if you specified fsck's -y option in a damaged superblock scenario. You are automatically dropped out of the fsck session. A message is displayed to rerun it with the alternate superblock.
# fsck -y /dev/dsk/c1t2d0s0 # ** /dev/rdsk/c1t2d0s0 BAD SUPERBLOCK AT BLOCK 16: BLOCK SIZE LARGER THAN MAXIMUM SUPPORTED LOOK FOR ALTERNATE SUPERBLOCKS WITH MKFS? yes LOOK FOR ALTERNATE SUPERBLOCKS WITH NEWFS? yes SEARCH FOR ALTERNATE SUPERBLOCKS FAILED. USE GENERIC SUPERBLOCK FROM MKFS? yes CALCULATED GENERIC SUPERBLOCK WITH MKFS If filesystem was created with manually-specified geometry, using auto-discovered superblock may result in irrecoverable damage to filesystem and user data. CANCEL FILESYSTEM CHECK? yes Please verify that the indicated block contains a proper superblock for the filesystem (see fsdb(1M)). FSCK was running in YES mode. If you wish to run in that mode using the alternate superblock, run `fsck -y -o b=453920 /dev/rdsk/c1t2d0s0'. |
The following fsck error message scenario illustrates the new prompts for the backup superblock, but the fsck run is not canceled, in this example. Canceling the fsck session would be an appropriate response if this file system was created with customized parameters or if there is some other concern about running fsck on this file system.
The various superblock error conditions are provided in italics as follows:
# fsck /dev/rdsk/c0t1d0s0 ** /dev/rdsk/c0t1d0s0 BAD SUPERBLOCK AT BLOCK 16: BLOCK SIZE LARGER THAN MAXIMUM SUPPORTED BAD SUPERBLOCK AT BLOCK 16: NUMBER OF DATA BLOCKS OUT OF RANGE BAD SUPERBLOCK AT BLOCK 16: INODES PER GROUP OUT OF RANGE BAD SUPERBLOCK AT BLOCK 16: MAGIC NUMBER WRONG BAD SUPERBLOCK AT BLOCK 16: BAD VALUES IN SUPER BLOCK BAD SUPERBLOCK AT BLOCK 16: NCG OUT OF RANGE BAD SUPERBLOCK AT BLOCK 16: CPG OUT OF RANGE BAD SUPERBLOCK AT BLOCK 16: NCYL IS INCONSISTENT WITH NCG*CPG BAD SUPERBLOCK AT BLOCK 16: SIZE OUT OF RANGE BAD SUPERBLOCK AT BLOCK 16: NUMBER OF DIRECTORIES OUT OF RANGE BAD SUPERBLOCK AT BLOCK 16: ROTATIONAL POSITION TABLE SIZE OUT OF RANGE BAD SUPERBLOCK AT BLOCK 16: SIZE OF CYLINDER GROUP SUMMARY AREA WRONG BAD SUPERBLOCK AT BLOCK 16: INOPB NONSENSICAL RELATIVE TO BSIZE LOOK FOR ALTERNATE SUPERBLOCKS WITH MKFS? yes FOUND ALTERNATE SUPERBLOCK 32 WITH MKFS USE ALTERNATE SUPERBLOCK? yes FOUND ALTERNATE SUPERBLOCK AT 32 USING MKFS If filesystem was created with manually-specified geometry, using auto-discovered superblock may result in irrecoverable damage to filesystem and user data. CANCEL FILESYSTEM CHECK? no ** Last Mounted on ** Phase 1 - Check Blocks and Sizes ** Phase 2a - Check Duplicated Names ** Phase 2b - Check Pathnames ** Phase 3a - Check Connectivity ** Phase 3b - Verify Shadows/ACLs ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cylinder Groups SALVAGE? yes UPDATE STANDARD SUPERBLOCK? yes 82 files, 3649 used, 244894 free (6 frags, 30611 blocks, 0.0% fragmentation) ***** FILE SYSTEM WAS MODIFIED ***** |
Better reporting by fsck about when it needs to be rerun should alleviate the time and necessity of running it multiple times, which can be particularly time consuming on large file systems.
The following new messages prompt you to rerun the fsck utility at the end of an error scenario:
***** PLEASE RERUN FSCK ***** |
Or:
Please rerun fsck(1M) to correct this. |
These new prompts resolve the previous difficulty in determining whether fsck should be rerun or not.
Unless you are prompted to rerun fsck as in the above messages, there is no need to run fsck, even after you see the following message:
***** FILE SYSTEM WAS MODIFIED ***** |
However, it doesn't harm the file system to rerun fsck after this message. This message is just informational about fsck's corrective actions.
New fsck messages are included that report on and repair files with extended attributes. For example:
BAD ATTRIBUTE REFERENCE TO I=1 FROM I=96 |
Attribute directory I=97 not attached to file I=96 I=96 OWNER=root MODE=40755 SIZE=512 MTIME=Jun 20 12:25 2008 DIR= <xattr> FIX? yes |
ZERO LENGTH ATTR DIR I=12 OWNER=root MODE=160755 SIZE=0 MTIME=Jun 20 12:26 2008 CLEAR? yes |
File should BE marked as extended attribute I=22 OWNER=root MODE=100644 SIZE=0 MTIME= Jun 20 12:27 2008 FILE= <xattr> FIX? yes |
UNREF ATTR DIR I=106 OWNER=root MODE=160755 SIZE=512 MTIME=Jun 20 12:28 2008 RECONNECT? yes |
File I=107 should NOT be marked as extended attribute I=107 OWNER=root MODE=100644 SIZE=0 MTIME=Jun 20 12:29 2008 FILE=?/attfsdir-7-att FIX? yes DIR I=106 CONNECTED. |
The fsck error messages now reports information about blocks, fragments, or a LFNs, which are the logical fragment numbers from the start of the file. For example, you might see output similar to the following:
** Phase 1 - Check Blocks and Sizes FRAGMENT 784 DUP I=38 LFN 0 FRAGMENT 785 DUP I=38 LFN 1 FRAGMENT 786 DUP I=38 LFN 2 . . . |
fsck processes objects as fragments, but in previous Solaris releases, only reported object information as blocks. It now correctly reports as fragments.
If fsck finds error conditions that involve duplicate blocks or fragments, fsck offers to display the uncleared files at end of the fsck output. For example, you might see output similar to the following:
LIST REMAINING DUPS? yes Some blocks that were found to be in multiple files are still assigned to file(s). Fragments sorted by inode and logical offsets: Inode 38: Logical Offset 0x00000000 Physical Fragment 784 Logical Offset 0x00000800 Physical Fragment 786 Logical Offset 0x00001000 Physical Fragment 788 Logical Offset 0x00001800 Physical Fragment 790 |
Then, you can use the find -i inode-number command to identify the name of inode 38, in this example.