Skip Navigation Links | |
Exit Print View | |
![]() |
System Administration Guide: Devices and File Systems Oracle Solaris 10 1/13 Information Library |
1. Managing Removable Media (Overview/Tasks)
2. Writing CDs and DVDs (Tasks)
4. Dynamically Configuring Devices (Tasks)
5. Managing USB Devices (Tasks)
6. Using InfiniBand Devices (Overview/Tasks)
9. Administering Disks (Tasks)
10. SPARC: Setting Up Disks (Tasks)
11. x86: Setting Up Disks (Tasks)
12. Configuring Oracle Solaris iSCSI Targets (Tasks)
13. The format Utility (Reference)
14. Managing File Systems (Overview)
15. Creating and Mounting File Systems (Tasks)
16. Configuring Additional Swap Space (Tasks)
17. Checking UFS File System Consistency (Tasks)
Enhancements to UFS File System Utilities (fsck, mkfs, and newfs)
Automatic Search for Backup Superblocks
fsck Reports When it Needs to be Rerun
How the UFS File System State Is Recorded
What the fsck Command Checks and Tries to Repair
Why UFS File System Inconsistencies Might Occur
UFS Components That Are Checked for Consistency
File System Size and Inode List Size Checks
Incorrect "." and ".." Entry Checks
Interactively Checking and Repairing a UFS File System
How to Check the UFS root (/), /usr, or /var File Systems From an Alternate Boot Device
How to Check Other UFS File Systems (Not root (/), /usr, or /var)
How to Preen a UFS File System
Fixing a UFS File System That the fsck Command Cannot Repair
Restoring a Bad UFS Superblock
How to Restore a Bad UFS Superblock (Solaris 10 6/06 Release)
How to Restore a Bad Superblock (Solaris 8, 9, and 10 Releases)
Syntax and Options for the fsck Command
18. UFS File System (Reference)
19. Backing Up and Restoring UFS File Systems (Overview/Tasks)
20. Using UFS Snapshots (Tasks)
21. Copying Files and File Systems (Tasks)
22. Managing Tape Drives (Tasks)
The UFS file system relies on an internal set of tables to keep track of inodes used and available blocks. When these internal tables are not properly synchronized with data on a disk, inconsistencies result and file systems need to be repaired.
File systems can be inconsistent because of abrupt termination of the operating system from the following:
Power failure
Accidental unplugging of the system
Turning off the system without proper shutdown procedure
A software error in the kernel
File system inconsistencies, while serious, are not common. When a system is booted, a check for file system consistency is automatically performed (with the fsck command). Often, this file system check repairs problems it encounters.
The fsck command places files and directories that are allocated but unreferenced in the lost+found directory. An inode number is assigned as the name of unreferenced file and directory. If the lost+found directory does not exist, the fsck command creates it. If there is not enough space in the lost+found directory, the fsck command increases its size.
For a description of inodes, see Inodes.
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 Oracle 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 UFS Superblock (Solaris 10 6/06 Release).
The following fsck error message examples illustrate the automatic backup superblock discovery feature.
![]() | Caution - 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=Jul 12 10:55:10 2010 DIR= <xattr> FIX? yes
ZERO LENGTH ATTR DIR I=12 OWNER=root MODE=160755 SIZE=0 MTIME=Jul 12 10:56:10 2010 CLEAR? yes
File should BE marked as extended attribute I=22 OWNER=root MODE=100644 SIZE=0 MTIME=Jul 12 10:57:10 2010 FILE= <xattr> FIX? yes
UNREF ATTR DIR I=106 OWNER=root MODE=160755 SIZE=512 MTIME=Jul 12 10:58:10 2010 RECONNECT? yes
File I=107 should NOT be marked as extended attribute I=107 OWNER=root MODE=100644 SIZE=0 MTIME=Jul 12 10:59:10 2010 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.