xref: /freebsd/sys/contrib/openzfs/man/man8/zgenhostid.8 (revision 271171e0d97b88ba2a7c3bf750c9672b484c1c13)
1eda14cbcSMatt Macy.\"
2eda14cbcSMatt Macy.\" CDDL HEADER START
3eda14cbcSMatt Macy.\"
4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the
5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License").
6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License.
7eda14cbcSMatt Macy.\"
8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0.
10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions
11eda14cbcSMatt Macy.\" and limitations under the License.
12eda14cbcSMatt Macy.\"
13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each
14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the
16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying
17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner]
18eda14cbcSMatt Macy.\"
19eda14cbcSMatt Macy.\" CDDL HEADER END
20eda14cbcSMatt Macy.\"
21eda14cbcSMatt Macy.\" Copyright (c) 2017 by Lawrence Livermore National Security, LLC.
22eda14cbcSMatt Macy.\"
2316038816SMartin Matuska.Dd May 26, 2021
243ff01b23SMartin Matuska.Dt ZGENHOSTID 8
25eda14cbcSMatt Macy.Os
263ff01b23SMartin Matuska.
27eda14cbcSMatt Macy.Sh NAME
28eda14cbcSMatt Macy.Nm zgenhostid
293ff01b23SMartin Matuska.Nd generate host ID into /etc/hostid
30eda14cbcSMatt Macy.Sh SYNOPSIS
31eda14cbcSMatt Macy.Nm
322c48331dSMatt Macy.Op Fl f
332c48331dSMatt Macy.Op Fl o Ar filename
34eda14cbcSMatt Macy.Op Ar hostid
353ff01b23SMartin Matuska.
36eda14cbcSMatt Macy.Sh DESCRIPTION
372c48331dSMatt MacyCreates
382c48331dSMatt Macy.Pa /etc/hostid
393ff01b23SMartin Matuskafile and stores the host ID in it.
403ff01b23SMartin MatuskaIf
413ff01b23SMartin Matuska.Ar hostid
423ff01b23SMartin Matuskawas provided, validate and store that value.
433ff01b23SMartin MatuskaOtherwise, randomly generate an ID.
443ff01b23SMartin Matuska.
453ff01b23SMartin Matuska.Sh OPTIONS
463ff01b23SMartin Matuska.Bl -tag -width "-o filename"
472c48331dSMatt Macy.It Fl h
482c48331dSMatt MacyDisplay a summary of the command-line options.
492c48331dSMatt Macy.It Fl f
503ff01b23SMartin MatuskaAllow output overwrite.
512c48331dSMatt Macy.It Fl o Ar filename
522c48331dSMatt MacyWrite to
532c48331dSMatt Macy.Pa filename
543ff01b23SMartin Matuskainstead of the default
553ff01b23SMartin Matuska.Pa /etc/hostid .
562c48331dSMatt Macy.It Ar hostid
57eda14cbcSMatt MacySpecifies the value to be placed in
582c48331dSMatt Macy.Pa /etc/hostid .
597877fdebSMatt MacyIt should be a number with a value between 1 and 2^32-1.
603ff01b23SMartin MatuskaIf
613ff01b23SMartin Matuska.Sy 0 ,
623ff01b23SMartin Matuskagenerate a random ID.
632c48331dSMatt MacyThis value
643ff01b23SMartin Matuska.Em must
652c48331dSMatt Macybe unique among your systems.
662c48331dSMatt MacyIt
673ff01b23SMartin Matuska.Em must
683ff01b23SMartin Matuskabe an 8-digit-long hexadecimal number, optionally prefixed by
693ff01b23SMartin Matuska.Qq 0x .
702c48331dSMatt Macy.El
713ff01b23SMartin Matuska.
722c48331dSMatt Macy.Sh FILES
732c48331dSMatt Macy.Pa /etc/hostid
743ff01b23SMartin Matuska.
75eda14cbcSMatt Macy.Sh EXAMPLES
762c48331dSMatt Macy.Bl -tag -width Bd
77eda14cbcSMatt Macy.It Generate a random hostid and store it
783ff01b23SMartin Matuska.Dl # Nm
792c48331dSMatt Macy.It Record the libc-generated hostid in Pa /etc/hostid
803ff01b23SMartin Matuska.Dl # Nm Qq $ Ns Pq Nm hostid
813ff01b23SMartin Matuska.It Record a custom hostid Po Ar 0xdeadbeef Pc in Pa /etc/hostid
823ff01b23SMartin Matuska.Dl # Nm Ar deadbeef
83e92ffd9bSMartin Matuska.It Record a custom hostid Po Ar 0x01234567 Pc in Pa /tmp/hostid No and overwrite the file if it exists
843ff01b23SMartin Matuska.Dl # Nm Fl f o Ar /tmp/hostid 0x01234567
85eda14cbcSMatt Macy.El
863ff01b23SMartin Matuska.
87eda14cbcSMatt Macy.Sh SEE ALSO
88eda14cbcSMatt Macy.Xr genhostid 1 ,
89eda14cbcSMatt Macy.Xr hostid 1 ,
902c48331dSMatt Macy.Xr sethostid 3 ,
913ff01b23SMartin Matuska.Xr spl 4
923ff01b23SMartin Matuska.
932c48331dSMatt Macy.Sh HISTORY
942c48331dSMatt Macy.Nm
952c48331dSMatt Macyemulates the
962c48331dSMatt Macy.Xr genhostid 1
972c48331dSMatt Macyutility and is provided for use on systems which
9816038816SMartin Matuskado not include the utility or do not provide the
992c48331dSMatt Macy.Xr sethostid 3
1003ff01b23SMartin Matuskafunction.
101