Automatic fsck at boot

When encountering issues while booting, that can be solved by checking the file system for errors, it can be helpful to automatically check the file system.

If you're encountering boot issues regularly please check your boot drive! It could be a first sign of a soon failing drive! This quick guide is actually for virtualized machines whose can have file system that are being stopped due to backups. Therefore add the following expressions to the line in /etc/default/grub that starts with GRUB_CMDLINE_LINUX_DEFAULT: Firstly open the file:

sudo nano /etc/default/grub

Then add the following settings to GRUB_CMDLINE_LINUX_DEFAULT:

fsck.mode=force
fsck.repair=yes

So that it looks like this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet fsck.mode=force fsck.repair=yes"

Finally update grub with:

sudo update-grub

Verify your changes with:

cat /boot/grub/grub.cfg

Sourced from askubuntu.com - Automatically force fsck