18fae3551SRodney W. Grimes.\" Copyright (c) 1987, 1988, 1991, 1993 28fae3551SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 38fae3551SRodney W. Grimes.\" 48fae3551SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 58fae3551SRodney W. Grimes.\" Symmetric Computer Systems. 68fae3551SRodney W. Grimes.\" 78fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 88fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions 98fae3551SRodney W. Grimes.\" are met: 108fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 118fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 128fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 138fae3551SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 148fae3551SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 158fae3551SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 166bd343a9SPhilippe Charnier.\" must display the following acknowledgment: 178fae3551SRodney W. Grimes.\" This product includes software developed by the University of 188fae3551SRodney W. Grimes.\" California, Berkeley and its contributors. 198fae3551SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 208fae3551SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 218fae3551SRodney W. Grimes.\" without specific prior written permission. 228fae3551SRodney W. Grimes.\" 238fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 248fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 258fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 268fae3551SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 278fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 288fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 298fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 308fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 318fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 328fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 338fae3551SRodney W. Grimes.\" SUCH DAMAGE. 348fae3551SRodney W. Grimes.\" 358fae3551SRodney W. Grimes.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 36aa7c9adaSMike Pritchard.\" $Id: disklabel.8,v 1.12 1999/08/01 06:40:11 grog Exp $ 378fae3551SRodney W. Grimes.\" 384cbdc634SGreg Lehey.Dd July 30, 1999 398fae3551SRodney W. Grimes.Dt DISKLABEL 8 404cbdc634SGreg Lehey.Os FreeBSD 418fae3551SRodney W. Grimes.Sh NAME 428fae3551SRodney W. Grimes.Nm disklabel 438fae3551SRodney W. Grimes.Nd read and write disk pack label 448fae3551SRodney W. Grimes.Sh SYNOPSIS 458fae3551SRodney W. Grimes.Nm disklabel 468fae3551SRodney W. Grimes.Op Fl r 478fae3551SRodney W. Grimes.Ar disk 488fae3551SRodney W. Grimes.Nm disklabel 498fae3551SRodney W. Grimes.Fl w 508fae3551SRodney W. Grimes.Op Fl r 518fae3551SRodney W. Grimes.Ar disk Ar disktype 528fae3551SRodney W. Grimes.Oo Ar packid Oc 538fae3551SRodney W. Grimes.Nm disklabel 548fae3551SRodney W. Grimes.Fl e 558fae3551SRodney W. Grimes.Op Fl r 568fae3551SRodney W. Grimes.Ar disk 578fae3551SRodney W. Grimes.Nm disklabel 588fae3551SRodney W. Grimes.Fl R 598fae3551SRodney W. Grimes.Op Fl r 608fae3551SRodney W. Grimes.Ar disk Ar protofile 618fae3551SRodney W. Grimes.Nm disklabel 628fae3551SRodney W. Grimes.Op Fl NW 638fae3551SRodney W. Grimes.Ar disk 648fae3551SRodney W. Grimes.sp 658fae3551SRodney W. Grimes.Nm disklabel 668fae3551SRodney W. Grimes.Fl B 678fae3551SRodney W. Grimes.Oo 688fae3551SRodney W. Grimes.Fl b Ar boot1 694cbdc634SGreg Lehey.Fl s Ar boot2 708fae3551SRodney W. Grimes.Oc 718fae3551SRodney W. Grimes.Ar disk 728fae3551SRodney W. Grimes.Oo Ar disktype Oc 738fae3551SRodney W. Grimes.Nm disklabel 748fae3551SRodney W. Grimes.Fl w 758fae3551SRodney W. Grimes.Fl B 768fae3551SRodney W. Grimes.Oo 778fae3551SRodney W. Grimes.Fl b Ar boot1 784cbdc634SGreg Lehey.Fl s Ar boot2 798fae3551SRodney W. Grimes.Oc 808fae3551SRodney W. Grimes.Ar disk Ar disktype 818fae3551SRodney W. Grimes.Oo Ar packid Oc 828fae3551SRodney W. Grimes.Nm disklabel 838fae3551SRodney W. Grimes.Fl R 848fae3551SRodney W. Grimes.Fl B 858fae3551SRodney W. Grimes.Oo 868fae3551SRodney W. Grimes.Fl b Ar boot1 874cbdc634SGreg Lehey.Fl s Ar boot2 888fae3551SRodney W. Grimes.Oc 898fae3551SRodney W. Grimes.Ar disk Ar protofile 908fae3551SRodney W. Grimes.Oo Ar disktype Oc 918fae3551SRodney W. Grimes.Sh DESCRIPTION 928fae3551SRodney W. Grimes.Nm Disklabel 934cbdc634SGreg Leheyinstalls, examines or modifes the label on a disk drive or pack. When writing 944cbdc634SGreg Leheythe label, it can be used to change the drive identification, the disk 954cbdc634SGreg Leheypartitions on the drive, or to replace a damaged label. There are several forms 964cbdc634SGreg Leheyof the command that read (display), install or edit the label on a disk. In 974cbdc634SGreg Leheyaddition, 986bd343a9SPhilippe Charnier.Nm 994cbdc634SGreg Leheycan install bootstrap code. 1004cbdc634SGreg Lehey.Ss Raw or in-core label 1014cbdc634SGreg Lehey.Pp 1024cbdc634SGreg LeheyThe disk label is resident close to or at the beginning of each disk partition. 1034cbdc634SGreg LeheyFor faster access, the kernel maintains a copy in core at all times. By 1044cbdc634SGreg Leheydefault, most 1054cbdc634SGreg Lehey.Nm 1064cbdc634SGreg Leheyaccess the in-core copy of the label. To access the raw (on-disk) copy, use the 1074cbdc634SGreg Lehey.Fl r 1084cbdc634SGreg Leheyoption. This option allows a label to be installed on a disk without kernel 1094cbdc634SGreg Leheysupport for a label, such as when labels are first installed on a system; it 1104cbdc634SGreg Leheymust be used when first installing a label on a disk. The specific effect of 1118fae3551SRodney W. Grimes.Fl r 1128fae3551SRodney W. Grimesis described under each command. 1138fae3551SRodney W. Grimes.Pp 1144cbdc634SGreg Lehey.Ss Disk device name 1154cbdc634SGreg Lehey.Pp 1164cbdc634SGreg LeheyAll 1174cbdc634SGreg Lehey.Nm disklabel 1184cbdc634SGreg Leheyforms require a disk device name, which should always be the raw 1194cbdc634SGreg Lehey.if t ``complete'' (or ``c'') 1204cbdc634SGreg Lehey.if n "complete" (or "c") 1214cbdc634SGreg Leheypartition, for example 1224cbdc634SGreg Lehey.Pa /dev/rda0c . 1234cbdc634SGreg Lehey.Nm 1244cbdc634SGreg Leheyunderstands the abbreviation 1254cbdc634SGreg Lehey.Pa da0 , 1264cbdc634SGreg Leheywhich it converts internally to 1274cbdc634SGreg Lehey.Pa /dev/rda0c . 1284cbdc634SGreg Lehey.Ss Reading the disk label 1294cbdc634SGreg Lehey.Pp 1304cbdc634SGreg LeheyTo examine or save the label on a disk drive, use 1314cbdc634SGreg Lehey.Nm 1324cbdc634SGreg Leheywithout options: 1334cbdc634SGreg Lehey.Pp 1344cbdc634SGreg Lehey.Nm disklabel 1354cbdc634SGreg Lehey.Op Fl r 1364cbdc634SGreg Lehey.Ar disk 1374cbdc634SGreg Lehey.Pp 1384cbdc634SGreg Lehey.Ar disk 1394cbdc634SGreg Leheyrepresents the raw disk in question, and may be in the form 1404cbdc634SGreg Lehey.Pa da0 1414cbdc634SGreg Leheyor 1424cbdc634SGreg Lehey.Pa /dev/rda0c . 1434cbdc634SGreg LeheyIt will display all of the parameters associated with the drive and its 1444cbdc634SGreg Leheypartition layout. Unless the 1458fae3551SRodney W. Grimes.Fl r 1468fae3551SRodney W. Grimesflag is given, 1478fae3551SRodney W. Grimesthe kernel's in-core copy of the label is displayed; 1488fae3551SRodney W. Grimesif the disk has no label, or the partition types on the disk are incorrect, 1498fae3551SRodney W. Grimesthe kernel may have constructed or modified the label. 1508fae3551SRodney W. GrimesIf the 1518fae3551SRodney W. Grimes.Fl r 1524cbdc634SGreg Leheyflag is given, 1534cbdc634SGreg Lehey.Nm 1544cbdc634SGreg Leheyreads the label from the raw disk and displays it. 1554cbdc634SGreg Lehey.Ss Writing a standard label 1568fae3551SRodney W. Grimes.Pp 1574cbdc634SGreg LeheyTo write a standard label, use the form 1584cbdc634SGreg Lehey.Pp 1594cbdc634SGreg Lehey.Nm disklabel 1608fae3551SRodney W. Grimes.Fl w 1614cbdc634SGreg Lehey.Op Fl r 1624cbdc634SGreg Lehey.Ar disk Ar disktype 1634cbdc634SGreg Lehey.Oo Ar packid Oc 1644cbdc634SGreg Lehey.Pp 1658fae3551SRodney W. GrimesThe required arguments to 1666bd343a9SPhilippe Charnier.Nm 1674cbdc634SGreg Leheyare the drive to be labeled and the drive type as described in the 1684cbdc634SGreg Lehey.Pa disktab(5) 1694cbdc634SGreg Leheyfile. The drive parameters and partitions are taken from that file. If 1704cbdc634SGreg Leheydifferent disks of the same physical type are to have different partitions, it 1714cbdc634SGreg Leheywill be necessary to have separate disktab entries describing each, or to edit 1724cbdc634SGreg Leheythe label after installation as described below. The optional argument is a 1734cbdc634SGreg Leheypack identification string, up to 16 characters long. The pack id must be 1744cbdc634SGreg Leheyquoted if it contains blanks. If the 1758fae3551SRodney W. Grimes.Fl r 1768fae3551SRodney W. Grimesflag is given, the disk sectors containing the label and bootstrap 1778fae3551SRodney W. Grimeswill be written directly. 1788fae3551SRodney W. GrimesA side-effect of this is that any existing bootstrap code will be overwritten 1794cbdc634SGreg Leheyand the disk rendered unbootable. See the boot options below for a method of 1804cbdc634SGreg Leheywriting the label and the bootstrap at the same time. 1818fae3551SRodney W. GrimesIf 1828fae3551SRodney W. Grimes.Fl r 1838fae3551SRodney W. Grimesis not specified, 1848fae3551SRodney W. Grimesthe existing label will be updated via the in-core copy and any bootstrap 1858fae3551SRodney W. Grimescode will be unaffected. 1868fae3551SRodney W. GrimesIf the disk does not already have a label, the 1878fae3551SRodney W. Grimes.Fl r 1888fae3551SRodney W. Grimesflag must be used. 1898fae3551SRodney W. GrimesIn either case, the kernel's in-core label is replaced. 1908fae3551SRodney W. Grimes.Pp 191425bed3aSJoerg WunschFor a virgin disk that is not known to 192425bed3aSJoerg Wunsch.Xr disktab 5 , 193425bed3aSJoerg Wunsch.Ar disktype 194425bed3aSJoerg Wunschcan be specified as 195425bed3aSJoerg Wunsch.Dq auto . 196425bed3aSJoerg WunschIn this case, the driver is requested to produce a virgin label for the 197425bed3aSJoerg Wunschdisk. This might or might not be successful, depending on whether the 198425bed3aSJoerg Wunschdriver for the disk is able to get the required data without reading 199425bed3aSJoerg Wunschanything from the disk at all. It will likely succeed for all SCSI 200425bed3aSJoerg Wunschdisks, most IDE disks, and vnode devices. Writing a label to the 201425bed3aSJoerg Wunschdisk is the only supported operation, and the 202425bed3aSJoerg Wunsch.Ar disk 203425bed3aSJoerg Wunschitself must be provided as the canonical name, i.e. not as a full 204425bed3aSJoerg Wunschpath name. 2054cbdc634SGreg Lehey.Ss Editing an existing disk label 206425bed3aSJoerg Wunsch.Pp 2074cbdc634SGreg LeheyTo edit an existing disk label, use the form 2084cbdc634SGreg Lehey.Pp 2094cbdc634SGreg Lehey.Nm disklabel 2108fae3551SRodney W. Grimes.Fl e 2114cbdc634SGreg Lehey.Op Fl r 2124cbdc634SGreg Lehey.Ar disk 2134cbdc634SGreg Lehey.Pp 2144cbdc634SGreg LeheyThis command reads the label from the in-core kernel copy, or directly from the 2154cbdc634SGreg Leheydisk if the 2168fae3551SRodney W. Grimes.Fl r 2174cbdc634SGreg Leheyflag is also specified. The label is written to a file in ASCII and then 2184cbdc634SGreg Leheysupplied to an editor for changes. If no editor is specified in an 2198fae3551SRodney W. Grimes.Ev EDITOR 2208fae3551SRodney W. Grimesenvironment variable, 2218fae3551SRodney W. Grimes.Xr vi 1 2224cbdc634SGreg Leheyis used. When the editor terminates, the label file is used to rewrite the disk 2234cbdc634SGreg Leheylabel. Existing bootstrap code is unchanged regardless of whether 2248fae3551SRodney W. Grimes.Fl r 2258fae3551SRodney W. Grimeswas specified. 2264cbdc634SGreg Lehey.Ss Restoring a disk label from a file 2278fae3551SRodney W. Grimes.Pp 2284cbdc634SGreg LeheyTo restore a disk label from a file, use the form 2294cbdc634SGreg Lehey.Pp 2304cbdc634SGreg Lehey.Nm disklabel 2318fae3551SRodney W. Grimes.Fl R 2324cbdc634SGreg Lehey.Op Fl r 2334cbdc634SGreg Lehey.Ar disk Ar protofile 2348fae3551SRodney W. Grimes.Pp 2356bd343a9SPhilippe Charnier.Nm 2364cbdc634SGreg Leheyis capable of restoring a disk label that was previously saved in a file ASCII. 2374cbdc634SGreg LeheyThe prototype file used to create the label should be in the same format as that 2384cbdc634SGreg Leheyproduced when reading or editing a label. Comments are delimited by 2394cbdc634SGreg Lehey.Ar \&# 2404cbdc634SGreg Leheyand newline. As when writing a new label, any existing bootstrap code will be 2414cbdc634SGreg Leheyclobbered if 2424cbdc634SGreg Lehey.Fl r 2434cbdc634SGreg Leheyis specified and will be unaffected otherwise. See the boot options below for a 2444cbdc634SGreg Leheymethod of restoring the label and writing the bootstrap at the same time. 2454cbdc634SGreg Lehey.Ss Enabling and disabling writing to the disk label area 2464cbdc634SGreg Lehey.Pp 2474cbdc634SGreg LeheyBy default, it is not possible to write to the disk label area at the beginning 2484cbdc634SGreg Leheyof a disk. The disk driver silently ignores any attempt to do so. If you need 2494cbdc634SGreg Leheyto write to this area (for example, to obliterate the label), use the form 2504cbdc634SGreg Lehey.Pp 2514cbdc634SGreg Lehey.Nm disklabel 2524cbdc634SGreg Lehey.Op Fl W 2534cbdc634SGreg Lehey.Ar disk 2544cbdc634SGreg Lehey.Pp 2554cbdc634SGreg LeheyTo disallow writing to the label area after previously allowing it, use the 2564cbdc634SGreg Leheycommand 2574cbdc634SGreg Lehey.Pp 2584cbdc634SGreg Lehey.Nm disklabel 2594cbdc634SGreg Lehey.Op Fl N 2604cbdc634SGreg Lehey.Ar disk 2614cbdc634SGreg Lehey.Ss Installing bootstraps 2628fae3551SRodney W. Grimes.Pp 2638fae3551SRodney W. GrimesThe final three forms of 2646bd343a9SPhilippe Charnier.Nm 2654cbdc634SGreg Leheyare used to install bootstrap code: 2664cbdc634SGreg Lehey.Pp 2674cbdc634SGreg Lehey.Nm disklabel 2688fae3551SRodney W. Grimes.Fl B 2694cbdc634SGreg Lehey.Oo 2704cbdc634SGreg Lehey.Fl b Ar boot1 2714cbdc634SGreg Lehey.Fl s Ar boot2 2724cbdc634SGreg Lehey.Oc 2734cbdc634SGreg Lehey.Ar disk 2744cbdc634SGreg Lehey.Oo Ar disktype Oc 2754cbdc634SGreg Lehey.Pp 2764cbdc634SGreg LeheyThis form installs the bootstrap only. It does not change the disk label. 2774cbdc634SGreg Lehey.Pp 2784cbdc634SGreg Lehey.Nm disklabel 2794cbdc634SGreg Lehey.Fl w 2804cbdc634SGreg Lehey.Fl B 2814cbdc634SGreg Lehey.Oo 2824cbdc634SGreg Lehey.Fl b Ar boot1 2834cbdc634SGreg Lehey.Fl s Ar boot2 2844cbdc634SGreg Lehey.Oc 2854cbdc634SGreg Lehey.Ar disk Ar disktype 2864cbdc634SGreg Lehey.Oo Ar packid Oc 2874cbdc634SGreg Lehey.Pp 2884cbdc634SGreg Lehey.if t This form corresponds to the ``write label'' command described above. 2894cbdc634SGreg Lehey.if n This form corresponds to the "write label" command described above. 2904cbdc634SGreg LeheyIn addition to writing a new volume label, it also installs the bootstrap. 2914cbdc634SGreg Lehey.Pp 2924cbdc634SGreg Lehey.Nm disklabel 2934cbdc634SGreg Lehey.Fl R 2944cbdc634SGreg Lehey.Fl B 2954cbdc634SGreg Lehey.Oo 2964cbdc634SGreg Lehey.Fl b Ar boot1 2974cbdc634SGreg Lehey.Fl s Ar boot2 2984cbdc634SGreg Lehey.Oc 2994cbdc634SGreg Lehey.Ar disk Ar protofile 3004cbdc634SGreg Lehey.Oo Ar disktype Oc 3014cbdc634SGreg Lehey.Pp 3024cbdc634SGreg Lehey.if t This form corresponds to the ``restore label'' command described above. 3034cbdc634SGreg Lehey.if n This form corresponds to the "restore label" command described above. 3044cbdc634SGreg LeheyIn addition to restoring the volume label, it also installs the bootstrap. 3054cbdc634SGreg Lehey.Pp 3064cbdc634SGreg LeheyThe bootstrap commands always access the disk directly, so it is not necessary 3074cbdc634SGreg Leheyto specify the 3088fae3551SRodney W. Grimes.Fl r 3094cbdc634SGreg Leheyflag. 3104cbdc634SGreg Lehey.Pp 3114cbdc634SGreg LeheyThe bootstrap code is comprised of two boot programs. Specify the name of the 3124cbdc634SGreg Leheyboot programs to be installed in one of these ways: 3134cbdc634SGreg Lehey.Bl -enum 3144cbdc634SGreg Lehey.It 3154cbdc634SGreg LeheySpecify the names explicitly with the 3168fae3551SRodney W. Grimes.Fl b 3178fae3551SRodney W. Grimesand 3188fae3551SRodney W. Grimes.Fl s 3198fae3551SRodney W. Grimesflags. 3208fae3551SRodney W. Grimes.Fl b 3218fae3551SRodney W. Grimesindicates the primary boot program and 3228fae3551SRodney W. Grimes.Fl s 3234cbdc634SGreg Leheythe secondary boot program. The boot programs are located in 324efba76d7SJordan K. Hubbard.Pa /boot . 3254cbdc634SGreg Lehey.It 3264cbdc634SGreg LeheyIf the 3274cbdc634SGreg Lehey.Fl b 3284cbdc634SGreg Leheyand 3294cbdc634SGreg Lehey.Fl s 3304cbdc634SGreg Leheyflags are not specified, but 3318fae3551SRodney W. Grimes.Ar disktype 3324cbdc634SGreg Leheywas specified, the names of the programs are taken from the 3334cbdc634SGreg Lehey.if t ``b0'' and ``b1'' 3344cbdc634SGreg Lehey.if n "b0" and "b1" 3354cbdc634SGreg Leheyparameters of the 3364cbdc634SGreg Lehey.Xr disktab 5 3374cbdc634SGreg Leheyentry for the disk if the disktab entry exists and includes those parameters. 3384cbdc634SGreg Lehey.It 3394cbdc634SGreg LeheyOtherwise, the default boot image names are used: 340efba76d7SJordan K. Hubbard.Pa /boot/boot1 3418fae3551SRodney W. Grimesand 342efba76d7SJordan K. Hubbard.Pa /boot/boot2 343efba76d7SJordan K. Hubbardfor the standard stage1 and stage2 boot images (details may vary 344efba76d7SJordan K. Hubbardon architectures like the Alpha, where only a single-stage boot is used). 3454cbdc634SGreg Lehey.El 3468fae3551SRodney W. Grimes.Sh FILES 3478fae3551SRodney W. Grimes.Bl -tag -width Pa -compact 3488fae3551SRodney W. Grimes.It Pa /etc/disktab 349efba76d7SJordan K. Hubbard.It Pa /boot/ 350efba76d7SJordan K. Hubbard.It Pa /boot/boot<n> 3518fae3551SRodney W. Grimes.El 3524cbdc634SGreg Lehey.Sh SAVED FILE FORMAT 3534cbdc634SGreg Lehey.Nm 3544cbdc634SGreg Leheyuses an ASCII version of the label when examining, editing or restoring a disk 3554cbdc634SGreg Leheylabel. The format is: 3564cbdc634SGreg Lehey.Bd -literal -offset 4n 3574cbdc634SGreg Lehey# /dev/rda1c: 3584cbdc634SGreg Leheytype: SCSI 3594cbdc634SGreg Leheydisk: sd0s1 3604cbdc634SGreg Leheylabel: 3614cbdc634SGreg Leheyflags: 3624cbdc634SGreg Leheybytes/sector: 512 3634cbdc634SGreg Leheysectors/track: 51 3644cbdc634SGreg Leheytracks/cylinder: 19 3654cbdc634SGreg Leheysectors/cylinder: 969 3664cbdc634SGreg Leheycylinders: 1211 3674cbdc634SGreg Leheysectors/unit: 1173930 3684cbdc634SGreg Leheyrpm: 3600 3694cbdc634SGreg Leheyinterleave: 1 3704cbdc634SGreg Leheytrackskew: 0 3714cbdc634SGreg Leheycylinderskew: 0 3724cbdc634SGreg Leheyheadswitch: 0 # milliseconds 3734cbdc634SGreg Leheytrack-to-track seek: 0 # milliseconds 3744cbdc634SGreg Leheydrivedata: 0 3754cbdc634SGreg Lehey 3764cbdc634SGreg Lehey8 partitions: 3774cbdc634SGreg Lehey# size offset fstype [fsize bsize bps/cpg] 3784cbdc634SGreg Lehey a: 81920 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 84*) 3794cbdc634SGreg Lehey b: 160000 81920 swap # (Cyl. 84* - 218*) 3804cbdc634SGreg Lehey c: 1173930 0 unused 0 0 # (Cyl. 0 - 1211*) 3814cbdc634SGreg Lehey h: 962010 211920 vinum # (Cyl. 218*- 1211*) 3824cbdc634SGreg Lehey.Ed 3834cbdc634SGreg Lehey.Pp 3844cbdc634SGreg LeheyLines starting with a # mark are comments. Most of the other specifications are 3854cbdc634SGreg Leheyno longer used. The ones which must still be set correctly are: 3864cbdc634SGreg Lehey.Pp 3874cbdc634SGreg Lehey.Bl -hang -width 20n 3884cbdc634SGreg Lehey.It Nm label 3894cbdc634SGreg Leheyis an optional label, set by the 3904cbdc634SGreg Lehey.Ar packid 3914cbdc634SGreg Leheyoption when writing a label. 3924cbdc634SGreg Lehey.It Nm flags 3934cbdc634SGreg LeheyFlags may be 3944cbdc634SGreg Lehey.Ar removable , 3954cbdc634SGreg Lehey.Ar ecc 3964cbdc634SGreg Leheyor 3974cbdc634SGreg Lehey.Ar badsect . 3984cbdc634SGreg Lehey.Ar removable 3994cbdc634SGreg Leheyis set for removable media drives, but no current FreeBSD driver evaluates this 4004cbdc634SGreg Leheyflag. 4014cbdc634SGreg Lehey.Ar ecc 4024cbdc634SGreg Leheyis no longer supported; 4034cbdc634SGreg Lehey.Ar badsect 4044cbdc634SGreg Leheyspecifies that the drive can perform bad sector remapping. 4054cbdc634SGreg Lehey.It Nm sectors/unit 4064cbdc634SGreg Leheydescribes the total size of the disk. This value must be correct. 4074cbdc634SGreg Lehey.It Nm the partition table 4084cbdc634SGreg LeheyThis is the UNIX partition table, not the Microsoft partition table described in 4094cbdc634SGreg Lehey.Xr fdisk 8 . 4104cbdc634SGreg Lehey.El 4114cbdc634SGreg Lehey.Pp 4124cbdc634SGreg LeheyThe partition table can have up to 8 entries. It contains the following 4134cbdc634SGreg Leheyinformation: 4144cbdc634SGreg Lehey.Bl -hang -width 10n 4154cbdc634SGreg Lehey.It identifier 4164cbdc634SGreg LeheyThe partition identifier is a single letter in the range 4174cbdc634SGreg Lehey.Nm a 4184cbdc634SGreg Leheyto 4194cbdc634SGreg Lehey.Nm h . 4204cbdc634SGreg LeheyBy convention, partition 4214cbdc634SGreg Lehey.Nm c 4224cbdc634SGreg Leheyis reserved to describe the entire disk. 4234cbdc634SGreg Lehey.It size 4244cbdc634SGreg Leheyis the size of the partition in sectors. 4254cbdc634SGreg Lehey.It offset 4264cbdc634SGreg Leheyis the offset of the start of the partition from the beginning of the drive. 4274cbdc634SGreg Lehey.It fstype 4284cbdc634SGreg Leheydescribes the purpose of the partition. The example shows most normal usages. 4294cbdc634SGreg LeheyFor UFS file systems, use type 4.2BSD. See 4304cbdc634SGreg Lehey.Pa /usr/include/sys/disklabel.h 4314cbdc634SGreg Leheyfor a complete list. 4324cbdc634SGreg Lehey.It fsize 4334cbdc634SGreg LeheyFor file systems only, the fragment size. 4344cbdc634SGreg Lehey.It bsize 4354cbdc634SGreg LeheyFor file systems only, the block size. 4364cbdc634SGreg Lehey.It bps/cpg 4374cbdc634SGreg LeheyFor UFS file systems, the number of cylinders in a cylinder group. For LFS file 4384cbdc634SGreg Leheysystems, the segment shift value. 4394cbdc634SGreg Lehey.El 4404cbdc634SGreg LeheyThe remainder of the line is a comment and shows the cylinder allocations based 4414cbdc634SGreg Leheyon the obsolete (but possibly correct) geometry information about the drive. 4424cbdc634SGreg LeheyThe asterisk (*) indicates that the partition does not begin or end exactly on a 4434cbdc634SGreg Leheycylinder boundary. 4448fae3551SRodney W. Grimes.Sh EXAMPLES 4459f9930a2SRobert Nordier.Dl disklabel da0 4468fae3551SRodney W. Grimes.Pp 4474cbdc634SGreg LeheyDisplay the in-core label for 4484cbdc634SGreg Lehey.Pa da0 4494cbdc634SGreg Leheyas obtained via 4509f9930a2SRobert Nordier.Pa /dev/rda0c . 4518fae3551SRodney W. Grimes.Pp 4524cbdc634SGreg Lehey.Dl disklabel da0 > savedlabel 4534cbdc634SGreg Lehey.Pp 4544cbdc634SGreg LeheySave the in-core label for 4554cbdc634SGreg Lehey.Pa da0 4564cbdc634SGreg Leheyinto the file 4574cbdc634SGreg Lehey.Pa savedlabel . 4584cbdc634SGreg LeheyThis file can be used with the 4594cbdc634SGreg Lehey.Fl R 4604cbdc634SGreg Leheyflag to restore the label at a later date. 4614cbdc634SGreg Lehey.Pp 4629f9930a2SRobert Nordier.Dl disklabel -w -r /dev/rda0c da2212 foo 4638fae3551SRodney W. Grimes.Pp 4644cbdc634SGreg LeheyCreate a label for 4654cbdc634SGreg Lehey.Pa da0 4664cbdc634SGreg Leheybased on information for 4674cbdc634SGreg Lehey.if t ``da2212'' found in 4684cbdc634SGreg Lehey.if n "da2212" found in 4698fae3551SRodney W. Grimes.Pa /etc/disktab . 4708fae3551SRodney W. GrimesAny existing bootstrap code will be clobbered. 4718fae3551SRodney W. Grimes.Pp 4729f9930a2SRobert Nordier.Dl disklabel -e -r da0 4738fae3551SRodney W. Grimes.Pp 4744cbdc634SGreg LeheyRead the on-disk label for 4754cbdc634SGreg Lehey.Pa da0 , 4764cbdc634SGreg Leheyedit it and reinstall in-core as well as on-disk. Existing bootstrap code is 4774cbdc634SGreg Leheyunaffected. 4788fae3551SRodney W. Grimes.Pp 4799f9930a2SRobert Nordier.Dl disklabel -r -w da0 auto 480425bed3aSJoerg Wunsch.Pp 4814cbdc634SGreg LeheyTry to auto-detect the required information from 4824cbdc634SGreg Lehey.Pa da0 , 4834cbdc634SGreg Leheyand write a new label to the disk. Use another disklabel -e command to edit the 484425bed3aSJoerg Wunschpartitioning and file system information. 485425bed3aSJoerg Wunsch.Pp 4864cbdc634SGreg Lehey.Dl disklabel -R da0 savedlabel 4878fae3551SRodney W. Grimes.Pp 4884cbdc634SGreg LeheyRestore the on-disk and in-core label for 4894cbdc634SGreg Lehey.Pa da0 4904cbdc634SGreg Leheyfrom information in 4914cbdc634SGreg Lehey.Pa savedlabel . 4928fae3551SRodney W. GrimesExisting bootstrap code is unaffected. 4938fae3551SRodney W. Grimes.Pp 4949f9930a2SRobert Nordier.Dl disklabel -B da0 4958fae3551SRodney W. Grimes.Pp 4964cbdc634SGreg LeheyInstall a new bootstrap on 4974cbdc634SGreg Lehey.Pa da0 . 4988fae3551SRodney W. GrimesThe boot code comes from 499efba76d7SJordan K. Hubbard.Pa /boot/boot1 5008fae3551SRodney W. Grimesand possibly 501efba76d7SJordan K. Hubbard.Pa /boot/boot2 . 5028fae3551SRodney W. GrimesOn-disk and in-core labels are unchanged. 5038fae3551SRodney W. Grimes.Pp 5044cbdc634SGreg Lehey.Dl disklabel -w -B /dev/rda0c -b newboot1 -s newboot da2212 5058fae3551SRodney W. Grimes.Pp 5068fae3551SRodney W. GrimesInstall a new label and bootstrap. 5074cbdc634SGreg Lehey.if t The label is derived from disktab information for ``da2212'' and 5084cbdc634SGreg Lehey.if n The label is derived from disktab information for "da2212" and 5098fae3551SRodney W. Grimesinstalled both in-core and on-disk. 5104cbdc634SGreg LeheyThe bootstrap code comes from the files 5114cbdc634SGreg Lehey.Pa /boot/newboot1 5124cbdc634SGreg Leheyand 5134cbdc634SGreg Lehey.Pa /boot/newboot2 . 5148fae3551SRodney W. Grimes.Sh SEE ALSO 515af202156SWolfram Schneider.Xr disklabel 5 , 5164cbdc634SGreg Lehey.Xr disktab 5 , 517aa7c9adaSMike Pritchard.Xr boot0cfg 8 , 5184cbdc634SGreg Lehey.Xr fdisk 8 . 5198fae3551SRodney W. Grimes.Sh DIAGNOSTICS 5208fae3551SRodney W. GrimesThe kernel device drivers will not allow the size of a disk partition 5218fae3551SRodney W. Grimesto be decreased or the offset of a partition to be changed while it is open. 5228fae3551SRodney W. GrimesSome device drivers create a label containing only a single large partition 5234cbdc634SGreg Leheyif a disk is unlabeled; thus, the label must be written to the 5244cbdc634SGreg Lehey.if t ``a'' 5254cbdc634SGreg Lehey.if n "a" 5264cbdc634SGreg Leheypartition of the disk while it is open. This sometimes requires the desired 5274cbdc634SGreg Leheylabel to be set in two steps, the first one creating at least one other 5284cbdc634SGreg Leheypartition, and the second setting the label on the new partition while shrinking 5294cbdc634SGreg Leheythe 5304cbdc634SGreg Lehey.if t ``a'' 5314cbdc634SGreg Lehey.if n "a" 5324cbdc634SGreg Leheypartition. 5338fae3551SRodney W. Grimes.Pp 5348fae3551SRodney W. GrimesOn some machines the bootstrap code may not fit entirely in the area 5358fae3551SRodney W. Grimesallocated for it by some filesystems. 5368fae3551SRodney W. GrimesAs a result, it may not be possible to have filesystems on some partitions 5374cbdc634SGreg Lehey.if t of a ``bootable'' disk. 5384cbdc634SGreg Lehey.if n of a "bootable" disk. 5398fae3551SRodney W. GrimesWhen installing bootstrap code, 5406bd343a9SPhilippe Charnier.Nm 5418fae3551SRodney W. Grimeschecks for these cases. 5428fae3551SRodney W. GrimesIf the installed boot code would overlap a partition of type FS_UNUSED 5438fae3551SRodney W. Grimesit is marked as type FS_BOOT. 5448fae3551SRodney W. GrimesThe 5458fae3551SRodney W. Grimes.Xr newfs 8 5468fae3551SRodney W. Grimesutility will disallow creation of filesystems on FS_BOOT partitions. 5478fae3551SRodney W. GrimesConversely, if a partition has a type other than FS_UNUSED or FS_BOOT, 5486bd343a9SPhilippe Charnier.Nm 5498fae3551SRodney W. Grimeswill not install bootstrap code that overlaps it. 5508fae3551SRodney W. Grimes.Sh BUGS 5518fae3551SRodney W. GrimesWhen a disk name is given without a full pathname, 5524cbdc634SGreg Lehey.if t the constructed device name uses the ``c'' partition. 5534cbdc634SGreg Lehey.if n the constructed device name uses the "c" partition. 554d70e4e53SJoerg Wunsch.Pp 555d70e4e53SJoerg WunschFor the i386 architecture, the primary bootstrap sector contains 556d70e4e53SJoerg Wunschan embedded 557d70e4e53SJoerg Wunsch.Em fdisk 558d70e4e53SJoerg Wunschtable. 559d70e4e53SJoerg Wunsch.Nm Disklabel 560d70e4e53SJoerg Wunschtakes care to not clobber it when installing a bootstrap only 561d70e4e53SJoerg Wunsch.Pq Fl B , 562d70e4e53SJoerg Wunschor when editing an existing label 563d70e4e53SJoerg Wunsch.Pq Fl e , 564d70e4e53SJoerg Wunschbut it unconditionally writes the primary bootstrap program onto 565d70e4e53SJoerg Wunschthe disk for 566d70e4e53SJoerg Wunsch.Fl w 567d70e4e53SJoerg Wunschor 568d70e4e53SJoerg Wunsch.Fl R , 569d70e4e53SJoerg Wunschthus replacing the 570d70e4e53SJoerg Wunsch.Em fdisk 571d70e4e53SJoerg Wunschtable by the dummy one in the bootstrap program. This is only of 572d70e4e53SJoerg Wunschconcern if the disk is fully dedicated, so that the BSD disklabel 573d70e4e53SJoerg Wunschstarts at absolute block 0 on the disk. 5744cbdc634SGreg Lehey.Pp 5754cbdc634SGreg Lehey.Nm 5764cbdc634SGreg Leheydoes not perform adequate error checking. No warning is given if partitions 5774cbdc634SGreg Leheyoverlap, nor if space remains unused. 578