Linux Reboot Disk Check Adjustments

Mindwatering Incorporated

Author: Tripp W Black

Created: 10/18/2017 at 06:40 PM

 

Category:
Linux
Utilities

How to Check and Update the Linux OS Disk Check Settings

The system root partition cannot be scanned and fixed while the "/" partition is in use. Therefore it is done upon reboot.
If a corruption or crash occurs, the system will set the disk for check automatically on the next reboot. However, it is also run periodically. You can set the routine scan after a certain number of reboots, or a certain amount of time.

Let's assume that our boot partition on our "system" disk is /dev/sda1, and the root "/" partition is /dev/sda2.

The scan can be run on demand, but not on the root partition "/" while running. In other words, like MS Windows, it has to be done during the reboot.
# fsck -f /dev/sda2

How many reboots before a scan is performed, or more likely, how many days between scans, is done via the tune2fs utility.

List current schedule:
# tune2fs -l /dev/sda2


To set to scan upon reboot after 10 days, or longer if no reboot yet:
# tune2fs -i 10d /dev/sda2

To set to every 10 reboots:
# tune2fs -c 10 /dev/sda2


Notes:
If your drive has bad blocks, it's may be time to replace it. However, you can can mark them and tell the system to not use them.
$ sudo badblocks /dev/sda > /home/myfolder/Desktop/bad-blocks
$ sudo fsck -l bad-blocks /dev/sda

To check the general disk health:
$ sudo smartctl -H /dev/sda2



previous page

×