how do i fsck my server?

Bill Tillman btillman99 at
Wed Jun 15 22:25:35 UTC 2011

From: Chuck Swiger <cswiger at>
To: Gary Kline <kline at>
Cc: FreeBSD Mailing List <freebsd-questions at FreeBSD.ORG>
Sent: Wed, June 15, 2011 4:04:23 PM
Subject: Re: how do i fsck my server?

On Jun 15, 2011, at 12:50 PM, Gary Kline wrote:
> can anybody clue me in on why fsck on my server [yes, of course as root]
> seem to refuse to WRITE?

Bad sectors on the hard drive are a somewhat common cause of this.

>  we had a power out locally and i caught my UPS at
> the last second.  i powered off my server to save the battery, etc, and 
> a few minutes ago when i ran 
> # fsck -y /var
> there were unresolved inconsistancies that fsck was not allowed to resolve.

Was /var mounted already?  You shouldn't be running fsck on a live filesystem; 
boot single user or from a FreeBSD CD, and run fsck that way.

> i tried to boot single use but the server (Dell 530) panicked.  so finally,
> after deliberately crashing the box three times, fsck_ufs ran.  i was able to
> ping outside.  
> is there any way of scripting fsck *every* time i reboot this box?  i just
> want to make abs certain that the filesystems are clean.  ---didn't fscking
> used to be easier?

You can set fsck_y_enable="YES" in /etc/rc.conf, but it shouldn't be necessary.  
The system can figure out for itself whether it shutdown cleanly or whether a 
fsck is necessary.


freebsd-questions at mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

I hate to be a pain here but this answer completely misses something very 
important about a reboot after a crash with FreeBSD. 

"The system can figure out for itself whether it shutdown cleanly or whether 
fsck is necessary."

With no disrespect meant, this is like telling someone that in case of a fire 
it's not a good idea to use the elevators. The correct reply to this IMHO should 
have been "HELL YES, your server will check for a clean exit on every reboot. It 
will count to 60 seconds and then if the last shutdown was not clean it will 
start running fsck all by itself and this will tie up your system's resources 
for quite a while depending on the size of your hard drive(s). And this time can 
be quite lengthy. I have two 750 GB hard drives in my server and it crashed a 
couple of times in the recent past. It made running almost anything on it slow 
as can be while the fsck process run automatically cleaned up the mess. And it 
takes the better part of an hour for this process to complete.

More information about the freebsd-questions mailing list