Force Fsck on Boot

Force fsck on boot

/etc/rc.conf

1fsck_y_enable="YES"
2background_fsck="NO"

/etc/rc.d/root

 1#!/bin/sh
 2#
 3# $FreeBSD: stable/10/etc/rc.d/root 177062 2008-03-11 17:21:14Z delphij $
 4#
 5
 6# PROVIDE: root
 7# REQUIRE: fsck
 8# KEYWORD: nojail
 9
10. /etc/rc.subr
11
12name="root"
13start_cmd="root_start"
14stop_cmd=":"
15
16root_start()
17{
18    # root normally must be read/write, but if this is a BOOTP NFS
19    # diskless boot it does not have to be.
20    #
21    case ${root_rw_mount} in
22    [Nn][Oo] | '')
23        ;;
24    *)
25
26       # 在这里fsck======================fsck
27       /sbin/fsck -fy /
28
29        if ! mount -uw /; then
30            echo 'Mounting root filesystem rw failed, startup aborted'
31            stop_boot true
32        fi
33        ;;
34    esac
35
36    umount -a >/dev/null 2>&1
37
38    # If we booted a special kernel remove the record
39    # so we will boot the default kernel next time.
40    if [ -x /sbin/nextboot ]; then
41        /sbin/nextboot -D > /dev/null 2>&1
42    fi
43}
44
45load_rc_config $name
46run_rc_command "$1"

博客评论提醒
Cheat Sheet for K8s