\" $NetBSD: sunlabel.8,v 1.9 2017/07/03 21:35:32 wiz 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>
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>
and expects commands.
The following commands are understood:
Bl -tag -width 16n -offset indent
It \&?
Show a short help message.
It Ic [abcdefghijklmnop] Ar <cylno> Ar <size>
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 <name> Ar <value>
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 <size>
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 <cylno>
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 <size>
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 Mt
[email protected]
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.