I had been seeing an uprising issue of forced file system quota check on every boot after migrating to RHEL 6 or CentOS 6. I hadn’t seen the same issue before. I had been tackling it by changing the quotacheck file on each boot to something different. Quotacheck file is located:
$ ls /sbin/quotacheck
I couldn’t get enough information on something was changed in RHEL 6 which triggered this event. I went to trace out the root reason of this starting from Linux Boot Init script.
RHEL init script runs the following file:
/etc/rc.d/rc.sysinit
sysinit script has a specific section for Quotacheck variable. Here is the snippet I had to debug:
_RUN_QUOTACHECK=0
if [ -f /forcequotacheck ] || strstr “$cmdline” forcequotacheck ; then
_RUN_QUOTACHECK=1
fi
if [ -z “$fastboot” -a “$READONLY” != “yes” ]; thenSTRING=$”Checking filesystems”
echo $STRING
fsck -T -t noopts=_netdev -A $fsckoptions
rc=$?if [ “$rc” -eq “0” ]; then
success “$STRING”
echo
elif [ “$rc” -eq “1” ]; then
passed “$STRING”
echo
elif [ “$rc” -eq “2” -o “$rc” -eq “3” ]; then
echo $”Unmounting file systems”
umount -a
mount -n -o remount,ro /
echo $”Automatic reboot in progress.”
reboot -f
fi# A return of 4 or higher means there were serious problems.
if [ $rc -gt 1 ]; then
[ -n “$PLYMOUTH” ] && plymouth –hide-splashfailure “$STRING”
echo
echo
echo $”*** An error occurred during the file system check.”
echo $”*** Dropping you to a shell; the system will reboot”
echo $”*** when you leave the shell.”str=$”(Repair filesystem)”
PS1=”$str # # “; export PS1
[ “$SELINUX_STATE” = “1” ] && disable_selinux
start rcS-emergency
echo $”Unmounting file systems”
umount -a
mount -n -o remount,ro /
echo $”Automatic reboot in progress.”
reboot -f
elif [ “$rc” -eq “1” ]; then
_RUN_QUOTACHECK=1
fi
fi
So, first check if you have a file named “forcequotacheck” under your root directory /. If you do, that is triggering the force quota check. If not, then it is possible, init script had to check your file system integrity due to inconsistency evidence. The condition in the code is checking the quota only if the $rc returns 1 (Check 4 lines before from the end). From the line 12, $rc (a result from a fsck command just above that condition) will returns 0 if the file system integrity check returns a clean system even after inconsistency evidence found. From line 15, $rc would return 1 if it had to run a repair after finding evidence of inconsistent at first check. That means, if your system was “uncleanly shutdown” or “uncleanly rebooted”, it is highly possible, you had some data corrupted (Most of the cases if your /tmp is inside the / mount point) and triggered a force file system quota check.
One option for a production servers is to make sure /tmp is differently partitioned and mounted other than the / mount. If it is not, and you do a force restart of your linux system, it is highly likely you will see a force file system quota check.
How to solve force file system quota check on every boot then?
Make sure you cleanly shutdown your system without a force flag. You may read the following article that would explain “The best method to reboot Linux system”. If you had to power strip your system, you probably have to run into the single user mode and change the quota file with something else.