DOKK / manpages / debian 11 / zfsutils-linux / zgenhostid.8.en
ZGENHOSTID(8) System Manager's Manual (smm) ZGENHOSTID(8)

zgenhostidgenerate and store a hostid in

zgenhostid [-f] [-o filename] [hostid]

Creates /etc/hostid file and stores hostid in it. If the user provides [hostid] on the command line, validates and stores that value. Otherwise, randomly generates a value to store.

Display a summary of the command-line options.
Force file overwrite.
filename
Write to filename instead of default /etc/hostd
hostid
Specifies the value to be placed in /etc/hostid. It should be a number with a value between 1 and 2^32-1. If it is 0, zgenhostid will generate a random hostid. This value must be unique among your systems. It must be expressed in hexadecimal and be exactly digits long, optionally prefixed by .

/etc/hostid

Generate a random hostid and store it
# zgenhostid
Record the libc-generated hostid in /etc/hostid
# zgenhostid "$(hostid)"
Record a custom hostid (0xdeadbeef) in /etc/hostid
# zgenhostid deadbeef
Record a custom hostid (0x01234567) in /tmp/hostid
and ovewrite the file if it exists
# zgenhostid -f -o /tmp/hostid 0x01234567

genhostid(1), hostid(1), sethostid(3), spl-module-parameters(5)

zgenhostid emulates the genhostid(1) utility and is provided for use on systems which do not include the utility or do not provide sethostid(3) call.

September 13, 2020 Linux