Re: ZFS does not load and mount at boot time

From: Borja Marcos <borjamar_at_sarenet.es>
Date: Wed, 20 Jun 2007 11:57:07 +0200
> I have now moved zfs.cache to /etc/zfs and load the module via  
> rc.conf. I
> have also included the saving of zfs.cache on /cfg in "zfs stop"  
> and set
> KEYWORD: shutdown for zfs. However, I still get
>
> ZFS: WARNING: pool 'tank' could not be loaded as it was last  
> accessed by
> another system (host: eclipse.aei.uni-hannover.de hostid: 0xf7ab4bd6).
> See: http://www.sun.com/msg/ZFS-8000-EY
>
> when booting. Any further ideas?
>

Yes. I've run into the same problem when installing a new machine  
with the June FreeBSD 7 snapshot, cvsupping yesterday, and trying to  
set up /usr and /var in ZFS.

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.

I had booted into multiuser, created a pool, and created three  
filesystems, say zfs/usr, zfs/var and zfs/home.

After copying /var, /usr and /home to the new zfs filesystems, I  
rebooted in single user in order to edit /etc/fstab to remove the  
references to them and change the ZFS mountpoints to the proper  
places, and I've run across the same problem. The ZFS pool was  
labelled with the hostname (still not set) and the hostid (still not  
set, as the network interfaces are initialised *AFTER* the  
filesystems are mounted).

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".

zfs_start_main()
{
         zfs volinit
         zpool import -f pruebazfs
         zfs mount -a
         zfs share -a
         if [ ! -r /etc/zfs/exports ]; then
                 touch /etc/zfs/exports
         fi


Ugly but it works. It seems it's necessary to either rethink that ZFS  
behavior (which is desirable), or set the hostname as soon as  
possible. Regarding the hostid, it's trickier than it seems. But  
anyway I don't think it's a good idea to use an IP address (which of  
them?) as a hostid. A simple IP address change could be quite  
confusing for an unaware administrator.





Borja.







----------------
"The thing he realised about the windows was this: because they had  
been converted into openable windows after they had first been  
designed to be impregnable, they were, in fact, much less secure than  
if they had been designed as openable windows in the first place."
    Douglas Adams, "Mostly Harmless"
Received on Wed Jun 20 2007 - 08:27:34 UTC

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