1

we need to do e2fsck on all our disks ( redhat linux - 7.2 ). Since on each machines we have 22 disks ( ext4 file-system ) it will take time to do it on each disk as all know when doing e2fsck need to umount the mount point folder and then use the e2fsck on the disk. Example:

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

But, I found option that can be much faster. We can use the fstab for this purpose and to change the sixth field from 0 to 1 and then reboot the machine

From my understanding during boot all disk will perform 2fsck automatically. Am I right here? /etc/fstab Example:

From

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

To

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

From the fstab(5) man page:

   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.
3

That’s nearly right; you should use a pass number of 2 (since these aren’t the root file system), and it really has to be the sixth field, so

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 -+
  • I guess the machine it take time until boot is completed ? – yael Mar 27 at 17:28
  • Yes, checking the disks might lengthen the boot, but in most cases it won’t — if the file system is clean, fsck will only force a check at fairly lengthy intervals by default. Checks are parallelised across disks too, which will help in your case. – Stephen Kitt Mar 27 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.