From owner-freebsd-current@FreeBSD.ORG Wed Jun 20 16:05:23 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A86A816A41F for ; Wed, 20 Jun 2007 16:05:23 +0000 (UTC) (envelope-from craig@xfoil.gank.org) Received: from ion.gank.org (ion.gank.org [69.55.238.164]) by mx1.freebsd.org (Postfix) with ESMTP id 9183713C4BA for ; Wed, 20 Jun 2007 16:05:21 +0000 (UTC) (envelope-from craig@xfoil.gank.org) Received: by ion.gank.org (Postfix, from userid 1001) id 4EF9111A7C; Wed, 20 Jun 2007 11:05:21 -0500 (CDT) Date: Wed, 20 Jun 2007 11:05:18 -0500 From: Craig Boston To: Borja Marcos Message-ID: <20070620160518.GA887@nowhere> Mail-Followup-To: Craig Boston , Borja Marcos , freebsd-current@freebsd.org References: <4E1E93FB-31D2-4F38-9979-946935BE0729@sarenet.es> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E1E93FB-31D2-4F38-9979-946935BE0729@sarenet.es> User-Agent: Mutt/1.4.2.3i Cc: freebsd-current@freebsd.org Subject: Re: ZFS does not load and mount at boot time X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jun 2007 16:05:23 -0000 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