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