How to prevent system to launch interactive fsck after improper shutdown and reboot?

doug at safeport.com doug at safeport.com
Wed Sep 15 21:12:00 UTC 2010


On Wed, 15 Sep 2010, Polytropon wrote:

> On Wed, 15 Sep 2010 08:47:38 +0200, "Remko Lodder" <remko at elvandar.org> wrote:
>>
>>>> Almost every time after improper shutdown (poweroff) and reboot I get
>>>> into interactive fsck.
>>>>
>>>> I am being asked whole bunch of questions to which I just have to answer
>>>> Y (what are my other options?)
>>>>
>>>> Why drop user into interactive fsck if there is not much choice anyways?
>>>> Is there a way to set it up the way it doesn't drop into interactive
>>>> mode? Like answer 'Y' to all questions?
>>>>
>>>> Yuri
>>
>> I think this might do your trick:
>>
>> fsck_y_enable="NO"      # Set to YES to do fsck -y if the initial preen
>> fails.
>> fsck_y_flags=""         # Additional flags for fsck -y
>>
>> The reason for this to get interactively is because this  might messup
>> with your filesystem, and you are the one responsible for your filesystem,
>> not us or the autmated system. So in case you want to "play" with that,
>> that's entirely up to you.
>>
>> In addition, I can imagine that companies (been there done it) do not want
>> to fsck -y by default, this because of the mentioned potential corruption
>> and dataloss.
>
> Very important point.
>
> As an addition, allow me to mention
>
> 	background_fsck="YES"
>
> as an entry in /etc/rc.conf. This will let the system boot up and perform
> fsck checks while the system is running - running on a maybe defective or
> inconsistent file system. This is dangerous, but possible. It utilizes a
> snapshot mechanism which can cause further trouble (lost / emptyinodes
> and disappearing subtrees of files).
>
> Personally, if fsck requires YOUR attention, there's usually a reason for
> this. The reason is possible data loss or file system corruption where YOU
> take the responsibility of decision, not fsck. By default, fsck does not
> do damaging, but under strange circumstances, it can happen. For example,
> if you want to do a special kind of data recovery or forensic analysis on
> a file system, you potentially DO NOT WANT fsck to assume "y" for all the
> questions because that can make your job harder.
>
> A common additional "y flag" is -f (means fsck -yf) to force all operations
> suggested by fsck and confirming them.
>
I have had two systems die with bad disks. This email contains great information 
and spot-on advice from my experience. When I was ready to give up on my last 
system I did a -yf in single user mode and was able to get most of my data 
because the bad sectors were in /usr/local which had many missing files and 
directories. Modern disks die silently which I think is too bad. If this is 
happening and you have data you want to recover you might try booting in single 
user move and using fsck manually on each slice. If you are lucky, your errors 
will be in /tmp or /var.


More information about the freebsd-questions mailing list