xref: /netbsd-src/usr.sbin/sunlabel/sunlabel.8 (revision 01869ca4d24a86379a68731bf9706a9f0820fe4e)
1.\" $NetBSD: sunlabel.8,v 1.9 2017/07/03 21:35:32 wiz Exp $
2.\"
3.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Thomas Klausner.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd December 21, 2002
31.Dt SUNLABEL 8
32.Os
33.Sh NAME
34.Nm sunlabel
35.Nd read or modify a SunOS disk label
36.Sh SYNOPSIS
37.Nm
38.Op Fl mnqs
39.Ar device
40.Sh DESCRIPTION
41.Nm
42reads or modifies a
43.Tn SunOS
44disk label on
45.Ar device ,
46which is used by the
47.Tn PROM
48on
49.Nx Ns /sparc
50hardware to find partitions to boot from.
51.Nm
52only reads/writes the first 512 bytes of
53.Ar device .
54.Pp
55The supported options are:
56.Bl -tag -width 4n -offset indent
57.It Fl m
58Ignore an incorrect magic number in the disk label.
59.It Fl n
60Synthesize a new label rather than reading what is there.
61.It Fl q
62Quiet mode - don't print unnecessary babble (currently
63this suppresses the
64.Dq sunlabel>
65prompt).
66.It Fl s
67Ignore checksum errors when reading the label.
68.El
69.Pp
70Note that
71.Fl m
72is dangerous, especially when combined with
73.Fl s ,
74since it will then happily believe whatever garbage it may
75find in the label.  When using these flags, all values should be
76checked carefully, both those printed by
77.Ic L
78and the partition table printed by
79.Ic P .
80.Pp
81.Nm
82prints a prompt
83.Dq sunlabel>
84and expects commands.
85The following commands are understood:
86.Bl -tag -width 16n -offset indent
87.It \&?
88Show a short help message.
89.It Ic [abcdefghijklmnop] Ar <cylno> Ar <size>
90Change partition (see below).
91.It Ic L
92Print label, except for the partition table.
93.It Ic P
94Print the partition table.
95.It Ic Q
96Quit program (error if no write since last change).
97.It Ic Q!
98Quit program (unconditionally) [EOF also quits].
99.It Ic S
100Set label in the kernel (orthogonal to
101.Ic W ) .
102.It Ic V Ar <name> Ar <value>
103Change a non-partition label value.
104.It Ic W
105Write (possibly modified) label out.
106.El
107.Pp
108The
109.Ic a
110through
111.Ic p
112commands will accept, for the
113.Ar <size>
114parameter, the
115.Ar nnn/nnn/nnn
116syntax used by
117.Tn SunOS 4.x
118.Ic format .
119(For those not
120familiar with this syntax,
121.Ar a/b/c
122means
123.Ar a
124cylinders +
125.Ar b
126tracks +
127.Ar c
128sectors.  For example, if the disk has 16 tracks of 32 sectors,
129.Ar 3/4/5
130means (3*16*32)+(4*32)+5=1669.  This calculation always uses the
131.Ar nsect
132and
133.Ar ntrack
134values as printed by the
135.Ic L
136command; in particular, if they are zero (which they will initially be
137if
138.Fl n
139is used), this syntax is not very useful.  Some additional strings are
140accepted.  For the
141.Ar <cylno>
142parameter,
143.Dq end-X
144(where
145.Ar X
146is a partition letter) indicates that the partition should start with
147the first free cylinder after partition
148.Ar X ;
149.Dq start-X
150indicates that the partition should start at the same place as
151partition
152.Ar X .
153For the
154.Ar <size>
155parameter,
156.Dq end-X
157indicates that the partition should end at the same place as partition
158.Ar X
159(even if partition
160.Ar X
161ends partway through a cylinder);
162.Dq start-X
163indicates that the partition should end with the last cylinder before
164partition
165.Ar X ;
166and
167.Dq size-X
168means that the partition's size should exactly match partition
169.Ar X Ns No 's
170size.
171.Pp
172Note that
173.Nm
174supports 16 partitions.
175.Tn SunOS
176supports only 8.
177Labels written by
178.Nm ,
179when partitions
180.Ar i
181through
182.Ar p
183are all set
184.Ar offset=0 size=0 ,
185are identical to
186.Tn Sun
187labels.  If any of the
188.Dq extended
189partitions are nontrivial, information about them is tucked into some
190otherwise unused space in the
191.Tn Sun
192label format.
193.Pp
194The
195.Ic V
196command changes fields printed by the
197.Ic L
198command.
199For example, if the
200.Ic L
201command prints
202.Bd -literal -offset indent
203ascii: ST15230N cyl 5657 alt 2 hd 19 sec 78
204rpm: 0          pcyl: 0         apc: 0          obs1: 0
205obs2: 0         intrlv: 1       ncyl: 5657      acyl: 0
206nhead: 19       nsect: 78       obs3: 0         obs4: 0
207.Ed
208.Pp
209then
210.Ic V Ar ncyl 6204
211would set the
212.Ar ncyl
213value to 6204, or
214.Ic V
215.Ar "ascii Seagate ST15230N cyl 5657 hd 19 sec varying"
216would set the ascii-label string to that string.
217.Nm
218performs very few consistency checks on the values you supply, and the
219ones it does perform never generate errors, only warnings.
220.Sh AUTHORS
221.An der Mouse Aq Mt mouse@rodents.montreal.qc.ca
222.Sh BUGS
223It may be that the space in the label where the information for the
224extended partitions is saved is used by
225.Tn SunOS .
226.Pp
227Not very many consistency checks are done on the
228.Ic V
229arguments, and those only produce warnings.
230.Pp
231.Nx
232doesn't support 16 partitions in a
233.Tn Sun
234disk label yet.
235