stdio.h defines BUFSIZ
[unix-history] / usr / src / sbin / disklabel / disklabel.8
CommitLineData
57a981eb 1.\" Copyright (c) 1987, 1988 Regents of the University of California.
2ab70f66 2.\" All rights reserved.
37adbef5 3.\"
57a981eb
KB
4.\" This code is derived from software contributed to Berkeley by
5.\" Symmetric Computer Systems.
6.\"
e0779a71 7.\" %sccs.include.redist.man%
2ab70f66 8.\"
e0779a71 9.\" @(#)disklabel.8 6.8 (Berkeley) %G%
37adbef5
MK
10.\"
11.TH DISKLABEL 8 ""
12.UC 5
13.SH NAME
14disklabel \- read and write disk pack label
15.SH SYNOPSIS
16.B disklabel
17[
18.B \-r
19]
20.I disk
21.br
22.B disklabel \-w
23[
24.B \-r
25]
26.I disk
27.I disktype
28[
29.I packid
30[
31.I priboot secboot
32] ]
33.br
34.B disklabel \-e
35[
36.B \-r
37]
38.I disk
39.br
40.B disklabel \-R
41[
42.B \-r
43]
4ec0116d 44.I disk protofile
37adbef5
MK
45[
46.I priboot secboot
47]
2ab70f66
KB
48.br
49.B disklabel
50[
51.B \-NW
52]
53.I disk
37adbef5
MK
54.SH DESCRIPTION
55.I Disklabel
56can be used to install, examine or modify the label on a disk drive or pack.
57When writing the label, it can be used
58to change the drive identification,
59the disk partitions on the drive,
60or to replace a damaged label or bootstrap.
bdb6580b
MK
61The disk label is located on one of the first sectors
62of each disk (usually block 0).
63On machines that require a block-0 bootstrap (VAX 11/750),
64the label is inserted into the bootstrap program.
37adbef5
MK
65This information is used by the system disk driver and by the bootstrap
66program to determine how to program the drive.
bdb6580b
MK
67There are several forms of the command that display, install or modify
68the label on a disk.
69Each form has an additional option,
70.BR \-r ,
71which causes the label to be read from or written to the disk directly,
72rather than going through the system's in-core copy of the label.
73When writing, the in-core copy is also updated if possible.
85fd189d
MK
74This option may allow a label to be installed on a disk
75without kernel support for a label, such as when labels are first installed
250c0be5 76on a system; it must be used when first installing a label on a disk.
37adbef5
MK
77.PP
78The first form of the command is used to examine the label on the named
79disk drive (e.g. hp0 or /dev/rhp0c).
80It will display all of the parameters associated with the drive
81and its partition layout.
250c0be5
MK
82Unless the
83.B \-r
84flag is given,
85the kernel's in-core copy of the label is displayed;
37adbef5 86if the disk has no label, or the partition types on the disk are incorrect,
85fd189d 87the kernel may have constructed or modified the label.
37adbef5
MK
88If the
89.B \-r
90flag is given, the label from the raw disk will be displayed rather
91than the in-core label.
92.PP
93The second form of the command, with the
94.B \-w
95flag, is used to write a standard label on the designated drive.
96The required arguments to
97.I disklabel
98are the drive to be labelled (e.g. hp0), and
99the drive type as described in the
100.IR disktab (5)
101file.
102The drive parameters and partitions are taken from that file.
103If different disks of the same physical type are to have different
104partitions, it will be necessary to have separate disktab entries
250c0be5
MK
105describing each, or to edit the label after installation as described below.
106The first optional argument is a pack identification string,
107up to 16 characters long.
37adbef5
MK
108The pack id must be quoted if it contains blanks.
109If the
110.B \-r
111flag is given, the disk sectors containing the label and bootstrap
112will be written directly,
250c0be5 113otherwise the existing label will be updated in place without modifying
85fd189d
MK
114the bootstrap.
115If the disk does not already have a label, the
37adbef5 116.B \-r
85fd189d
MK
117flag must be used.
118In either case, the kernel's in-core label is replaced.
119.PP
120Alternate versions of the bootstrap files may be specified
37adbef5
MK
121after the pack identifier.
122If an alternate bootstrap is not specified, the standard bootstrap will be used.
123The bootstrap programs are located in
85fd189d
MK
124.IR /usr/mdec .
125The names of the bootstrap programs may be specified in
126.IR disktab (5);
250c0be5
MK
127if not specified,
128the default names are of the form
129.IR basename boot
37adbef5 130for the primary (block 0) bootstrap, and
250c0be5 131.RI boot basename
37adbef5 132for the secondary (block 1-15) bootstrap;
250c0be5
MK
133for example, /usr/mdec/hpboot and /usr/mdec/boothp
134if the disk device is
135.BR hp0 .
37adbef5
MK
136.PP
137An existing disk label may be edited by using the
138.B \-e
139flag.
140The label is read from the in-core kernel copy,
141or directly from the disk if the
142.B \-r
143flag is also given.
144The label is formatted and then supplied to an editor for changes.
145If no editor is specified in an EDITOR environment variable,
146.IR vi (1)
147is used.
148When the editor terminates, the formatted label is reread
149and used to rewrite the disk label.
37adbef5 150.PP
2ab70f66 151With the
85fd189d
MK
152.B \-R
153flag,
37adbef5
MK
154.I disklabel
155is capable of restoring a disk label that was formatted
85fd189d 156in a prior operation and saved in an ascii file.
250c0be5
MK
157The prototype file used to create the label should be in the same format
158as that produced when reading or editing a label.
159Comments are delimited by
160.B #
161and newline.
85fd189d
MK
162If the
163.B \-r
164option is also given,
165a block-0 bootstrap is installed on machines that use one;
166either the disktype or the names of the bootstrap files must be specified
167on such machines.
2ab70f66
KB
168.PP
169Finally, the \fB-NW\fP flags for \fIdisklabel\fP explicitly disallow and
170allow, respectively, writing of the pack label area on the selected disk.
37adbef5
MK
171.SH FILES
172/etc/disktab
173.br
174/usr/mdec/\fIxx\fPboot
175.br
176/usr/mdec/boot\fIxx\fP
177.SH "SEE ALSO"
178disktab(5), disklabel(5)
250c0be5
MK
179.SH DIAGNOSTICS
180The kernel device drivers will not allow the size of a disk partition
181to be decreased or the offset of a partition to be changed while it is open.
182Some device drivers create a label containing only a single large partition
183if a disk is unlabeled; thus, the label must be written to the ``a''
184partition of the disk while it is open.
185This sometimes requires the desired label to be set in two steps,
186the first one creating at least one other partition,
187and the second setting the label on the new partition
188while shrinking the ``a'' partition.
189.SH BUGS
190When a disk name is given without a full pathname,
191the constructed device name uses the ``c'' partition on the vax
192and the ``a'' partition on the tahoe.