# power fail & fsck



## Vadim (Sep 19, 2010)

Hi2all!
after power fail system stops on filesystem checks. it says that / wasn't dismounted correctly and so on.
Sometimes i'm miles away from server and i can't run fsck manually)

some tips, like adding 
	
	



```
fsck_y_enable="YES"
```
 to /etc/rc.conf changed nothing.
I want my system bring up after power fail, even if the filesystem wasn't marked up as clean.
someday i'll obtain UPS)), but now..

Is there any solutions?


----------



## Vadim (Sep 19, 2010)

P.S. my system is FreeBSD 8.0-RELEASE-p4


----------



## User23 (Sep 20, 2010)

Normally the filesystems will be checked in background.

The system reports after the cold reboot that the filesystems where not dismounted correctly and the background fsck starts.

In your case i would set 
	
	



```
background_fsck="NO"
```
 too, so fsck will run in the foreground because the background fsck sometime fails and need a [cmd=]fsck -y[/cmd] by hand. Without background fsck it may take some time and increase the downtime but your system will start with clean filessystems.  

http://www.FreeBSD.org/cgi/man.cgi?query=rc.conf&apropos=0&sektion=0&manpath=FreeBSD+8.1-RELEASE&format=html


```
fsck_y_enable
                 (bool) If set to ``YES'', fsck(8) will be run with the -y
                 flag if the initial preen of the file systems fails.

background_fsck
                 (bool) If set to ``YES'', the system will attempt to run
                 fsck(8) in the background where possible.
```


----------



## jalla (Sep 20, 2010)

Enabling fsck -y should normally fix the filesystems and allow the system to boot, but not allways.
There are pathological cases where fsck require manual confirmation of it's actions. For those cases, if you can't get to the normal console, your only option is to have a serial console set up that you can access remotely.


----------



## User23 (Sep 20, 2010)

jalla said:
			
		

> Enabling fsck -y should normally fix the filesystems and allow the system to boot, but not allways.



Yes, but it dont fail as often as a bg fsck will do. And if he have no serial console this could be the best choice.
If you have often a power loss and you can not use a UPS yet, maybe the "sync" command will help you to keep your filesystems more consistent with it.


```
The sync utility can be called to ensure that all disk writes have been completed ...
```

http://www.FreeBSD.org/cgi/man.cgi?query=sync&apropos=0&sektion=0&manpath=FreeBSD+8.1-RELEASE&format=html

---

I would by a UPS


----------



## Vadim (Sep 20, 2010)

tnx!

Ok, i added 
	
	



```
background_fsck="NO"
```
 to rc.conf

On weekend i'll try to replay situation of power fail manually. But, as i understand, that is a feature, for overall filesystem consistency. and I'll could never know/catch the situation when I need to repair corrupted filesystem.

Is this due to preformatted ufs or other filesystems can be more flexible to corruptions? What about zfs as root /?


----------



## Vadim (Oct 9, 2010)

It seems that background_fsck do the trick. After power fail systems boots up)
Thanks all


----------

