Problem running custom startup script at proper time

Aaron drizzt321 at gmail.com
Sun Sep 19 20:03:40 UTC 2010


I'm having trouble getting a custom startup script to run at the
proper time. I'm having to use gnop with my new Western Digital
WD10EARS (1TB, 4K sector size) because it reports the standard 512
byte to the OS. I'm basing it on
http://www.cod3r.com/2010/06/zfs-on-western-digital-ears-drives/ which
also says that it needs to be run on each boot so that ZFS will use
the .nop devices. So, I've created a custom startup script to
automatically do this for me at the proper time (before zfs starts and
auto-mounts). I'm having trouble getting it to work properly though.
In services -r, it is listed before the zfs startup script, but in
dmesg the gnop messages come after the zfs startup messages. Below is
excerpts from services -r, dmesg, and the startup script in its
entirety.


EXCERPT FROM services -r
/etc/rc.d/hostid_save
/etc/rc.d/mdconfig
/etc/rc.d/mountcritlocal
/etc/rc.d/gnop
/etc/rc.d/zfs
/etc/rc.d/FILESYSTEMS
/etc/rc.d/var
/etc/rc.d/cleanvar

EXCERPT FROM dmesg
Trying to mount root from ufs:/dev/ad0s1a
ZFS NOTICE: Prefetch is disabled by default if less than 4GB of RAM is present;
            to enable, add "vfs.zfs.prefetch_disable=0" to /boot/loader.conf.
ZFS filesystem version 3
ZFS storage pool version 14
GEOM_NOP: Device ad6.nop created.
GEOM_NOP: Device ad8.nop created.
GEOM_NOP: Device ad10.nop created.
GEOM_NOP: Device ad12.nop created.


STARTUP SCRIPT, /etc/rc.d/gnop
#!/bin/sh
#
# PROVIDE: gnop
# REQUIRE: mdconfig
. /etc/rc.subr

name="gnop"
start_cmd="gnop_start"

gnop_start()
{
for i in ad6 ad8 ad10 ad12; do gnop create -S 4096 $i; done
}

load_rc_config $name
run_rc_command "$1"


More information about the freebsd-questions mailing list