mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
d5d7e76d2b
top of ZVOLs. The problem is that rc.d/fsck runs before rc.d/zfs. The latter makes ZVOLs to appear in /dev/. In such case rc.d/fsck cannot find devfs entry and aborts. We cannot simply move rc.d/zfs before rc.d/fsck, because we first want kern.hostid to be configured (by rc.d/hostid). If we won't wait (hostid will be 0) we can reuse disks which are in use by different systems (eg. in SAN/NAS environment). We also cannot move rc.d/hostid before rc.d/fsck, because rc.d/hostid on first system start stores generated kern.hostuuid in /etc/hostid file, so it needs root file system to be mounted read-write. The fix is to split rc.d/hostid so that rc.d/hostid (which will now run before rc.d/fsck) only generates hostid and sets up sysctls, but doesn't touch root file system and rc.d/hostid_save (which is run after rc.d/root) and only creates /etc/hostid file. With that in place, we can move ZVOL initialization to dedicated rc.d/zvol script which runs before rc.d/fsck. PR: conf/120194 Reported by: James Snow <snow@teardrop.org> Reviewed by: brooks Approved by: re (kib) MFC after: 2 weeks
30 lines
429 B
Bash
Executable File
30 lines
429 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: hostid_save
|
|
# REQUIRE: root
|
|
# BEFORE: mountcritlocal
|
|
# KEYWORD: nojail
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="hostid_save"
|
|
start_cmd="hostid_save"
|
|
stop_cmd=":"
|
|
rcvar="hostid_enable"
|
|
|
|
hostid_save()
|
|
{
|
|
if [ ! -r ${hostid_file} ]; then
|
|
$SYSCTL_N kern.hostuuid > ${hostid_file}
|
|
if [ $? -ne 0 ]; then
|
|
warn "could not store hostuuid in ${hostid_file}."
|
|
fi
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|