| 1 | .\" Copyright (c) 1987, 1988 Regents of the University of California. |
| 2 | .\" All rights reserved. |
| 3 | .\" |
| 4 | .\" This code is derived from software contributed to Berkeley by |
| 5 | .\" Symmetric Computer Systems. |
| 6 | .\" |
| 7 | .\" Redistribution and use in source and binary forms, with or without |
| 8 | .\" modification, are permitted provided that the following conditions |
| 9 | .\" are met: |
| 10 | .\" 1. Redistributions of source code must retain the above copyright |
| 11 | .\" notice, this list of conditions and the following disclaimer. |
| 12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 13 | .\" notice, this list of conditions and the following disclaimer in the |
| 14 | .\" documentation and/or other materials provided with the distribution. |
| 15 | .\" 3. All advertising materials mentioning features or use of this software |
| 16 | .\" must display the following acknowledgement: |
| 17 | .\" This product includes software developed by the University of |
| 18 | .\" California, Berkeley and its contributors. |
| 19 | .\" 4. Neither the name of the University nor the names of its contributors |
| 20 | .\" may be used to endorse or promote products derived from this software |
| 21 | .\" without specific prior written permission. |
| 22 | .\" |
| 23 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 24 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 25 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 26 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 27 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 28 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 29 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 30 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 31 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | .\" SUCH DAMAGE. |
| 34 | .\" |
| 35 | .\" @(#)disklabel.8 6.8 (Berkeley) 6/24/90 |
| 36 | .\" |
| 37 | .TH DISKLABEL 8 "June 24, 1990" |
| 38 | .UC 5 |
| 39 | .SH NAME |
| 40 | disklabel \- read and write disk pack label |
| 41 | .SH SYNOPSIS |
| 42 | .B disklabel |
| 43 | [ |
| 44 | .B \-r |
| 45 | ] |
| 46 | .I disk |
| 47 | .br |
| 48 | .B disklabel \-w |
| 49 | [ |
| 50 | .B \-r |
| 51 | ] |
| 52 | .I disk |
| 53 | .I disktype |
| 54 | [ |
| 55 | .I packid |
| 56 | [ |
| 57 | .I priboot secboot |
| 58 | ] ] |
| 59 | .br |
| 60 | .B disklabel \-e |
| 61 | [ |
| 62 | .B \-r |
| 63 | ] |
| 64 | .I disk |
| 65 | .br |
| 66 | .B disklabel \-R |
| 67 | [ |
| 68 | .B \-r |
| 69 | ] |
| 70 | .I disk protofile |
| 71 | [ |
| 72 | .I priboot secboot |
| 73 | ] |
| 74 | .br |
| 75 | .B disklabel |
| 76 | [ |
| 77 | .B \-NW |
| 78 | ] |
| 79 | .I disk |
| 80 | .SH DESCRIPTION |
| 81 | .I Disklabel |
| 82 | can be used to install, examine or modify the label on a disk drive or pack. |
| 83 | When writing the label, it can be used |
| 84 | to change the drive identification, |
| 85 | the disk partitions on the drive, |
| 86 | or to replace a damaged label or bootstrap. |
| 87 | The disk label is located on one of the first sectors |
| 88 | of each disk (usually block 0). |
| 89 | On machines that require a block-0 bootstrap (VAX 11/750), |
| 90 | the label is inserted into the bootstrap program. |
| 91 | This information is used by the system disk driver and by the bootstrap |
| 92 | program to determine how to program the drive. |
| 93 | There are several forms of the command that display, install or modify |
| 94 | the label on a disk. |
| 95 | Each form has an additional option, |
| 96 | .BR \-r , |
| 97 | which causes the label to be read from or written to the disk directly, |
| 98 | rather than going through the system's in-core copy of the label. |
| 99 | When writing, the in-core copy is also updated if possible. |
| 100 | This option may allow a label to be installed on a disk |
| 101 | without kernel support for a label, such as when labels are first installed |
| 102 | on a system; it must be used when first installing a label on a disk. |
| 103 | .PP |
| 104 | The first form of the command is used to examine the label on the named |
| 105 | disk drive (e.g. hp0 or /dev/rhp0c). |
| 106 | It will display all of the parameters associated with the drive |
| 107 | and its partition layout. |
| 108 | Unless the |
| 109 | .B \-r |
| 110 | flag is given, |
| 111 | the kernel's in-core copy of the label is displayed; |
| 112 | if the disk has no label, or the partition types on the disk are incorrect, |
| 113 | the kernel may have constructed or modified the label. |
| 114 | If the |
| 115 | .B \-r |
| 116 | flag is given, the label from the raw disk will be displayed rather |
| 117 | than the in-core label. |
| 118 | .PP |
| 119 | The second form of the command, with the |
| 120 | .B \-w |
| 121 | flag, is used to write a standard label on the designated drive. |
| 122 | The required arguments to |
| 123 | .I disklabel |
| 124 | are the drive to be labelled (e.g. hp0), and |
| 125 | the drive type as described in the |
| 126 | .IR disktab (5) |
| 127 | file. |
| 128 | The drive parameters and partitions are taken from that file. |
| 129 | If different disks of the same physical type are to have different |
| 130 | partitions, it will be necessary to have separate disktab entries |
| 131 | describing each, or to edit the label after installation as described below. |
| 132 | The first optional argument is a pack identification string, |
| 133 | up to 16 characters long. |
| 134 | The pack id must be quoted if it contains blanks. |
| 135 | If the |
| 136 | .B \-r |
| 137 | flag is given, the disk sectors containing the label and bootstrap |
| 138 | will be written directly, |
| 139 | otherwise the existing label will be updated in place without modifying |
| 140 | the bootstrap. |
| 141 | If the disk does not already have a label, the |
| 142 | .B \-r |
| 143 | flag must be used. |
| 144 | In either case, the kernel's in-core label is replaced. |
| 145 | .PP |
| 146 | Alternate versions of the bootstrap files may be specified |
| 147 | after the pack identifier. |
| 148 | If an alternate bootstrap is not specified, the standard bootstrap will be used. |
| 149 | The bootstrap programs are located in |
| 150 | .IR /usr/mdec . |
| 151 | The names of the bootstrap programs may be specified in |
| 152 | .IR disktab (5); |
| 153 | if not specified, |
| 154 | the default names are of the form |
| 155 | .IR basename boot |
| 156 | for the primary (block 0) bootstrap, and |
| 157 | .RI boot basename |
| 158 | for the secondary (block 1-15) bootstrap; |
| 159 | for example, /usr/mdec/hpboot and /usr/mdec/boothp |
| 160 | if the disk device is |
| 161 | .BR hp0 . |
| 162 | .PP |
| 163 | An existing disk label may be edited by using the |
| 164 | .B \-e |
| 165 | flag. |
| 166 | The label is read from the in-core kernel copy, |
| 167 | or directly from the disk if the |
| 168 | .B \-r |
| 169 | flag is also given. |
| 170 | The label is formatted and then supplied to an editor for changes. |
| 171 | If no editor is specified in an EDITOR environment variable, |
| 172 | .IR vi (1) |
| 173 | is used. |
| 174 | When the editor terminates, the formatted label is reread |
| 175 | and used to rewrite the disk label. |
| 176 | .PP |
| 177 | With the |
| 178 | .B \-R |
| 179 | flag, |
| 180 | .I disklabel |
| 181 | is capable of restoring a disk label that was formatted |
| 182 | in a prior operation and saved in an ascii file. |
| 183 | The prototype file used to create the label should be in the same format |
| 184 | as that produced when reading or editing a label. |
| 185 | Comments are delimited by |
| 186 | .B # |
| 187 | and newline. |
| 188 | If the |
| 189 | .B \-r |
| 190 | option is also given, |
| 191 | a block-0 bootstrap is installed on machines that use one; |
| 192 | either the disktype or the names of the bootstrap files must be specified |
| 193 | on such machines. |
| 194 | .PP |
| 195 | Finally, the \fB-NW\fP flags for \fIdisklabel\fP explicitly disallow and |
| 196 | allow, respectively, writing of the pack label area on the selected disk. |
| 197 | .SH FILES |
| 198 | /etc/disktab |
| 199 | .br |
| 200 | /usr/mdec/\fIxx\fPboot |
| 201 | .br |
| 202 | /usr/mdec/boot\fIxx\fP |
| 203 | .SH "SEE ALSO" |
| 204 | disktab(5), disklabel(5) |
| 205 | .SH DIAGNOSTICS |
| 206 | The kernel device drivers will not allow the size of a disk partition |
| 207 | to be decreased or the offset of a partition to be changed while it is open. |
| 208 | Some device drivers create a label containing only a single large partition |
| 209 | if a disk is unlabeled; thus, the label must be written to the ``a'' |
| 210 | partition of the disk while it is open. |
| 211 | This sometimes requires the desired label to be set in two steps, |
| 212 | the first one creating at least one other partition, |
| 213 | and the second setting the label on the new partition |
| 214 | while shrinking the ``a'' partition. |
| 215 | .SH BUGS |
| 216 | When a disk name is given without a full pathname, |
| 217 | the constructed device name uses the ``c'' partition on the vax |
| 218 | and the ``a'' partition on the tahoe. |