Checking and repairing a file system
The mmfsck command detects and repairs conditions that can cause problems in a file system. It operates in two modes: online and offline.
In the online mode the command can run while the file system is still
mounted. The command detects and repairs the following conditions:
- Blocks that are marked as allocated but that do not belong to any file (lost blocks). The corrective action is to mark the blocks as free in the block allocation map. A possible symptom of lost blocks is that I/O operations fail with an out-of-space error after repeated node failures.
- Corruptions in the block allocation map. The corrective action is to repair the corruptions.
Note:
- Run the mmfsck command in the online mode only when the system demand is low. The repairs are I/O-intensive and can degrade system performance.
- If you are repairing a file system because of node failure and the file system has quotas that are enabled, it is a good idea to run the mmcheckquota command after you run the mmfsck command to make quota accounting consistent.
In
the offline mode the mmfsck command can run only if the file system is unmounted.
In general, you do not need to run the command in offline mode unless you are directed by the IBM® Support Center. In the offline mode the command does the same
checks that are done in online mode and it also detects and repairs the following problems:
- Blocks marked allocated that do not belong to any file. The corrective action is to mark the block free in the allocation map.
- Files and directories for which an inode is allocated and no directory entry exists, known as orphaned files. The corrective action is to create directory entries for these files in a lost+found subdirectory in the root directory of the fileset to which the file or directory belongs. A fileset is a subtree of a file system namespace that in many respects behaves like an independent file system. The index number of the inode is assigned as the name. If you do not allow the mmfsck command to reattach an orphaned file, it asks for permission to delete the file.
- Directory entries that point to an inode that is not allocated. The corrective action is to remove the directory entry.
- Incorrectly formed directory entries. A directory file contains the inode number and the generation number of the file to which it refers. When the generation number in the directory does not match the generation number that is stored in the file's inode, the corrective action is to remove the directory entry.
- Incorrect link counts on files and directories. The corrective action is to update them with accurate counts.
- Policy files that are not valid. The corrective action is to delete the file.
- Various problems that are related to filesets: missing or corrupted fileset metadata, inconsistencies in directory structure related to filesets, missing or corrupted fileset root directory, other problems in internal data structures. The repaired filesets are renamed as Fileset FilesetId and put into unlinked state.
The mmfsck command performs other functions that are not listed here, as deemed necessary by GPFS.
The --patch-file parameter of the mmfsck command can be
used to generate a report of file system inconsistencies. Consider this example of a patch file that
is generated by mmfsck for a file system with a bad directory
inode:
gpfs_fsck
<header>
sgid = "C0A87ADC:5555C87F"
disk_data_version = 1
fs_name = "gpfsh0"
#patch_file_version = 1
#start_time = "Fri May 15 16:32:58 2015"
#fs_manager_node = "h0"
#fsck_flags = 150994957
</header>
<patch_inode>
patch_type = "dealloc"
snapshot_id = 0
inode_number = 50432
</patch_inode>
<patch_block>
snapshot_id = 0
inode_number = 3
block_num = 0
indirection_level = 0
generation_number = 1
is_clone = false
is_directory_block = true
rebuild_block = false
#num_patches = 1
<patch_dir>
entry_offset = 48
entry_fold_value = 306661480
delete_entry = true
</patch_dir>
</patch_block>
<patch_block>
snapshot_id = 0
inode_number = 0
block_num = 0
indirection_level = 0
generation_number = 4294967295
is_clone = false
is_directory_block = false
rebuild_block = false
#num_patches = 1
<patch_field>
record_number = 3
field_id = "inode_num_links"
new_value = 2
old_value = 3
</patch_field>
</patch_block>
<patch_inode>
patch_type = "orphan"
snapshot_id = 0
inode_number = 50433
</patch_inode>
<footer>
#stop_time = "Fri May 15 16:33:06 2015"
#num_sections = 203
#fsck_exit_status = 8
need_full_fsck_scan = false
</footer>
The
mmfsck command can be run with both the --patch-file and
--patch parameters to repair a file system with the information that is stored
in the patch file. Using a patch file prevents a subsequent scan of the file system before the
repair actions begin.You cannot run the mmfsck command on a file system that has disks in a down state. You must first run the mmchdisk command to change the state of the disks to unrecovered or up. To display the status of the disks in the file system, issue the mmlsdisk command.
To check the file system fs1 without making any changes to the file system, issue the
following command:
mmfsck fs1
For complete usage information, see mmchdisk command, mmcheckquota command, mmfsck command, and mmlsdisk command.