Host ID.

Pawel Jakub Dawidek pjd at
Sat Apr 7 12:07:13 UTC 2007


After initial discussion on IRC, I'd like to propose an addition...
I want to use it with ZFS, but I thought it may be useful in general, so
here it goes:

I'd like to assign a unique ID to the system on first boot.

When system starts, /etc/rc.d/hostid script checks if /hostid file
exists, if it doesn't, it creates it via 'uuidgen > /hostid'.

It will also set kern.hostuuid sysctl to this value and first four bytes
of MD5(kern.hostuuid) will be stored in kern.hostid. It will allow to
use gethostid(3).

If root file system is read-only, different uuid will be genrated on
each boot. Not sure if anything better can be done here.

As I said, I think it may be genrally useful. Imagine using it with
magic/variant symlinks, for example.


Pawel Jakub Dawidek             
pjd at                 
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-arch mailing list