MirOS Manual: disklabel(5)

DISKLABEL(5)                 BSD Reference Manual                 DISKLABEL(5)

NAME

     disklabel - disk pack label

SYNOPSIS

     #include <sys/disklabel.h>

DESCRIPTION

     Each disk or disk pack on a system may contain a disk label which pro-
     vides detailed information about the geometry of the disk and the parti-
     tions into which the disk is divided. It should be initialized when the
     disk is formatted, and may be changed later with the disklabel(8) pro-
     gram. 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 con-
     tains 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 LABELSECTOR of the drive, usually
     sector 0 where it may be found without any information about the disk
     geometry. It is at an offset LABELOFFSET from the beginning of the sec-
     tor, 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 or swap operations; the DIOCWLABEL
     ioctl(2), which is done as needed by the disklabel(8) program, allows
     modification of the label sector.

     A copy of the in-core label for a disk can be obtained with the
     DIOCGDINFO ioctl; this works with a file descriptor for a block or char-
     acter ("raw") device for any partition of the disk. The in-core copy of
     the label is set by the DIOCSDINFO ioctl. The offset of a partition can-
     not 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 skele-
     tal label without partition information. The DIOCWDINFO ioctl 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. The DIOCGPDINFO ioctl operation gets the default label for a
     disk. This simulates the case where there is no physical label on the
     disk itself and can be used to see the label the kernel would construct
     in that case. The DIOCRLDINFO ioctl operation causes the kernel to update
     its copy of the label based on the physical label on the disk. It can be
     used when the on-disk version of the label was changed directly or, if
     there is no physical label, to update the kernel's skeletal label if some
     variable affecting label generation has changed (e.g. the fdisk partition
     table). All of these operations are normally done using disklabel(8).

     Note that when a disk has no real BSD disklabel the kernel creates a de-
     fault label so that the disk can be used. This default label will include
     other partitions found on the disk if they are supported on your archi-
     tecture. For example, on systems that support fdisk(8) partitions the de-
     fault label will also include DOS and Linux partitions. However, these
     entries are not dynamic, they are fixed at the time disklabel(8) is run.
     That means that subsequent changes that affect non-OpenBSD partitions
     will not be present in the default label, though you may update them by
     hand. To see the default label, run disklabel(8) with the -d flag. You
     can then run disklabel(8) with the -e flag and paste any entries you want
     from the default label into the real one.

SEE ALSO

     disktab(5), disklabel(8)

CAVEATS

     disklabel only supports up to a maximum of 15 partitions, 'a' through
     'p', excluding 'c'. The 'c' partition is reserved for the entire physical
     disk. By convention, the 'a' partition of the boot disk is the root par-
     tition, and the 'b' partition of the boot disk is the swap partition, but
     all other letters can be used in any order for any other partitions as
     desired.

MirOS BSD #10-current           August 6, 2001                               1

Generated on 2014-07-04 21:17:45 by $MirOS: src/scripts/roff2htm,v 1.79 2014/02/10 00:36:11 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002‒2014 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.