6

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?

1 Answer 1

2

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

5
  • 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?
    – Michael
    Dec 19, 2016 at 21:06
  • @Michael you could also edit grub.conf as that is where the kernel parameters are coming from.
    – Nattgew
    Dec 19, 2016 at 22:00
  • @Michael Have a look at unix.stackexchange.com/a/400927/126755 Feb 12, 2018 at 7:05
  • 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
    – Csaba Toth
    Sep 5, 2018 at 19:52
  • 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.
    – Max Khon
    May 29, 2019 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .