[Pkg-zfsonlinux-devel] Comparing the Debian and Ubuntu version of spl-linux

Turbo Fredriksson turbo at bayour.com
Wed Sep 28 12:58:47 UTC 2016


On Sep 28, 2016, at 8:08 AM, Petter Reinholdtsen wrote:

> Another and related question.  Is it really a good idea to store the
> current value returned by gethostid() in /etc/hostid?

My opinion is, and have always been, that the hostid is NOT needed
on Linux. A couple of years ago me and Brian talked about removing
it altogether and instead probe for devices.

Which is "The Linux Way(™)"..

That was the reason for my extensive work on the initrd, sysv and
dracut work to make sure we find the devices needed.


The hostid value is/was supposed to be an indicator that the pool
isn't imported on another host.

This can be a problem under (at least) these conditions:

  1. You're importing a pool with devices from a SAN/NAS.
  2. You're dual-booting different dists/operating systems.

People that would have a problem with any of this is in minority,
which is why I think it's better to work for the large majority,
rather than the minority.

My initrd/sysv/dracut scripts takes this into account by having
those that might have a problem with this specifying their pools
manually in the /etc/default/zfs.

> The value is
> derived from the current IP address via the current hostname according
> to the gethostid() manual page, and that mean it will be the same across
> many machines behind NAT or otherwise on a private IP range commonly
> used on home routers (like 192.168.*).

The value isn't intended to be unique across the world, just across
'your own' network - make sure that the pool(s) haven't already been
imported by another host (see above).

That's the only thing it's used for - 'zpool import' will look at the
hostid value recorded in the pool and compare that with the value in
/etc/hostid and if they don't match, refuse a verbatim import. To override
and import anyway, a 'force' needs to be specified, in which the new
(system) value will be recorded in the pool.
--
Imagine you're an idiot and then imagine you're in
the government. Oh, sorry. Now I'm repeating myself
- Mark Twain




More information about the Pkg-zfsonlinux-devel mailing list