1 .\" $NetBSD: disklabel.8,v 1.61 2007/01/27 19:20:28 perry Exp $
3 .\" Copyright (c) 1987, 1988, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" Symmetric Computer Systems.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
40 .Nd read and write disk pack label
42 .\" disklabel: read label
46 .\" disklabel -e: read/modify/write using $EDITOR
51 .\" disklabel -i: read/modify/write using builtin commands
56 .\" disklabel -R: write from edited output
61 .\" disklabel -w: write from disctab entry
68 .\" disklabel -NW: disallow/allow writes to the label sector
72 .\" disklabel -l: list all know file system types
77 can be used to install, examine, or modify the label on a disk drive or pack.
78 When writing the label, it can be used to change the drive identification,
79 the disk partitions on the drive, or to replace a damaged label.
82 .Fl e , i , l , R , w , N ,
85 options determine the basic operation.
86 If none are specified the label
90 Edit the existing label (using
92 and write it back to the disk.
99 Interactively update the existing label and write it back to the disk.
101 Show all known file system types (those that can be specified along a
102 partition within the label) and exit.
104 Write (restore) a label by reading it from
106 The file should be in the same format as the default output.
108 Write a standard label for the specified
113 Disallow writes to the disk sector that contains the label.
114 This is the default state.
116 Allow writes to the disk sector that contains the label.
117 This state may not persist if no programs have the disk open.
120 The majority of the rest of the options affect more than one form of the
124 Read all labels from the disk, including ones deleted with
130 Output the partition offset and size values in
131 .Aq cylinder/head/sector
133 Note this format is always accepted on input with either the
139 Delete all existing labels (by 1's complementing the magic number) before
140 writing any labels to their default location.
145 is specified without a request to write the label, then existing labels are
153 calls, and is the default if
157 is always opened using
165 If a label cannot be read from
167 request the default one from the kernel.
171 Specify the name of a file to use instead of
174 Read/write the disk directly rather than using
176 requests on the kernel.
177 When writing a label, the kernel will be told about the label before the
178 label is written and asked to write afterwards.
179 This is the historic behaviour and can be supressed by specifying
182 Format the output as a
186 Be verbose about the operations being done, in particular the disk sectors
187 being read and written.
190 more than once will increase the verbosity.
193 On systems that expect to have disks with MBR partitions (see
196 will find, and update if requested, labels in the first 8k of type 169
198 MBR labels and within the first 8k of the physical disk.
201 will only look at the start of the disk.
202 The offset at which the labels are written is also system dependent.
205 will detect byteswapped labels, but currently cannot display them.
209 could update the bootstrap code on some architectures.
210 This functionality has been subsumed by
215 is set to indicate any errors or warnings.
217 .Bl -tag -width indent
221 utility has completed successfully.
223 A fatal error has occurred, such as unknown options passed on the
224 command line, or writing the disklabel failed.
226 An I/O error of some sort occurred.
228 One or more warnings occured while reading the disklabel.
229 Subtract 100 to get the number of warnings detected.
232 .Bl -tag -width /etc/disktab -compact
238 Display the in-core label for sd0 as obtained via
241 .Dl Ic disklabel -i -r sd0
243 Read the on-disk label for sd0, edit it using the built-in interactive editor and reinstall in-core as well
246 .Dl Ic disklabel -i -I sd0
248 As previous, but don't fail if there was no label on the disk yet;
249 provide some default values instead.
251 .Dl Ic disklabel -e -I sd0
253 As previous, only edit using $EDITOR
255 .Dl Ic disklabel -w -r /dev/rsd0c sd2212 foo
257 Create a label for sd0 based on information for
263 as the disk pack label.
264 If you do not have an entry for your disk in
266 you can use this style to put
267 an initial label onto a new disk.
268 Then dump the label to a file (using
269 .Ic disklabel sd0 \*[Gt] protofile ) ,
270 editing the file, and replacing the label with
271 .Ic disklabel -R sd0 protofile .
273 .Dl Ic disklabel -R sd0 mylabel
275 Restore the on-disk and in-core label for sd0 from information in
278 The kernel device drivers will not allow the size of a disk partition
279 to be decreased or the offset of a partition to be changed while it is open.
280 Some device drivers create a label containing only a single large partition
281 if a disk is unlabeled; thus, the label must be written to the
283 partition of the disk while it is open.
284 This sometimes requires the desired label to be set in two steps,
285 the first one creating at least one other partition,
286 and the second setting the label on the new partition
300 If the disk partition is not specified in the disk name
306 will construct the full pathname of the disk and use the
308 partition on i386, hpcmips, or arc, and the
310 partition on all others.
312 On the sparc, sparc64, sun2, and sun3
314 systems, the size of each partition must be a multiple of the number
315 of sectors per cylinder (i.e., each partition must be an integer
316 number of cylinders), or the boot ROMs will declare the label
317 invalid and fail to boot the system.
321 option should never be used on a sparc, sparc64, sun2, or sun3 system
324 kernel translates the
326 disk label into a SunOS compatible format (which is required by the
327 boot PROMs) when it writes the label.
332 to write directly to disk, and bypass the format translation.
333 This will result in a disk label that the PROMs will not recognize,
334 and that therefore cannot be booted from.