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