/
sunlabel.8
234 lines (234 loc) · 5.77 KB
/
sunlabel.8
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
.\" $NetBSD: sunlabel.8,v 1.6 2008/04/30 13:11:03 martin Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Thomas Klausner.
.\"
.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 December 21, 2002
.Dt SUNLABEL 8
.Os
.Sh NAME
.Nm sunlabel
.Nd read or modify a SunOS disk label
.Sh SYNOPSIS
.Nm
.Op Fl mnqs
.Ar device
.Sh DESCRIPTION
.Nm
reads or modifies a
.Tn SunOS
disk label on
.Ar device ,
which is used by the
.Tn PROM
on
.Nx Ns /sparc
hardware to find partitions to boot from.
.Nm
only reads/writes the first 512 bytes of
.Ar device .
.Pp
The supported options are:
.Bl -tag -width 4n -offset indent
.It Fl m
Ignore an incorrect magic number in the disk label.
.It Fl n
Synthesize a new label rather than reading what is there.
.It Fl q
Quiet mode - don't print unnecessary babble (currently
this suppresses the
.Dq sunlabel\*[Gt]
prompt).
.It Fl s
Ignore checksum errors when reading the label.
.El
.Pp
Note that
.Fl m
is dangerous, especially when combined with
.Fl s ,
since it will then happily believe whatever garbage it may
find in the label. When using these flags, all values should be
checked carefully, both those printed by
.Ic L
and the partition table printed by
.Ic P .
.Pp
.Nm
prints a prompt
.Dq sunlabel\*[Gt]
and expects commands.
The following commands are understood:
.Bl -tag -width 16n -offset indent
.It \&?
Show a short help message.
.It Ic [abcdefghijklmnop] Ar \*[Lt]cylno\*[Gt] Ar \*[Lt]size\*[Gt]
Change partition (see below).
.It Ic L
Print label, except for the partition table.
.It Ic P
Print the partition table.
.It Ic Q
Quit program (error if no write since last change).
.It Ic Q!
Quit program (unconditionally) [EOF also quits].
.It Ic S
Set label in the kernel (orthogonal to
.Ic W ) .
.It Ic V Ar \*[Lt]name\*[Gt] Ar \*[Lt]value\*[Gt]
Change a non-partition label value.
.It Ic W
Write (possibly modified) label out.
.El
.Pp
The
.Ic a
through
.Ic p
commands will accept, for the
.Ar \*[Lt]size\*[Gt]
parameter, the
.Ar nnn/nnn/nnn
syntax used by
.Tn SunOS 4.x
.Ic format .
(For those not
familiar with this syntax,
.Ar a/b/c
means
.Ar a
cylinders +
.Ar b
tracks +
.Ar c
sectors. For example, if the disk has 16 tracks of 32 sectors,
.Ar 3/4/5
means (3*16*32)+(4*32)+5=1669. This calculation always uses the
.Ar nsect
and
.Ar ntrack
values as printed by the
.Ic L
command; in particular, if they are zero (which they will initially be
if
.Fl n
is used), this syntax is not very useful. Some additional strings are
accepted. For the
.Ar \*[Lt]cylno\*[Gt]
parameter,
.Dq end-X
(where
.Ar X
is a partition letter) indicates that the partition should start with
the first free cylinder after partition
.Ar X ;
.Dq start-X
indicates that the partition should start at the same place as
partition
.Ar X .
For the
.Ar \*[Lt]size\*[Gt]
parameter,
.Dq end-X
indicates that the partition should end at the same place as partition
.Ar X
(even if partition
.Ar X
ends partway through a cylinder);
.Dq start-X
indicates that the partition should end with the last cylinder before
partition
.Ar X ;
and
.Dq size-X
means that the partition's size should exactly match partition
.Ar X Ns No 's
size.
.Pp
Note that
.Nm
supports 16 partitions.
.Tn SunOS
supports only 8.
Labels written by
.Nm ,
when partitions
.Ar i
through
.Ar p
are all set
.Ar offset=0 size=0 ,
are identical to
.Tn Sun
labels. If any of the
.Dq extended
partitions are nontrivial, information about them is tucked into some
otherwise unused space in the
.Tn Sun
label format.
.Pp
The
.Ic V
command changes fields printed by the
.Ic L
command.
For example, if the
.Ic L
command prints
.Bd -literal -offset indent
ascii: ST15230N cyl 5657 alt 2 hd 19 sec 78
rpm: 0 pcyl: 0 apc: 0 obs1: 0
obs2: 0 intrlv: 1 ncyl: 5657 acyl: 0
nhead: 19 nsect: 78 obs3: 0 obs4: 0
.Ed
.Pp
then
.Ic V Ar ncyl 6204
would set the
.Ar ncyl
value to 6204, or
.Ic V
.Ar "ascii Seagate ST15230N cyl 5657 hd 19 sec varying"
would set the ascii-label string to that string.
.Nm
performs very few consistency checks on the values you supply, and the
ones it does perform never generate errors, only warnings.
.Sh AUTHORS
.An der Mouse Aq mouse@rodents.montreal.qc.ca
.Sh BUGS
It may be that the space in the label where the information for the
extended partitions is saved is used by
.Tn SunOS .
.Pp
Not very many consistency checks are done on the
.Ic V
arguments, and those only produce warnings.
.Pp
.Nx
doesn't support 16 partitions in a
.Tn Sun
disk label yet.