3.13. Repairing a File System

3.13. Repairing a File System

When nodes fail with the file system mounted, file system journaling allows fast recovery. However, if a storage device loses power or is physically disconnected, file system corruption may occur. (Journaling cannot be used to recover from storage subsystem failures.) When that type of corruption occurs, you can recover the GFS file system by using the gfs_fsck command.


The gfs_fsck command must be run only on a file system that is unmounted from all nodes.


The gfs_fsck command has changed from previous releases of Red Hat GFS in the following ways:

  • You can no longer set the interactive mode with Ctrl-C. Pressing Ctrl-C now cancels the gfs_fsck command. Do not press Ctrl-C unless you want to cancel the command.

  • You can increase the level of verbosity by using the -v flag. Adding a second -v flag increases the level again.

  • You can decrease the level of verbosity by using the -q flag. Adding a second -q flag decreases the level again.

  • The -n option opens a file system as read-only and answers no to any queries automatically. The option provides a way of trying the command to reveal errors without actually allowing the gfs_fsck command to take effect.

Refer to the gfs_fsck man page, gfs_fsck(8), for additional information about other command options.


gfs_fsck -y BlockDevice

The -y flag causes all questions to be answered with yes. With the -y flag specified, the gfs_fsck command does not prompt you for an answer before making changes.


Specifies the block device where the GFS file system resides.


In this example, the GFS file system residing on block device /dev/gfsvg/gfslv is repaired. All queries to repair are automatically answered with yes. Because this example uses the -v (verbose) option, the sample output is extensive and repetitive lines have been elided.

[root@tng3-1]# gfs_fsck -v -y /dev/gfsvg/gfslv
Initializing fsck
Initializing lists...
Initializing special inodes...
Validating Resource Group index.
Level 1 check.
92 resource groups found.
Setting block ranges...
Creating a block list of size 9175040...
Clearing journals (this may take a while)Clearing journal 0
Clearing journal 1
Clearing journal 2
Clearing journal 10

Journals cleared.
Starting pass1
Checking metadata in Resource Group 0
Checking metadata in Resource Group 1
Checking metadata in Resource Group 91
Pass1 complete      
Starting pass1b
Looking for duplicate blocks...
No duplicate blocks found
Pass1b complete      
Starting pass1c
Looking for inodes containing ea blocks...
Pass1c complete      
Starting pass2
Checking directory inodes.
Pass2 complete      
Starting pass3
Marking root inode connected
Checking directory linkage.
Pass3 complete      
Starting pass4
Checking inode reference counts.
Pass4 complete      
Starting pass5
Updating Resource Group 92
Pass5 complete      
Writing changes to disk
Syncing the device.
Freeing buffers.

Note: This documentation is provided {and copyrighted} by Red Hat®, Inc. and is released via the Open Publication License. The copyright holder has added the further requirement that Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. The CentOS project redistributes these original works (in their unmodified form) as a reference for CentOS-5 because CentOS-5 is built from publicly available, open source SRPMS. The documentation is unmodified to be compliant with upstream distribution policy. Neither CentOS-5 nor the CentOS Project are in any way affiliated with or sponsored by Red Hat®, Inc.