1.\" $NetBSD: sunlabel.8,v 1.3 2002/02/08 01:38:56 ross 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 January 12, 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 d Ar device 46.Op Fl mnqs 47.Op Ar device 48.Sh DESCRIPTION 49.Nm 50reads or modifies a 51.Tn Sun disk label on 52.Ar device . 53Either 54.Ar device 55or 56.Fl d Ar device 57must be specified on the command line. 58.Nm 59only reads/writes the first 512 bytes of 60.Ar device . 61.Pp 62The supported options are: 63.Bl -tag -width "-disk device" -offset indent 64.It Fl d Ar device 65Use 66.Ar device 67as target for the operations (in case 68.Ar device 69would start with a dash 70.Pq Sq \&- ) . 71.It Fl m 72Ignore an incorrect magic number in the disk label. 73.It Fl n 74Synthesize a new label rather than reading what is there. 75.It Fl q 76Quiet mode - don't print unnecessary babble (currently 77this suppresses the 78.Dq sunlabel\*[Gt] 79prompt). 80.It Fl s 81Ignore checksum errors when reading the label. 82.El 83.Pp 84Note that 85.Fl m 86is dangerous, especially when combined with 87.Fl s , 88since it will then happily believe whatever garbage it may 89find in the label. When using these flags, all values should be 90checked carefully, both those printed by 91.Ic L 92and the partition table printed by 93.Ic P . 94.Pp 95.Nm 96prints a prompt 97.Dq sunlabel\*[Gt] 98and expects commands. 99The following commands are understood: 100.Bl -tag -width 35n -offset indent -compact 101.It \&? 102Show a short help message. 103.It Ic [abcdefghijklmnop] Ar \*[Lt]cylno\*[Gt] Ar \*[Lt]size\*[Gt] 104Change partition (see below). 105.It Ic L 106Print label, except for the partition table. 107.It Ic P 108Print the partition table. 109.It Ic Q 110Quit program (error if no write since last change). 111.It Ic Q! 112Quit program (unconditionally) [EOF also quits]. 113.It Ic S 114Set label in the kernel (orthogonal to 115.Ic W ) . 116.It Ic V Ar \*[Lt]name\*[Gt] Ar \*[Lt]value\*[Gt] 117Change a non-partition label value. 118.It Ic W 119Write (possibly modified) label out. 120.El 121.Pp 122The 123.Ic a 124through 125.Ic p 126commands will accept, for the 127.Ar \*[Lt]size\*[Gt] 128parameter, the 129.Ar nnn/nnn/nnn 130syntax used by 131.Tn SunOS 4.x 132.Ic format . 133(For those not 134familiar with this syntax, 135.Ar a/b/c 136means 137.Ar a 138cylinders + 139.Ar b 140tracks + 141.Ar c 142sectors. For example, if the disk has 16 tracks of 32 sectors, 143.Ar 3/4/5 144means (3*16*32)+(4*32)+5=1669. This calculation always uses the 145.Ar nsect 146and 147.Ar ntrack 148values as printed by the 149.Ic L 150command; in particular, if they are zero (which they will initially be 151if 152.Fl n 153is used), this syntax is not very useful. Some additional strings are 154accepted. For the 155.Ar \*[Lt]cylno\*[Gt] 156parameter, 157.Dq end-X 158(where 159.Ar X 160is a partition letter) indicates that the partition should start with 161the first free cylinder after partition 162.Ar X ; 163.Dq start-X 164indicates that the partition should start at the same place as 165partition 166.Ar X . 167For the 168.Ar \*[Lt]size\*[Gt] 169parameter, 170.Dq end-X 171indicates that the partition should end at the same place as partition 172.Ar X 173(even if partition 174.Ar X 175ends partway through a cylinder); 176.Dq start-X 177indicates that the partition should end with the last cylinder before 178partition 179.Ar X ; 180and 181.Dq size-X 182means that the partition's size should exactly match partition 183.Ar X Ns No 's 184size. 185.Pp 186Note that 187.Nm 188supports 16 partitions. 189.Tn SunOS 190supports only 8. 191Labels written by 192.Nm "" , 193when partitions 194.Ar i 195through 196.Ar p 197are all set 198.Ar offset=0 size=0 , 199are identical to 200.Tn Sun 201labels. If any of the 202.Dq extended 203partitions are nontrivial, information about them is tucked into some 204otherwise unused space in the 205.Tn Sun 206label format. 207.Pp 208The 209.Ic V 210command changes fields printed by the 211.Ic L 212command. 213For example, if the 214.Ic L 215command prints 216.Bd -literal -offset indent 217ascii: ST15230N cyl 5657 alt 2 hd 19 sec 78 218rpm: 0 pcyl: 0 apc: 0 obs1: 0 219obs2: 0 intrlv: 1 ncyl: 5657 acyl: 0 220nhead: 19 nsect: 78 obs3: 0 obs4: 0 221.Ed 222.Pp 223then 224.Ic V Ar ncyl 6204 225would set the 226.Ar ncyl 227value to 6204, or 228.Ic V 229.Ar "ascii Seagate ST15230N cyl 5657 hd 19 sec varying" 230would set the ascii-label string to that string. 231.Nm 232performs very few consistency checks on the values you supply, and the 233ones it does perform never generate errors, only warnings. 234.Sh AUTHORS 235.An der Mouse Aq mouse@rodents.montreal.qc.ca 236.Sh BUGS 237It may be that the space in the label where the information for the 238extended partitions is saved is used by 239.Tn SunOS . 240.Pp 241Not very many consistency checks are done on the 242.Ic V 243arguments, and those only produce warnings. 244.Pp 245.Nx 246doesn't support 16 partitions in a 247.Tn Sun 248disk label yet. 249