xref: /freebsd/sys/contrib/openzfs/man/man8/zgenhostid.8 (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
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 https://opensource.org/licenses/CDDL-1.0.
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.\" Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
22.\"
23.Dd May 26, 2021
24.Dt ZGENHOSTID 8
25.Os
26.
27.Sh NAME
28.Nm zgenhostid
29.Nd generate host ID into /etc/hostid
30.Sh SYNOPSIS
31.Nm
32.Op Fl f
33.Op Fl o Ar filename
34.Op Ar hostid
35.
36.Sh DESCRIPTION
37Creates
38.Pa /etc/hostid
39file and stores the host ID in it.
40If
41.Ar hostid
42was provided, validate and store that value.
43Otherwise, randomly generate an ID.
44.
45.Sh OPTIONS
46.Bl -tag -width "-o filename"
47.It Fl h
48Display a summary of the command-line options.
49.It Fl f
50Allow output overwrite.
51.It Fl o Ar filename
52Write to
53.Pa filename
54instead of the default
55.Pa /etc/hostid .
56.It Ar hostid
57Specifies the value to be placed in
58.Pa /etc/hostid .
59It should be a number with a value between 1 and 2^32-1.
60If
61.Sy 0 ,
62generate a random ID.
63This value
64.Em must
65be unique among your systems.
66It
67.Em must
68be an 8-digit-long hexadecimal number, optionally prefixed by
69.Qq 0x .
70.El
71.
72.Sh FILES
73.Pa /etc/hostid
74.
75.Sh EXAMPLES
76.Bl -tag -width Bd
77.It Generate a random hostid and store it
78.Dl # Nm
79.It Record the libc-generated hostid in Pa /etc/hostid
80.Dl # Nm Qq $ Ns Pq Nm hostid
81.It Record a custom hostid Po Ar 0xdeadbeef Pc in Pa /etc/hostid
82.Dl # Nm Ar deadbeef
83.It Record a custom hostid Po Ar 0x01234567 Pc in Pa /tmp/hostid No and overwrite the file if it exists
84.Dl # Nm Fl f o Ar /tmp/hostid 0x01234567
85.El
86.
87.Sh SEE ALSO
88.Xr genhostid 1 ,
89.Xr hostid 1 ,
90.Xr sethostid 3 ,
91.Xr spl 4
92.
93.Sh HISTORY
94.Nm
95emulates the
96.Xr genhostid 1
97utility and is provided for use on systems which
98do not include the utility or do not provide the
99.Xr sethostid 3
100function.
101