Re: ZFS does not load and mount at boot time

From: Craig Boston <craig_at_xfoil.gank.org>
Date: Wed, 20 Jun 2007 11:05:18 -0500
On Wed, Jun 20, 2007 at 11:57:07AM +0200, Borja Marcos wrote:
> It seems ZFS labels the pools it creates using the hostname and the  
> hostid. The hostid is a unique number present in ROM/flash in Sun  
> machines, and it turns out one of the IP addresses of the machine is  
> used by FreeBSD as hostid.

On FreeBSD it first tries to use the UUID provided by the SMBIOS, if one
is available.  Most newer machines provide this -- you can type 'kenv
smbios.system.uuid' to see if yours does.

Only on machines which don't support that does it invoke uuidgen(1),
which generates one (actually it calls the undocumented-as-far-as-I-
can-tell uuidgen syscall).  The generated ID is half pseudorandom and
half based on the first MAC address it finds.  So networking doesn't
have to be up yet for it to work.

Additionally, it saves the generated/found UUID in /etc/hostid, and if
that file exists reads it from there rather than generating one (this is
actually necessary for systems without SMBIOS since uuidgen creates a
unique one every time).

> I've solved the problem in a quick and dirty way forcing the system  
> to import the ZFS pool despite the fact that it believes it's been  
> used by another host. The ugly kludge is simply to edit /etc/rc.d/zfs  
> and add "zfs pool import -f poolname" to the zfs_start_main() section  
> right after "zfs volinit".

A more graceful way is to run '/etc/rc.d/hostid start' before attempting
any zfs operations.

HTH,
Craig
Received on Wed Jun 20 2007 - 14:05:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:12 UTC