Force fsck on system boot.

General support questions
Post Reply
o1crimson1o
Posts: 5
Joined: 2015/01/21 02:47:58
Location: Montreal, QC
Contact:

Force fsck on system boot.

Post by o1crimson1o » 2016/09/26 16:34:39

I know you can add the kernel boot option(s)

fsck.mode=force
fsck.repair=yes

Is this the only way to achieve this? Or will the old /forcefsck work (I don't think it will I would just like confirmation.

User avatar
TrevorH
Site Admin
Posts: 33220
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Force fsck on system boot.

Post by TrevorH » 2016/09/27 12:19:08

I tried touch /forcefsck then rebooted and it appeared to fsck things (it was very quick and was gone when I tried to scroll back) and /forcefsck was removed when the system was up.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

kskp
Posts: 14
Joined: 2016/06/08 18:13:22

Re: Force fsck on system boot.

Post by kskp » 2017/09/12 17:40:17

Where exactly should I add these two lines to force an fsck after reboot? I tried the /forcefsck method and it doesn't seem to work for me.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Force fsck on system boot.

Post by hunter86_bg » 2017/09/12 19:05:59

Won't do anything for XFS.
Although an fsck.xfs binary is present in the xfsprogs package, this is present only to satisfy initscripts that look for an fsck.filesystem binary at boot time. fsck.xfs immediately exits with an exit code of 0.
Another thing to be aware of is that older xfsprogs packages contain an xfs_check tool. This tool is very slow and does not scale well for large filesystems. As such, it has been depreciated in favor of xfs_repair -n.

quqonlik
Posts: 16
Joined: 2019/01/19 23:29:32

Re: Force fsck on system boot.

Post by quqonlik » 2019/02/20 22:58:39

Will this work if I create "touch /forcefsck" with Oracle 6 Linux OS?

From rc.sysinit file:

fi
rm -f /.autorelabel
# at this point fsck was already executed see bz1236062
[ -f /forcefsck ] && rm -f /forcefsck

echo $"Unmounting file systems"
umount -a
mount -n -o remount,ro /
echo $"Automatic reboot in progress."
# Run a custom script if exists before force reboot
if [ -f /etc/rc.d/rc.autorelabel.post ]; then
source /etc/rc.d/rc.autorelabel.post
fi
reboot -f
}

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Force fsck on system boot.

Post by hunter86_bg » 2019/02/21 05:00:03

As long as you use ext-based FS,

Code: Select all

touch /forcefsck
should work.

Post Reply