386BSD 0.1 development
[unix-history] / usr / src / sbin / disklabel / disklabel.8
CommitLineData
8abe9382
WJ
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
40disklabel \- 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
82can be used to install, examine or modify the label on a disk drive or pack.
83When writing the label, it can be used
84to change the drive identification,
85the disk partitions on the drive,
86or to replace a damaged label or bootstrap.
87The disk label is located on one of the first sectors
88of each disk (usually block 0).
89On machines that require a block-0 bootstrap (VAX 11/750),
90the label is inserted into the bootstrap program.
91This information is used by the system disk driver and by the bootstrap
92program to determine how to program the drive.
93There are several forms of the command that display, install or modify
94the label on a disk.
95Each form has an additional option,
96.BR \-r ,
97which causes the label to be read from or written to the disk directly,
98rather than going through the system's in-core copy of the label.
99When writing, the in-core copy is also updated if possible.
100This option may allow a label to be installed on a disk
101without kernel support for a label, such as when labels are first installed
102on a system; it must be used when first installing a label on a disk.
103.PP
104The first form of the command is used to examine the label on the named
105disk drive (e.g. hp0 or /dev/rhp0c).
106It will display all of the parameters associated with the drive
107and its partition layout.
108Unless the
109.B \-r
110flag is given,
111the kernel's in-core copy of the label is displayed;
112if the disk has no label, or the partition types on the disk are incorrect,
113the kernel may have constructed or modified the label.
114If the
115.B \-r
116flag is given, the label from the raw disk will be displayed rather
117than the in-core label.
118.PP
119The second form of the command, with the
120.B \-w
121flag, is used to write a standard label on the designated drive.
122The required arguments to
123.I disklabel
124are the drive to be labelled (e.g. hp0), and
125the drive type as described in the
126.IR disktab (5)
127file.
128The drive parameters and partitions are taken from that file.
129If different disks of the same physical type are to have different
130partitions, it will be necessary to have separate disktab entries
131describing each, or to edit the label after installation as described below.
132The first optional argument is a pack identification string,
133up to 16 characters long.
134The pack id must be quoted if it contains blanks.
135If the
136.B \-r
137flag is given, the disk sectors containing the label and bootstrap
138will be written directly,
139otherwise the existing label will be updated in place without modifying
140the bootstrap.
141If the disk does not already have a label, the
142.B \-r
143flag must be used.
144In either case, the kernel's in-core label is replaced.
145.PP
146Alternate versions of the bootstrap files may be specified
147after the pack identifier.
148If an alternate bootstrap is not specified, the standard bootstrap will be used.
149The bootstrap programs are located in
150.IR /usr/mdec .
151The names of the bootstrap programs may be specified in
152.IR disktab (5);
153if not specified,
154the default names are of the form
155.IR basename boot
156for the primary (block 0) bootstrap, and
157.RI boot basename
158for the secondary (block 1-15) bootstrap;
159for example, /usr/mdec/hpboot and /usr/mdec/boothp
160if the disk device is
161.BR hp0 .
162.PP
163An existing disk label may be edited by using the
164.B \-e
165flag.
166The label is read from the in-core kernel copy,
167or directly from the disk if the
168.B \-r
169flag is also given.
170The label is formatted and then supplied to an editor for changes.
171If no editor is specified in an EDITOR environment variable,
172.IR vi (1)
173is used.
174When the editor terminates, the formatted label is reread
175and used to rewrite the disk label.
176.PP
177With the
178.B \-R
179flag,
180.I disklabel
181is capable of restoring a disk label that was formatted
182in a prior operation and saved in an ascii file.
183The prototype file used to create the label should be in the same format
184as that produced when reading or editing a label.
185Comments are delimited by
186.B #
187and newline.
188If the
189.B \-r
190option is also given,
191a block-0 bootstrap is installed on machines that use one;
192either the disktype or the names of the bootstrap files must be specified
193on such machines.
194.PP
195Finally, the \fB-NW\fP flags for \fIdisklabel\fP explicitly disallow and
196allow, 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"
204disktab(5), disklabel(5)
205.SH DIAGNOSTICS
206The kernel device drivers will not allow the size of a disk partition
207to be decreased or the offset of a partition to be changed while it is open.
208Some device drivers create a label containing only a single large partition
209if a disk is unlabeled; thus, the label must be written to the ``a''
210partition of the disk while it is open.
211This sometimes requires the desired label to be set in two steps,
212the first one creating at least one other partition,
213and the second setting the label on the new partition
214while shrinking the ``a'' partition.
215.SH BUGS
216When a disk name is given without a full pathname,
217the constructed device name uses the ``c'' partition on the vax
218and the ``a'' partition on the tahoe.