当我们有大量磁盘时执行 efsck 的简短方法

当我们有大量磁盘时执行 efsck 的简短方法

我们需要在所有磁盘上执行 e2fsck (redhat linux - 7.2)。由于在每台机器上我们都有 22 个磁盘(ext4 文件系统),因此在每个磁盘上执行此操作将花费一些时间,因为众所周知,在执行 e2fsck 时需要卸载挂载点文件夹,然后在磁盘上使用 e2fsck。例子:

umount /grid/sdb
fsck /dev/sdb
mount /grid/sdb

但是,我发现选项可以更快。我们可以使用 fstab 来达到此目的,并将第六个字段从 0 更改为 1,然后重新启动计算机

据我了解,启动期间所有磁盘都会自动执行 2fsck。我在这儿吗?/etc/fstab例子:

UUID=6f8debb3-aac9-4dfb-877f-463f5132d055 /grid/sdb ext4 defaults,noatime 0 0
UUID=203c24b2-8c07-4a9a-b4e0-1848ac5570d6 /grid/sdc ext4 defaults,noatime 0 0
UUID=941546ac-2168-4130-b51f-f5a255a4e43c /grid/sdd ext4 defaults,noatime 0 0

UUID=6f8debb3-aac9-4dfb-877f-463f5132d055 /grid/sdb ext4 defaults,noatime 1 0
UUID=203c24b2-8c07-4a9a-b4e0-1848ac5570d6 /grid/sdc ext4 defaults,noatime 1 0
UUID=941546ac-2168-4130-b51f-f5a255a4e43c /grid/sdd ext4 defaults,noatime 1 0

从 fstab(5) 手册页:

   The sixth field (fs_passno).
          This field is used by the fsck(8) program to determine the order
          in which filesystem checks are done at reboot  time.   The  root
          filesystem  should be specified with a fs_passno of 1, and other
          filesystems should have a fs_passno of 2.  Filesystems within  a
          drive will be checked sequentially, but filesystems on different
          drives will be checked at the same time to  utilize  parallelism
          available in the hardware.  If the sixth field is not present or
          zero, a value of zero is returned and fsck will assume that  the
          filesystem does not need to be checked.

答案1

这几乎是正确的;你应该使用传递号 2(因为这些不是根文件系统),它确实必须是第六个字段,所以

UUID=6f8debb3-aac9-4dfb-877f-463f5132d055 /grid/sdb ext4 defaults,noatime 0 2
UUID=203c24b2-8c07-4a9a-b4e0-1848ac5570d6 /grid/sdc ext4 defaults,noatime 0 2
UUID=941546ac-2168-4130-b51f-f5a255a4e43c /grid/sdd ext4 defaults,noatime 0 2

|<-------------- field 1 -------------->| |<- 2 ->| |<>| |<- field 4 -->| ^ ^
                                                     ^                    | |
                                            field 3 -+           field 5 -+ |
                                                                   field 6 -+

相关内容