xref: /dflybsd-src/sbin/disklabel32/disklabel32.5 (revision 956f4b310cfa8e38b40fc4f9b7232e250bed6b0a)
1ce19f97eSMatthew Dillon.\" Copyright (c) 1987, 1991, 1993
2ce19f97eSMatthew Dillon.\"	The Regents of the University of California.  All rights reserved.
3ce19f97eSMatthew Dillon.\"
4ce19f97eSMatthew Dillon.\" This code is derived from software contributed to Berkeley by
5ce19f97eSMatthew Dillon.\" Symmetric Computer Systems.
6ce19f97eSMatthew Dillon.\"
7ce19f97eSMatthew Dillon.\" Redistribution and use in source and binary forms, with or without
8ce19f97eSMatthew Dillon.\" modification, are permitted provided that the following conditions
9ce19f97eSMatthew Dillon.\" are met:
10ce19f97eSMatthew Dillon.\" 1. Redistributions of source code must retain the above copyright
11ce19f97eSMatthew Dillon.\"    notice, this list of conditions and the following disclaimer.
12ce19f97eSMatthew Dillon.\" 2. Redistributions in binary form must reproduce the above copyright
13ce19f97eSMatthew Dillon.\"    notice, this list of conditions and the following disclaimer in the
14ce19f97eSMatthew Dillon.\"    documentation and/or other materials provided with the distribution.
15*956f4b31Szrj.\" 3. Neither the name of the University nor the names of its contributors
16ce19f97eSMatthew Dillon.\"    may be used to endorse or promote products derived from this software
17ce19f97eSMatthew Dillon.\"    without specific prior written permission.
18ce19f97eSMatthew Dillon.\"
19ce19f97eSMatthew Dillon.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20ce19f97eSMatthew Dillon.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21ce19f97eSMatthew Dillon.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22ce19f97eSMatthew Dillon.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23ce19f97eSMatthew Dillon.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24ce19f97eSMatthew Dillon.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25ce19f97eSMatthew Dillon.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26ce19f97eSMatthew Dillon.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27ce19f97eSMatthew Dillon.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28ce19f97eSMatthew Dillon.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29ce19f97eSMatthew Dillon.\" SUCH DAMAGE.
30ce19f97eSMatthew Dillon.\"
31ce19f97eSMatthew Dillon.\"     @(#)disklabel.5.5	8.1 (Berkeley) 6/5/93
32ce19f97eSMatthew Dillon.\" $FreeBSD: src/sbin/disklabel/disklabel.5,v 1.7.2.4 2002/08/21 18:58:16 trhodes Exp $
33ce19f97eSMatthew Dillon.\" $DragonFly: src/sbin/disklabel/disklabel.5,v 1.6 2008/08/21 21:08:08 thomas Exp $
34ce19f97eSMatthew Dillon.\"
35ce19f97eSMatthew Dillon.Dd August 21, 2008
36c61a095dSThomas Nikolajsen.Dt DISKLABEL32 5
37ce19f97eSMatthew Dillon.Os
38ce19f97eSMatthew Dillon.Sh NAME
39c61a095dSThomas Nikolajsen.Nm disklabel32
40ce19f97eSMatthew Dillon.Nd 32 bit disk pack label
41ce19f97eSMatthew Dillon.Sh SYNOPSIS
42ce19f97eSMatthew Dillon.In sys/disklabel.h
43ce19f97eSMatthew Dillon.Sh DESCRIPTION
44ce19f97eSMatthew DillonEach disk or disk pack on a system may contain a disk label
45ce19f97eSMatthew Dillonwhich provides detailed information
46ce19f97eSMatthew Dillonabout the geometry of the disk and the partitions into which the disk
47ce19f97eSMatthew Dillonis divided.
48ce19f97eSMatthew DillonIt should be initialized when the disk is formatted,
49ce19f97eSMatthew Dillonand may be changed later with the
50c61a095dSThomas Nikolajsen.Xr disklabel32 8
51ce19f97eSMatthew Dillonprogram.
52ce19f97eSMatthew DillonThis information is used by the system disk driver and by the bootstrap
53ce19f97eSMatthew Dillonprogram to determine how to program the drive
54ce19f97eSMatthew Dillonand where to find the file systems on the disk partitions.
55ce19f97eSMatthew DillonAdditional information is used by the file system in order
56ce19f97eSMatthew Dillonto use the disk most efficiently and to locate important file system information.
57ce19f97eSMatthew DillonThe description of each partition contains an identifier for the partition
58ce19f97eSMatthew Dillontype (standard file system, swap area, etc.).
59ce19f97eSMatthew DillonThe file system updates the in-core copy of the label if it contains
60ce19f97eSMatthew Dillonincomplete information about the file system.
61ce19f97eSMatthew Dillon.Pp
62ce19f97eSMatthew DillonThe label is located in sector number
63ce19f97eSMatthew Dillon.Dv LABELSECTOR
64ce19f97eSMatthew Dillonof the drive, usually sector 0 where it may be found
65ce19f97eSMatthew Dillonwithout any information about the disk geometry.
66ce19f97eSMatthew DillonIt is at an offset
67ce19f97eSMatthew Dillon.Dv LABELOFFSET
68ce19f97eSMatthew Dillonfrom the beginning of the sector, to allow room for the initial bootstrap.
69ce19f97eSMatthew DillonThe disk sector containing the label is normally made read-only
70ce19f97eSMatthew Dillonso that it is not accidentally overwritten by pack-to-pack copies
71ce19f97eSMatthew Dillonor swap operations;
72ce19f97eSMatthew Dillonthe
73ce19f97eSMatthew Dillon.Dv DIOCWLABEL
74ce19f97eSMatthew Dillon.Xr ioctl 2 ,
75ce19f97eSMatthew Dillonwhich is done as needed by the
76c61a095dSThomas Nikolajsen.Xr disklabel32 8
77ce19f97eSMatthew Dillonprogram.
78ce19f97eSMatthew Dillon.Pp
79ce19f97eSMatthew DillonA copy of the in-core label for a disk can be obtained with the
80ce19f97eSMatthew Dillon.Dv DIOCGDINFO
81ce19f97eSMatthew Dillon.Xr ioctl 2 ;
82ce19f97eSMatthew Dillonthis works with a file descriptor for a block or character (``raw'') device
83ce19f97eSMatthew Dillonfor any partition of the disk.
84ce19f97eSMatthew DillonThe in-core copy of the label is set by the
85ce19f97eSMatthew Dillon.Dv DIOCSDINFO
86ce19f97eSMatthew Dillon.Xr ioctl 2 .
87ce19f97eSMatthew DillonThe offset of a partition cannot generally be changed while it is open,
88ce19f97eSMatthew Dillonnor can it be made smaller while it is open.
89ce19f97eSMatthew DillonOne exception is that any change is allowed if no label was found
90ce19f97eSMatthew Dillonon the disk, and the driver was able to construct only a skeletal label
91ce19f97eSMatthew Dillonwithout partition information.
92ce19f97eSMatthew DillonFinally, the
93ce19f97eSMatthew Dillon.Dv DIOCWDINFO
94ce19f97eSMatthew Dillon.Xr ioctl 2
95ce19f97eSMatthew Dillonoperation sets the in-core label and then updates the on-disk label;
96ce19f97eSMatthew Dillonthere must be an existing label on the disk for this operation to succeed.
97ce19f97eSMatthew DillonThus, the initial label for a disk or disk pack must be installed
98ce19f97eSMatthew Dillonby writing to the raw disk.
99ce19f97eSMatthew DillonAll of these operations are normally done using
100c61a095dSThomas Nikolajsen.Xr disklabel32 8 .
101ce19f97eSMatthew Dillon.Pp
102ce19f97eSMatthew DillonThe format of the disk label is specified in
103ce19f97eSMatthew Dillon.In sys/disklabel32.h .
104ce19f97eSMatthew Dillon.Sh SEE ALSO
105ce19f97eSMatthew Dillon.Xr disklabel64 5 ,
106ce19f97eSMatthew Dillon.Xr disktab 5 ,
107c61a095dSThomas Nikolajsen.Xr disklabel32 8
108