xref: /freebsd/sys/contrib/openzfs/man/man8/zgenhostid.8 (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or http://www.opensolaris.org/os/licensing.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
21.\"
22.\" Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
23.\"
24.Dd September 13, 2020
25.Dt ZGENHOSTID 8 SMM
26.Os
27.Sh NAME
28.Nm zgenhostid
29.Nd generate and store a hostid in
30.Em /etc/hostid
31.Sh SYNOPSIS
32.Nm
33.Op Fl f
34.Op Fl o Ar filename
35.Op Ar hostid
36.Sh DESCRIPTION
37Creates
38.Pa /etc/hostid
39file and stores hostid in it.
40If the user provides
41.Op Ar hostid
42on the command line, validates and stores that value.
43Otherwise, randomly generates a value to store.
44.Bl -tag -width "hostid"
45.It Fl h
46Display a summary of the command-line options.
47.It Fl f
48Force file overwrite.
49.It Fl o Ar filename
50Write to
51.Pa filename
52instead of default
53.Pa /etc/hostd
54.It Ar hostid
55Specifies the value to be placed in
56.Pa /etc/hostid .
57It should be a number with a value between 1 and 2^32-1.
58If it is 0, zgenhostid will generate a random hostid.
59This value
60.Sy must
61be unique among your systems.
62It
63.Sy must
64be expressed in hexadecimal and be exactly
65.Em 8
66digits long, optionally prefixed by
67.Em 0x .
68.El
69.Sh FILES
70.Pa /etc/hostid
71.Sh EXAMPLES
72.Bl -tag -width Bd
73.It Generate a random hostid and store it
74.Bd -literal
75# zgenhostid
76.Ed
77.It Record the libc-generated hostid in Pa /etc/hostid
78.Bd -literal
79# zgenhostid "$(hostid)"
80.Ed
81.It Record a custom hostid (0xdeadbeef) in Pa /etc/hostid
82.Bd -literal
83# zgenhostid deadbeef
84.Ed
85.It Record a custom hostid (0x01234567) in Pa /tmp/hostid
86and ovewrite the file if it exists
87.Bd -literal
88# zgenhostid -f -o /tmp/hostid 0x01234567
89.Ed
90.El
91.Sh SEE ALSO
92.Xr genhostid 1 ,
93.Xr hostid 1 ,
94.Xr sethostid 3 ,
95.Xr spl-module-parameters 5
96.Sh HISTORY
97.Nm
98emulates the
99.Xr genhostid 1
100utility and is provided for use on systems which
101do not include the utility or do not provide
102.Xr sethostid 3
103call.
104