Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2012 22:24:57 +0200
From:      Goran Lowkrantz <goran.lowkrantz@ismobile.com>
To:        Chris Brennan <lists@xaerolimit.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: ZFS mounting order
Message-ID:  <CCE0CD1FD9254E1D2E4D096F@[10.255.253.2]>
In-Reply-To: <20120520104100.840fd1e7ddf3096c27520885@xaerolimit.net>
References:  <20120520104100.840fd1e7ddf3096c27520885@xaerolimit.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

Assuming that you are using some version of diskless (man diskless), I 
build NAS boxes using NanoBSD (man nanobsd) and in that setup, I need to 
move the cache from /boot/zfs to /etc/zfscache so the cache can be mapped 
to the files copied to the cfg partision. So I added the following file to 
rc.d/zpool

---------------------------------------------------------------------------
#!/bin/sh
#
# $FreeBSD: $
#

# PROVIDE: zpool
# REQUIRE: hostid
# BEFORE: zvol
# KEYWORD: nojail

. /etc/rc.subr

name="zpool"
rcvar="zfs_enable"
start_cmd="zpool_start"
required_modules="zfs"

zpool_start()
{
        if [ ! -z "$zpool_cache" -a -r "$zpool_cache" ]; then
                zpool import -c $zpool_cache -a
        fi
}

load_rc_config $name
run_rc_command "$1"
---------------------------------------------------------------------------

This works very well for a disk server from USB, CF or mSATA SSD.

I am not sure the BEFORE tag was required to make sure that this is the 
first ZFS related script run, before zvol, as zpool is sorted before zvol 
but I was not sure exactly how rcorder sorts.

/glz

--On Sunday, 20 May, 2012 10:41 AM -0400 Chris Brennan 
<lists@xaerolimit.net> wrote:

> Greetings!
>
> I have a FreeBSD 9 system with 3 different ZFS pools on it. I am
> booting from a ro CF Card w/o any major issues, the problem I am
> encountering is that zroot needs to be mounted at boot first, because
> it contains /usr, zhome and tank contain other various sub-partitions
> of /usr.
>
> Also, zroot causes me a lot of problems when I try to do "zpool
> import", when zpool gets to probing zroot, I get g_vfs errors printed
> to the console and the hacnine hangs till I reset it (which is
> obviously not acceptable behavior.) I was able to get around this when
> booting to my cf card by making / ro, which was my intention all along
> for that media.) I suspect this happens because there is a on that
> volume that is trying to replace something on / on either the USB boot
> img or on my CF card and this might be causing either to freak out.
>
> So I dunno what to do to get this working the way it should and some
> guidence would be greatly appreciated!
>
> --
>> Chris Brennan | http://xaerolimit.net | http://xaerolimit.net/forum
>> A: Yes.
>> > Q: Are you sure?
>> >> A: Because it reverses the logical flow of conversation.
>> >>> Q: Why is top posting frowned upon?
>> http://xkcd.com/84/ | http://xkcd.com/149/ | http://xkcd.com/549/
>> GPG: D5B20C0C (6741 8EE4 6C7D 11FB 8DA8  9E4A EECD 9A84 D5B2 0C0C)
> ------------------------------------------------------------------------
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CCE0CD1FD9254E1D2E4D096F>