Linux
當我們有大量磁碟時執行 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.
這幾乎是對的;你應該使用 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 -+