1 .\" Copyright (c) 1987, 1988, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Symmetric Computer Systems.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
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 .\" 4. Neither the name of the University nor the names of its contributors
16 .\" may be used to endorse or promote products derived from this software
17 .\" without specific prior written permission.
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
39 .Nd read and write disk pack label
43 .Ar disk | Fl f Ar file
47 .Op Fl B Op Fl b Ar boot
49 .Ar disk | Fl f Ar file
54 .Op Fl B Op Fl b Ar boot
56 .Ar disk | Fl f Ar file
60 .Op Fl B Op Fl b Ar boot
63 .Ar disk | Fl f Ar file
69 installs, examines or modifies the
71 label on a disk partition, or on a file containing a partition image.
74 can install bootstrap code.
76 When specifying the device (i.e., when the
81 path prefix may be omitted;
84 utility will automatically prepend it.
88 option enables processing of the historical parts of the
91 If the option is not given, suitable values are set for these fields.
97 that the program will operate on a file instead of a disk partition.
103 program right before the disk would have been modified, and displays
104 the result instead of writing it.
110 to use the layout suitable for the specified machine.
111 .Ss Reading the Disk Label
112 To examine the label on a disk drive, use
122 represents the disk in question, and may be in the form
126 It will display the partition layout.
127 .Ss Writing a Standard Label
128 To write a standard label, use the form
137 If the drive type is specified, the entry of that name in the
139 file is used; otherwise a default layout is used.
140 .Ss Editing an Existing Disk Label
141 To edit an existing disk label, use the form
149 This command opens the disk label in the default editor, and when the editor
150 exits, the label is validated and if OK written to disk.
151 .Ss Restoring a Disk Label From a File
152 To restore a disk label from a file, use the form
161 is capable of restoring a disk label that was previously saved in a file in
164 The prototype file used to create the label should be in the same format as that
165 produced when reading or editing a label.
166 Comments are delimited by
169 .Ss Installing Bootstraps
172 argument is specified, bootstrap code will be read from the file
174 and written to the disk.
177 argument allows a different file to be used.
179 .Bl -tag -width ".Pa /etc/disktab" -compact
183 Disk description file.
185 .Sh SAVED FILE FORMAT
191 version of the label when examining, editing, or restoring a disk
194 .Bd -literal -offset 4n
197 # size offset fstype [fsize bsize bps/cpg]
198 a: 81920 0 4.2BSD 1024 8192 16
200 c: 1173930 0 unused 0 0 # "raw" part, don't edit
205 option is specified, the format is:
206 .Bd -literal -offset 4n
215 sectors/cylinder: 969
217 sectors/unit: 1173930
222 headswitch: 0 # milliseconds
223 track-to-track seek: 0 # milliseconds
227 # size offset fstype [fsize bsize bps/cpg]
228 a: 81920 0 4.2BSD 1024 8192 16
230 c: 1173930 0 unused 0 0 # "raw" part, don't edit
233 Lines starting with a
237 The partition table can have up to 8 entries.
238 It contains the following information:
239 .Bl -tag -width indent
241 The partition identifier is a single letter in the range
245 By convention, partition
247 is reserved to describe the entire disk.
249 The size of the partition in sectors,
253 (megabytes - 1024*1024),
255 (gigabytes - 1024*1024*1024),
257 (percentage of free space
259 removing any fixed-size partitions other than partition
263 (all remaining free space
265 fixed-size and percentage partitions).
270 indicates the entire disk.
271 Lowercase versions of
276 Size and type should be specified without any spaces between them.
278 Example: 2097152, 1G, 1024M and 1048576K are all the same size
279 (assuming 512-byte sectors).
281 The offset of the start of the partition from the beginning of the
286 calculate the correct offset to use (the end of the previous partition plus
287 one, ignoring partition
292 will be interpreted as an offset of 0.
294 Describes the purpose of the partition.
295 The example shows all currently used partition types.
302 For Vinum drives, use type
304 Other common types are
308 By convention, partition
310 represents the entire slice and should be of type
314 does not enforce this convention.
318 also knows about a number of other partition types,
319 none of which are in current use.
320 (See the definitions starting with
330 file systems only, the fragment size.
331 Defaults to 1024 for partitions smaller than 1GB,
332 4096 for partitions 1GB or larger.
338 file systems only, the block size.
339 Defaults to 8192 for partitions smaller than 1GB,
340 16384 for partitions 1GB or larger.
344 file systems, the number of cylinders in a cylinder group.
347 file systems, the segment shift value.
348 Defaults to 16 for partitions smaller than 1GB,
349 64 for partitions 1GB or larger.
354 Display the label for the first slice of the
356 disk, as obtained via
359 .Dl "bsdlabel da0s1 > savedlabel"
361 Save the in-core label for
365 This file can be used with the
367 option to restore the label at a later date.
369 .Dl "bsdlabel -w /dev/da0s1"
374 .Dl "bsdlabel -e da0s1"
378 edit it, and install the result.
380 .Dl "bsdlabel -e -n da0s1"
382 Read the on-disk label for
384 edit it, and display what the new label would be (in sectors).
387 install the new label either in-core or on-disk.
389 .Dl "bsdlabel -w da0s1"
391 Write a default label on
396 partitioning and file system information.
398 .Dl "bsdlabel -R da0s1 savedlabel"
400 Restore the on-disk and in-core label for
405 .Dl "bsdlabel -R -n da0s1 label_layout"
407 Display what the label would be for
409 using the partition layout in
411 This is useful for determining how much space would be allotted for various
412 partitions with a labeling scheme using
418 .Dl "bsdlabel -B da0s1"
420 Install a new bootstrap on
422 The boot code comes from
425 .Dl "bsdlabel -w -B -b newboot /dev/da0s1"
427 Install a new label and bootstrap.
428 The bootstrap code comes from the file
430 in the current working directory.
431 .Bd -literal -offset indent
432 dd if=/dev/zero of=/dev/da0 bs=512 count=32
434 dd if=/dev/zero of=/dev/da0s1 bs=512 count=32
439 Completely wipe any prior information on the disk, creating a new bootable
442 partition table containing one slice, covering the whole disk.
443 Initialize the label on this slice,
447 commands are optional, but may be necessary for some
452 This is an example disk label that uses some of the new partition size types
457 which could be used as a source file for
458 .Dq Li "bsdlabel -R ad0s1c new_label_file" :
459 .Bd -literal -offset 4n
463 # size offset fstype [fsize bsize bps/cpg]
464 a: 400M 0 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*)
472 The kernel device drivers will not allow the size of a disk partition
473 to be decreased or the offset of a partition to be changed while it is open.
477 to store the number of sectors,
479 labels are restricted to a maximum of 2^32-1 sectors.
480 This usually means 2TB of disk space.
481 Larger disks should be partitioned using another method such as
486 all use slightly different versions of
489 are not generally compatible.