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