1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
.\" Copyright (c) 2014 Andriy Gapon <avg@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd July 20, 2018
.Dt GPTZFSBOOT 5
.Os
.Sh NAME
.Nm gptzfsboot
.Nd disk bootcode for BIOS-based computers
.Sh DESCRIPTION
.Nm
is used on BIOS-based computers to boot from a filesystem on disk device.
Depending on disk partitioning and boot file system, the
.Nm
is installed in a
.Cm zfs pool boot area
or
.Cm boot
partition of a disk with
.Xr installboot 1M .
.Ss IMPLEMENTATION NOTES
The GPT standard allows a variable number of partitions, but
.Nm
only boots from tables with 128 partitions or less.
.Ss BOOTING
.Nm
tries to find all ZFS pools that are composed of BIOS-visible
hard disks or partitions on them.
.Nm
looks for ZFS device labels on all visible disks and in discovered
supported partitions for all supported partition scheme types.
Disks are probed in BIOS defined order.
After a disk is probed and
.Nm
determines that the whole disk is not a ZFS pool member, the
individual partitions are probed in their partition table order.
Currently GPT and MBR partition schemes are supported.
.Pp
The default boot partition is recorded into
.Nm
binary by
.Xr installboot 1M
and the default boot file system is determined at run time.
.Nm
does support booting from the
.Cm ZFS ,
.Cm UFS
and
.Cm PCFS
file systems.
.Pp
The filesystem specified by the
.Cm bootfs
property of the ZFS pool is used as a default boot filesystem.
If the
.Cm bootfs
property is not set, then the root filesystem of the pool is used as
the default.
.Xr loader 5
is loaded from the boot filesystem.
If
.Pa /boot/config
is present in the boot filesystem, boot options are read from it.
.Pp
The ZFS GUIDs of the boot pool and boot file system are made available to
.Xr loader 5 .
.Ss USAGE
Normally
.Nm
will boot in fully automatic mode.
However, it is possible to interrupt the automatic boot process and
interact with
.Nm
through a prompt.
.Pp
The filesystem specification and the path to
.Xr loader 5
is specified as
.Pp
.Sm off
.Oo zfs:pool/filesystem: Oc Oo /path/to/loader Oc
.Sm on
.Pp
Both the filesystem and the path can be specified.
If only a path is specified, then the default filesystem is used.
If only a pool and filesystem are specified, then
.Pa /boot/loader
is used as a path.
.Pp
Additionally, the
.Nm
does support two commands to get information about the system.
.Ic ?directoryname
can be used to list the content of named directory and
.Ic status
command can be used to query information about discovered devices.
The output format for ZFS pools is similar to that of
.Cm zpool status
.Pq see Xr zpool 1M .
.Pp
The configured or automatically determined ZFS boot filesystem is
stored in the
.Xr loader 5
.Cm loaddev
variable, and also set as the initial value of the
.Cm currdev
variable.
.Sh FILES
.Bl -tag -width /boot/gptzfsboot -compact
.It Pa /boot/config
parameters for the boot block
.Pq optional
.It Pa /boot/gptzfsboot
boot code binary
.El
.Sh EXAMPLES
.Nm
is installed in combination with a
.Dq protective MBR
.Po
see
.Xr installboot 1M
.Pc .
To install
.Nm
on the
.Pa c0t0d0s0
drive:
.Bd -literal -offset indent
installboot /boot/pmbr /boot/gptzfsboot /dev/rdsk/c0t0d0s0
.Ed
.Sh SEE ALSO
.Xr installboot 1M ,
.Xr zpool 1M ,
.Xr loader 5 ,
.Xr loader 5
|