Changing The Frequency Of StartUp Disk Checks On Linux

Opened hard drive with top magnet removed, sho...
Image via Wikipedia

Linux systems commonly run on ext2/ext3/ext4 file systems. These file-systems have a built-in feature to tell the operating system to do a disk check while booting up if the number of times the disk has been mounted exceeds a certain number. Most commonly the count is set to 30.

This is an inconvenience to anyone who regularly switches off the system, its even worse if the hard disk sizes reach 1Tb. So changing the number to suit your preference might be an excellent idea.


Changing the maximum mount count:

sudo tune2fs -c 50 /dev/sda1

Here:
tune2fs is the command that allows modification on the disk flags
-c enables the max mount count to be changed to the next parameter(50 in this case)
/dev/sda1 is the partition on which to do the operation

Changing the maximum time count:

sudo tune2fs -i 30d /dev/sda1

Here:
tune2fs is the command that allows modification on the disk flags
-i enables the max time count to be changed to the next parameter(30d in this case means the consecutive checks are scheduled 30 days apart). This parameter can be also give in terms of months(2m for 2 months) and weeks(3w for 3 weeks)
/dev/sda1 is the partition on which to do the operation

Enhanced by Zemanta