4

I'm looking for systemd's equivalent to the shutdown -F command. I know that I can force fsck by adding fsck.mode=force to kernel options or tweak mount count for disks. I have tried touch /forcefsck but it doesn't work with latest systemd versions.

1

2 Answers 2

3

When I want to force fsck, I just use the following command:

# tune2fs -C 50 /dev/sda2 

It simply sets the mount counter to 50, but I also have set:

# tune2fs -l ... Mount count: 18 Maximum mount count: 20 

So as you can see, when I set 50 in mount count, kernel thinks it should fsck the partition.

This solution works always, no matter what you use sysvinit/systemd or whatever else.

0

systemd's shutdown -F equivalent is systemctl poweroff. I haven't figured out the relation with fsck. However, AFAIK, you can not force fsck using systemd, because fsck is executed before systemd starts.

3
  • If you add -F flag to shutdown command it will force fsck execution after reboot: unixhelp.ed.ac.uk/CGI/man-cgi?shutdown Commented Dec 28, 2013 at 14:37
  • 1
    It just passes fsck.mode=force to the kernel. With systemd I guess you can't AFAIK. Commented Dec 28, 2013 at 14:47
  • 2
    systemd is init, i.e. the very first program executed, so fsck necessarily takes place after systemd is run. Commented Jan 1, 2015 at 4:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.