Red Hat Training
A Red Hat training course is available for RHEL 8
Chapter 5. GFS2 file system repair
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 GFS2 file system by using the
fsck.gfs2 command must be run only on a file system that is unmounted from all nodes. When the file system is being managed as a Pacemaker cluster resource, you can disable the file system resource, which unmounts the file system. After running the
fsck.gfs2 command, you enable the file system resource again. The timeout value specified with the
--wait option of the
pcs resource disable indicates a value in seconds.
pcs resource disable --wait=timeoutvalue resource_id [fsck.gfs2] pcs resource enable resource_id
To ensure that
fsck.gfs2 command does not run on a GFS2 file system at boot time, you can set the
run_fsck parameter of the
options argument when creating the GFS2 file system resource in a cluster. Specifying
"run_fsck=no" will indicate that you should not run the
5.1. Determining required memory for running fsck.gfs2
fsck.gfs2 command may require system memory above and beyond the memory used for the operating system and kernel. Larger file systems in particular may require additional memory to run this command.
The following table shows approximate values of memory that may be required to run
fsck.gfs2 file systems on GFS2 file systems that are 1TB, 10TB, and 100TB in size with a block size of 4K.
|GFS2 file system size||Approximate memory required to run |
Note that a smaller block size for the file system would require a larger amount of memory. For example, GFS2 file systems with a block size of 1K would require four times the amount of memory indicated in this table.
5.2. Repairing a gfs2 filesystem
The format of the
fsck.gfs2 command to repair a GFS2 filesystem is as follows:
fsck.gfs2 -y BlockDevice
-yflag causes all questions to be answered with
yes. With the
-yflag specified, the
fsck.gfs2command does not prompt you for an answer before making changes.
- Specifies the block device where the GFS2 file system resides.
In this example, the GFS2 file system residing on block device
/dev/testvg/testlv is repaired. All queries to repair are automatically answered with
# fsck.gfs2 -y /dev/testvg/testlv Initializing fsck Validating Resource Group index. Level 1 RG check. (level 1 passed) Clearing journals (this may take a while)... Journals cleared. Starting pass1 Pass1 complete Starting pass1b Pass1b complete Starting pass1c Pass1c complete Starting pass2 Pass2 complete Starting pass3 Pass3 complete Starting pass4 Pass4 complete Starting pass5 Pass5 complete Writing changes to disk fsck.gfs2 complete