fsck_ufs running too often

Polytropon freebsd at edvax.de
Sat Jun 23 02:22:31 UTC 2012

On Fri, 22 Jun 2012 14:56:39 -0700 (PDT), Leonardo M. Ramé wrote:
> Hi, since a few of days ago, I noticed my home server turns very
> slow more than once a day, so every time I run "top" to see
> what's processes are running, I can see fsck_ufs at the very
> top, and the hard drive working like mad.

It seems you have background_fsck="YES" enabled in /etc/rc.conf.
Is this desired? If not, set it to ="NO" to perform a file system
check prior to going multi-user. That would take several minutes,
but it makes sure the system boots up into a properly checked and
mounted environment.

> I've checked my crontab and there's nothing related to fsck_ufs,
> where can I start searching for the cause of the problem?,

Check /etc/rc.conf (see "man rc.conf" and /etc/defaults/rc.conf),
look for the background_fsck setting.

> I thought this process should run only at boot or shutdown,

At shutdown? I'd say at boot. In fact, a background file system
check actually starts at boot, but runs during and after boot-up,
that's what you're obviously noticing as high I/O load.

> but this time it is running -apparently- without a cause.

No. The fsck run doesn't start without a cause. The cause is: the
filesystem about to be mounted is "dirty" (contains defects because
it wasn't properly unmounted). What the reason for _this_ observation
is... check if your server accidentally got powered off (e. g.
bad power line).

You can check the timestamps in various log files (most prominent
example is /var/log/messages) to see when your system started.

If you notice the system started "too often", maybe fsck was not
able to successfully finish (and repair!) the file systems, so it
will do so on every start of the system.

My suggestion: Set background_fsck="YES" in /etc/rc.conf and let
the system boot up that way. _If_ you have a faulty disk or other
data corruption, you'll notice this _before_ going multi-user and
maybe making things worse. Yes, it might take some time, but it's
time well invested in your data integrity.

Alternative: Perform a "shutdown now" and go into single-user mode.
Then unmount all your file systems, do "mount -o ro /" and then
perform the fsck run on all file systems. It's typically adviced
to perform file system checks on unmounted (or at least read-only
mounted) file systems.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list