3.10. Repairing a GFS2 File System
当挂载文件系统节点失败时,文件系统日志允许快速恢复。但如果存储设备断电或者断开物理连接,则会发生文件系统崩溃。(无法使用日志进行存储子系统失败修复。)当这种崩溃发生时,您可以使用
fsck.gfs2
命令修复 GFS2 文件系统。
重要
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 fsck
command.
注意
If you have previous experience using the
gfs_fsck
command on GFS file systems, note that the fsck.gfs2
command differs from some earlier releases of gfs_fsck
in the following ways:
- Pressing Ctrl+C while running the
fsck.gfs2
command interrupts processing and displays a prompt asking whether you would like to abort the command, skip the rest of the current pass, or continue processing. - 您可以使用
-v
标签提高详细等级。添加第二个-v
标签会再次提高等级。 - 您可以使用
-q
标签降低详细等级。添加第二个-q
标签会再次降低等级。 - The
-n
option opens a file system as read only and answersno
to any queries automatically. The option provides a way of trying the command to reveal errors without actually allowing thefsck.gfs2
command to take effect.
Refer to the
fsck.gfs2
man page for additional information about other command options.
Running the
fsck.gfs2
command requires system memory above and beyond the memory used for the operating system and kernel. Each block of memory in the GFS2 file system itself requires approximately five bits of additional memory, or 5/8 of a byte. So to estimate how many bytes of memory you will need to run the fsck.gfs2
command on your file system, determine how many blocks the file system contains and multiply that number by 5/8.
For example, to determine approximately how much memory is required to run the
fsck.gfs2
command on a GFS2 file system that is 16TB with a block size of 4K, first determine how many blocks of memory the file system contains by dividing 16TB by 4K:
17592186044416 / 4096 = 4294967296
Since this file system contains 4294967296 blocks, multiply that number by 5/8 to determine how many bytes of memory are required:
4294967296 * 5/8 = 2684354560
This file system requires approximately 2.6GB of free memory to run the
fsck.gfs2
command. Note that if the block size was 1K, running the fsck.gfs2
command would require four times the memory, or approximately 11GB.
用法
fsck.gfs2 -y BlockDevice
-y
-y
标签可使对所有问题的回答都为yes
。如果指定-y
标签,fsck.gfs2
命令则不会在进行修改前提示您进行回答。BlockDevice
- 指定 GFS2 文件系统所在的块设备。
示例
In this example, the GFS2 file system residing on block device
/dev/testvg/testlv
is repaired. All queries to repair are automatically answered with yes
.
# 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