How to change disk checking (fsck) frequency at boot?

10:11:00 PM Mahesh Kumar Yadav 1 Comments

Ubuntu checks the root partition at about every 30th boot. If you have a desktop machine/laptop that you switch off every day, this number may be too small. In this case you can safely increase this number to 50 at least.
First, figure out where your root partition is using the df command which produces this result in my case:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda6             30850168   9374588  19908444  33% /
/dev/sda8            129636480  52663092  76973388  41% /media/DATA
So my root partition (‘/‘) is at /dev/sda6.
Then check out your disk checking frequency:
sudo dumpe2fs /dev/sda6 | grep -i "mount count"
Where you need to replace /dev/sda6 with the value that is specific to your root partition. Its output is something like this:
dumpe2fs 1.42.13 (17-May-2015)
Mount count:              12
Maximum mount count:      26
Finally, if I want to increase the frequency to 50:
sudo tune2fs -c 50 /dev/sda6 
To disable file system integrity check for forever. Type following command
sudo tune2fs -c -1 /dev/sda6 
To check after 1 month. Type following command
sudo tune2fs -i 1m /dev/sda6 
List  the  contents  of the filesystem superblock, including the current values of the parameters that can be set via  this  pro‐gram.
sudo tune2fs -l /dev/sda6
Where, again, you might need to replace /dev/sda6.