IT Questions and Answers :)

Monday, December 30, 2019

What is the command to tell an ext* filesystem on /dev/sda1 to perform a filesystem check at each boot up if has not been checked in more than one day?

What is the command to tell an ext* filesystem on /dev/sda1 to perform a filesystem check at each boot up if has not been checked in more than one day?

  • e2fsck -D /dev/sda1
  • tune2fs -i 1d /dev/sda1
  • e2fsck -C0 -c -c -D /dev/sda1
  • tune2fs -c 1 /dev/sda1

What is the command to tell an ext* filesystem on /dev/sda1 to perform a filesystem check at each boot up if has not been checked in more than one day?

EXPLANATION

The simplest way to force fsck filesystem check on a root partition eg. /dev/sda1 is to create an empty file called forcefsck in the partition's root directory.

# touch /forcefsck
This empty file will temporarily override any other settings and force fsck to check the filesystem on the next system reboot. Once the filesystem is checked the forcefsck file will be removed thus next time you reboot your filesystem will NOT be checked again. To enable more permanent solution and force filesystem check on every reboot we need to manipulate filesystem's "Maximum mount count" parameter. The following linux command will ensure that filesystem /dev/sdb1 is checked every time your Linux system reboots. Please note that for this to happen the fsck's PASS value in /etc/fstab must be set to a positive integer as discussed above.
# tune2fs -c 1 /dev/sdb1
alternatively we can set fsck after every 10 reboots:
# tune2fs -c 10 /dev/sdb1

 

Share:

0 comments:

Post a Comment

Popular Posts