why isn't fsck running on boot like it is supposed to?

6,703

16.04 uses systemd to manage the boot process, the options you have tried are for the old SysV and early versions of upstart To force fsck on boot for systemd managed OSes you need to pass some kernel parameters, although usually these are not necessary as file system checks are automatic. More details about the kernel parameters (fsck.mode & fsck.repair) are available here and here

Share:
6,703

Related videos on Youtube

Michael
Author by

Michael

Updated on September 18, 2022

Comments

  • Michael
    Michael over 1 year

    I have tried

    sudo touch /forcefsck
    

    Then I reboot, and the file disappears, but no disk check appears to have taken place. The whole boot process takes under 10 seconds!

    Then I tried this to force it to reboot every day:

    sudo tune2fs -i 1 /dev/sda1
    

    To verify, I ran this:

    sudo dumpe2fs -h /dev/sda1 
    

    The relevant lines of output are:

    Last checked:             Sun Sep  4 12:15:45 2016
    Check interval:           86400 (1 day)
    Next check after:         Mon Sep  5 12:15:45 2016
    

    Running "date" I see my clock says it is currently Dec 19, 2016, so fsck should run on the next boot up. But after I reboot it is again really fast and rerunning dumpe2fs I see the same exact text above, suggesting it never even tried to run fsck.

    How can I force fsck to run at boot-up?

  • Michael
    Michael over 7 years
    I'm having a hard time understanding exactly how to proceed from here. I either need to interrupt the boot process somehow (it happens really quick, so hitting the right key at exactly the right time, I guess) and then enter the right stuff to manually boot passing the kernel parameters, or... is that my only option?
  • joe
    joe over 7 years
    @Michael you could also edit grub.conf as that is where the kernel parameters are coming from.
  • LinuxSecurityFreak
    LinuxSecurityFreak about 6 years
    @Michael Have a look at unix.stackexchange.com/a/400927/126755
  • Csaba Toth
    Csaba Toth over 5 years
    Can we fiddle maybe with /etc/init.d/checkfs.sh. I'm on an IaaS managed box in a VM. I'm not sure if I can force a kernel switch at all
  • Max Khon
    Max Khon almost 5 years
    In addition make sure that /etc/fstab entry for root ("/") has non-zero PASS (last column). Otherwise mkinitramfs will not add fsck to initrd image.