Last Updated on
Coming from a Windows (Server) background one would expect that file system errors are corrected automatically on boot. Not so the case on Linux machines. On one of my boxes with a nightly reboot, I have recently observed that the machine is not coming back up due to file system inconsistencies. Why this is happening I am not sure – also I do not particularly care and no data loss is occurring (to my knowledge) when manually running fsck through the forced recovery console. Assuming a drive is at some point of failure. So in this scenario a suitable workaround is the following:
Running this command prior to reboot will force file system checking when the machine boots:
And as a script, the following is being used via chron:
If you wish to run FSCK intermittently you can use the tune2fs utility to schedule a check every X# of bootups:
tune2fs -c 30 /dev/sdaX
This will yield a file system check every 30 bootups.