.\" from Symmetric Computer Systems.
.\" Modifications Copyright (c) 1987 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\" @(#)disklabel.5.5 6.2 (Berkeley) %G%
disklabel \- disk pack label
.B #include <sys/disklabel.h>
Each disk or disk pack on a system may contain a disk label
which provides detailed information
about the geometry of the disk and the partitions into which the disk
It should be initialized when the disk is formatted,
and may be changed later with the
This information is used by the system disk driver and by the bootstrap
program to determine how to program the drive
and where to find the filesystems on the disk partitions.
Additional information is used by the filesystem in order
to use the disk most efficiently and to locate important filesystem information.
The description of each partition contains an identifier for the partition
type (standard filesystem, swap area, etc.).
The filesystem updates the in-core copy of the label if it contains
incomplete information about the filesystem.
The label is located in sector number
of the drive, usually sector 0 where it may be found
without any information about the disk geometry.
from the beginning of the sector, to allow room for the initial bootstrap.
The disk sector containing the label is normally made read-only
so that it is not accidentally overwritten by pack-to-pack copies
which is done as needed by the
A copy of the in-core label for a disk can be obtained with the DIOCGDINFO
this works with a file descriptor for a block or character (``raw'') device
for any partition of the disk.
The in-core copy of the label is set by the DIOCSDINFO
The offset of a partition cannot generally be changed while it is open,
nor can it be made smaller while it is open.
One exception is that any change is allowed if no label was found
on the disk, and the driver was able to construct only a skeletal label
without partition information.
operation sets the in-core label and then updates the on-disk label;
there must be an existing label on the disk for this operation to succeed.
Thus, the initial label for a disk or disk pack must be installed
by writing to the raw disk.
All of these operations are normally done using
The format of the disk label, as specified in
.so /usr/include/sys/disklabel.h