# Automatic fsck -y on failure



## jailed (Jul 30, 2013)

Hello,

I'm using FreeBSD 9.1 and I want to force the system to do `fsck -y` automatically after a power failure.

I've added this lines to /etc/rc.conf

```
fsck_y_enable="YES"
background_fsck="NO"
```

However this is not working and the system still drops into the single user mode to fix it manually. What I want is fixing the errors automatically before mounting read-write and continue booting the system after that. Is it possible?

Thanks in advance.


----------



## wblock@ (Jul 30, 2013)

If this is enough of a problem to try to automate it, it means you need a UPS.


----------



## jailed (Jul 31, 2013)

Thank you for your answer. I've UPS. One of the servers is crashing for some reason and drops into the single user shell. I'm on a trip. Each time the server crashes, I have to ask somebody to fix it manually. I just want to temporarily ignore the problem by automatic repairs until I'm available to fix the real problem. I haven't got KVM over IP.

Best regards.


----------



## wblock@ (Jul 31, 2013)

Looking at /etc/rc.d/fsck, I wonder if you need

```
fsck_y_flags="-t ufs"
```


----------



## SirDice (Jul 31, 2013)

Maybe the server is crashing because the disk has gone bad? I'm not entirely sure but it's possible the system does try to fix it automatically but fails because the errors are too severe?


----------



## jailed (Jul 31, 2013)

Thanks to both of you for your replies.

@wblock@
I will try this and wait for the next crash if it's working or not.

@SirDice
I will absolutely replace the hard drive and test it when I return. I don't think the source of the problem is the RAM.


----------

