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