2016-04-29

HOWTO: force filesystem check on reboot in a Linux system

Usually, only a superficial file system check is performed automatically on boot up, and it's sufficient; but sometimes it could be handy to force a full file system check (i. e., to run the Linux fsck utility) to ensure the FS is really OK.
  1. Classic init (SysVinit): just reboot the system with a special option:
    # shutdown -rF now
  2. systemd init: much more interesting: at the boot time, you need to append a special kernel command line parameter (e. g., you can specify it at the GRUB command line):
    linux /boot/vmlinuz root=UUID=... ro fsck.mode=force

P. S. It should then check all the filesystems enabled for checking in /etc/fstab.

References:
  1. man shutdown
  2. man systemd-fsck
  3. man fstab
  4. man fsck