Bromania Wiki

Scribblings of a Brit in Romania

User Tools

Site Tools


tech:unix:autofsck

Automatic fsck -y at Startup

Environment

  • FreeBSD
  • NetBSD

Overview

If you are using a single board computer you may not have a serial connection set up to its console, or it may just not be connected to a monitor due to its location. If this is the case and, at some point, the computer powers off due to a power failure, an automatic fsck -p will start the next time the computer boots. If there are any errors that fsck is not comfortable fixing itself it will fail, the file system(s) will be marked as dirty, and the boot process will halt, prompting the user to enter single user mode to fix the issue with fsck -f. This is either not possible, or very inconvenient, for a headless setup.

FreeBSD

To tell FreeBSD to perform an fsck -fy to force a full check if the fsck -p fails, and to answer yes to any questions, add the following lines to /etc/rc.conf:

fsck_y_enable="YES"
background_fsck="NO"
force_fsck="YES"
force_fsck_list="/"

NetBSD

To force fsck to do a full check on each boot, and to answer affirmatively to any questions, add the following line to /etc/rc.conf:

fsck_flags="-fy"
tech/unix/autofsck.txt · Last modified: 2023/01/05 11:06 by puisor