diff --git a/usr.sbin/sunlabel/Makefile b/usr.sbin/sunlabel/Makefile index c782acfeb008..c9e9817ce787 100644 --- a/usr.sbin/sunlabel/Makefile +++ b/usr.sbin/sunlabel/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.1 2002/01/10 16:24:41 mrg Exp $ +# $NetBSD: Makefile,v 1.2 2002/01/15 00:57:27 wiz Exp $ PROG= sunlabel -NOMAN= # sunlabel.8 +MAN= sunlabel.8 LDADD+= -ltermcap -lutil DPADD+= ${LIBTERMCAP} ${LIBUTIL} diff --git a/usr.sbin/sunlabel/sunlabel.8 b/usr.sbin/sunlabel/sunlabel.8 new file mode 100644 index 000000000000..4ae5d8e7a445 --- /dev/null +++ b/usr.sbin/sunlabel/sunlabel.8 @@ -0,0 +1,246 @@ +.\" $NetBSD: sunlabel.8,v 1.1 2002/01/15 00:57:27 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" 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 January 12, 2002 +.Dt SUNLABEL 8 +.Os +.Sh NAME +.Nm sunlabel +.Nd read or modify a SunOS disk label +.Sh SYNOPSIS +.Nm +.Op Fl disk Ar device +.Op Fl fixmagic +.Op Fl fixsum +.Op Fl new +.Op Fl q +.Ar device +.Sh DESCRIPTION +.Nm +reads or modifies a +.Tn Sun disk label on +.Ar device . +.Nm +only reads/writes the first 512 bytes of +.Ar device . +.Pp +The supported options are: +.Bl -tag -width "-disk device" -offset indent +.It Fl disk Ar device +Use +.Ar device +as target for the operations (in case +.Ar device +would start with a dash +.Pq Sq \&- ) . +.It Fl fixmagic +Ignore an incorrect magic number in the disk label. +.It Fl fixsum +Ignore checksum errors when reading the label. +.It Fl new +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). +.El +.Pp +Note that +.Fl fixmagic +is dangerous, especially when combined with +.Fl fixsum , +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 35n -offset indent -compact +.It \&? +Show a short help message. +.It Ic [abcdefghijklmnop] Ar Ar +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 Ar +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 +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 new +is used), this syntax is not very useful. Some additional strings are +accepted. For the +.Ar +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 +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.