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 168fae3551SRodney W. Grimes.\" must display the following acknowledgement: 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 368fae3551SRodney W. Grimes.\" 378fae3551SRodney W. Grimes.Dd "April 19, 1994" 388fae3551SRodney W. Grimes.Dt DISKLABEL 8 398fae3551SRodney W. Grimes.Os BSD 4.2 408fae3551SRodney W. Grimes.Sh NAME 418fae3551SRodney W. Grimes.Nm disklabel 428fae3551SRodney W. Grimes.Nd read and write disk pack label 438fae3551SRodney W. Grimes.Sh SYNOPSIS 448fae3551SRodney W. Grimes.Nm disklabel 458fae3551SRodney W. Grimes.Op Fl r 468fae3551SRodney W. Grimes.Ar disk 478fae3551SRodney W. Grimes.Nm disklabel 488fae3551SRodney W. Grimes.Fl w 498fae3551SRodney W. Grimes.Op Fl r 508fae3551SRodney W. Grimes.Ar disk Ar disktype 518fae3551SRodney W. Grimes.Oo Ar packid Oc 528fae3551SRodney W. Grimes.Nm disklabel 538fae3551SRodney W. Grimes.Fl e 548fae3551SRodney W. Grimes.Op Fl r 558fae3551SRodney W. Grimes.Ar disk 568fae3551SRodney W. Grimes.Nm disklabel 578fae3551SRodney W. Grimes.Fl R 588fae3551SRodney W. Grimes.Op Fl r 598fae3551SRodney W. Grimes.Ar disk Ar protofile 608fae3551SRodney W. Grimes.Nm disklabel 618fae3551SRodney W. Grimes.Op Fl NW 628fae3551SRodney W. Grimes.Ar disk 638fae3551SRodney W. Grimes.sp 648fae3551SRodney W. Grimes.Nm disklabel 658fae3551SRodney W. Grimes.Fl B 668fae3551SRodney W. Grimes.Oo 678fae3551SRodney W. Grimes.Fl b Ar boot1 688fae3551SRodney W. Grimes.Op Fl s Ar boot2 698fae3551SRodney W. Grimes.Oc 708fae3551SRodney W. Grimes.Ar disk 718fae3551SRodney W. Grimes.Oo Ar disktype Oc 728fae3551SRodney W. Grimes.Nm disklabel 738fae3551SRodney W. Grimes.Fl w 748fae3551SRodney W. Grimes.Fl B 758fae3551SRodney W. Grimes.Oo 768fae3551SRodney W. Grimes.Fl b Ar boot1 778fae3551SRodney W. Grimes.Op Fl s Ar boot2 788fae3551SRodney W. Grimes.Oc 798fae3551SRodney W. Grimes.Ar disk Ar disktype 808fae3551SRodney W. Grimes.Oo Ar packid Oc 818fae3551SRodney W. Grimes.Nm disklabel 828fae3551SRodney W. Grimes.Fl R 838fae3551SRodney W. Grimes.Fl B 848fae3551SRodney W. Grimes.Oo 858fae3551SRodney W. Grimes.Fl b Ar boot1 868fae3551SRodney W. Grimes.Op Fl s Ar boot2 878fae3551SRodney W. Grimes.Oc 888fae3551SRodney W. Grimes.Ar disk Ar protofile 898fae3551SRodney W. Grimes.Oo Ar disktype Oc 908fae3551SRodney W. Grimes.Sh DESCRIPTION 918fae3551SRodney W. Grimes.Nm Disklabel 928fae3551SRodney W. Grimescan be used to install, examine or modify the label on a disk drive or pack. 938fae3551SRodney W. GrimesWhen writing the label, it can be used 948fae3551SRodney W. Grimesto change the drive identification, 958fae3551SRodney W. Grimesthe disk partitions on the drive, 968fae3551SRodney W. Grimesor to replace a damaged label. 978fae3551SRodney W. GrimesOn some systems, 988fae3551SRodney W. Grimes.Nm disklabel 998fae3551SRodney W. Grimescan be used to install bootstrap code as well. 1008fae3551SRodney W. GrimesThere are several forms of the command that read (display), install or edit 1018fae3551SRodney W. Grimesthe label on a disk. 1028fae3551SRodney W. GrimesEach form has an additional option, 1038fae3551SRodney W. Grimes.Fl r , 1048fae3551SRodney W. Grimeswhich causes the label to be read from or written to the disk directly, 1058fae3551SRodney W. Grimesrather than going through the system's in-core copy of the label. 1068fae3551SRodney W. GrimesThis option may allow a label to be installed on a disk 1078fae3551SRodney W. Grimeswithout kernel support for a label, such as when labels are first installed 1088fae3551SRodney W. Grimeson a system; it must be used when first installing a label on a disk. 1098fae3551SRodney W. GrimesThe specific effect of 1108fae3551SRodney W. Grimes.Fl r 1118fae3551SRodney W. Grimesis described under each command. 1128fae3551SRodney W. GrimesThe read and install forms also support the 1138fae3551SRodney W. Grimes.Fl B 1148fae3551SRodney W. Grimesoption to install bootstrap code. 1158fae3551SRodney W. GrimesThese variants are described later. 1168fae3551SRodney W. Grimes.Pp 1178fae3551SRodney W. GrimesThe first form of the command (read) is used to examine the label on the named 1188fae3551SRodney W. Grimesdisk drive (e.g. sd0 or /dev/rsd0c). 1198fae3551SRodney W. GrimesIt will display all of the parameters associated with the drive 1208fae3551SRodney W. Grimesand its partition layout. 1218fae3551SRodney W. GrimesUnless the 1228fae3551SRodney W. Grimes.Fl r 1238fae3551SRodney W. Grimesflag is given, 1248fae3551SRodney W. Grimesthe kernel's in-core copy of the label is displayed; 1258fae3551SRodney W. Grimesif the disk has no label, or the partition types on the disk are incorrect, 1268fae3551SRodney W. Grimesthe kernel may have constructed or modified the label. 1278fae3551SRodney W. GrimesIf the 1288fae3551SRodney W. Grimes.Fl r 1298fae3551SRodney W. Grimesflag is given, the label from the raw disk will be displayed rather 1308fae3551SRodney W. Grimesthan the in-core label. 1318fae3551SRodney W. Grimes.Pp 1328fae3551SRodney W. GrimesThe second form of the command, with the 1338fae3551SRodney W. Grimes.Fl w 1348fae3551SRodney W. Grimesflag, is used to write a standard label on the designated drive. 1358fae3551SRodney W. GrimesThe required arguments to 1368fae3551SRodney W. Grimes.Nm disklabel 1378fae3551SRodney W. Grimesare the drive to be labelled (e.g. sd0), and 1388fae3551SRodney W. Grimesthe drive type as described in the 1398fae3551SRodney W. Grimes.Xr disktab 5 1408fae3551SRodney W. Grimesfile. 1418fae3551SRodney W. GrimesThe drive parameters and partitions are taken from that file. 1428fae3551SRodney W. GrimesIf different disks of the same physical type are to have different 1438fae3551SRodney W. Grimespartitions, it will be necessary to have separate disktab entries 1448fae3551SRodney W. Grimesdescribing each, or to edit the label after installation as described below. 1458fae3551SRodney W. GrimesThe optional argument is a pack identification string, 1468fae3551SRodney W. Grimesup to 16 characters long. 1478fae3551SRodney W. GrimesThe pack id must be quoted if it contains blanks. 1488fae3551SRodney W. GrimesIf the 1498fae3551SRodney W. Grimes.Fl r 1508fae3551SRodney W. Grimesflag is given, the disk sectors containing the label and bootstrap 1518fae3551SRodney W. Grimeswill be written directly. 1528fae3551SRodney W. GrimesA side-effect of this is that any existing bootstrap code will be overwritten 1538fae3551SRodney W. Grimesand the disk rendered unbootable. 1548fae3551SRodney W. GrimesIf 1558fae3551SRodney W. Grimes.Fl r 1568fae3551SRodney W. Grimesis not specified, 1578fae3551SRodney W. Grimesthe existing label will be updated via the in-core copy and any bootstrap 1588fae3551SRodney W. Grimescode will be unaffected. 1598fae3551SRodney W. GrimesIf the disk does not already have a label, the 1608fae3551SRodney W. Grimes.Fl r 1618fae3551SRodney W. Grimesflag must be used. 1628fae3551SRodney W. GrimesIn either case, the kernel's in-core label is replaced. 1638fae3551SRodney W. Grimes.Pp 1648fae3551SRodney W. GrimesAn existing disk label may be edited by using the 1658fae3551SRodney W. Grimes.Fl e 1668fae3551SRodney W. Grimesflag. 1678fae3551SRodney W. GrimesThe label is read from the in-core kernel copy, 1688fae3551SRodney W. Grimesor directly from the disk if the 1698fae3551SRodney W. Grimes.Fl r 1708fae3551SRodney W. Grimesflag is also given. 1718fae3551SRodney W. GrimesThe label is formatted and then supplied to an editor for changes. 1728fae3551SRodney W. GrimesIf no editor is specified in an 1738fae3551SRodney W. Grimes.Ev EDITOR 1748fae3551SRodney W. Grimesenvironment variable, 1758fae3551SRodney W. Grimes.Xr vi 1 1768fae3551SRodney W. Grimesis used. 1778fae3551SRodney W. GrimesWhen the editor terminates, the formatted label is reread 1788fae3551SRodney W. Grimesand used to rewrite the disk label. 1798fae3551SRodney W. GrimesExisting bootstrap code is unchanged regardless of whether 1808fae3551SRodney W. Grimes.Fl r 1818fae3551SRodney W. Grimeswas specified. 1828fae3551SRodney W. Grimes.Pp 1838fae3551SRodney W. GrimesWith the 1848fae3551SRodney W. Grimes.Fl R 1858fae3551SRodney W. Grimesflag, 1868fae3551SRodney W. Grimes.Nm disklabel 1878fae3551SRodney W. Grimesis capable of restoring a disk label that was formatted 1888fae3551SRodney W. Grimesin a prior operation and saved in an ascii file. 1898fae3551SRodney W. GrimesThe prototype file used to create the label should be in the same format 1908fae3551SRodney W. Grimesas that produced when reading or editing a label. 1918fae3551SRodney W. GrimesComments are delimited by 1928fae3551SRodney W. Grimes.Ar \&# 1938fae3551SRodney W. Grimesand newline. 1948fae3551SRodney W. GrimesAs with 1958fae3551SRodney W. Grimes.Fl w , 1968fae3551SRodney W. Grimesany existing bootstrap code will be clobbered if 1978fae3551SRodney W. Grimes.Fl r 1988fae3551SRodney W. Grimesis specified and will be unaffected otherwise. 1998fae3551SRodney W. Grimes.Pp 2008fae3551SRodney W. GrimesThe 2018fae3551SRodney W. Grimes.Fl NW 2028fae3551SRodney W. Grimesflags for 2038fae3551SRodney W. Grimes.Nm disklabel 2048fae3551SRodney W. Grimesexplicitly disallow and 2058fae3551SRodney W. Grimesallow, respectively, writing of the pack label area on the selected disk. 2068fae3551SRodney W. Grimes.Pp 2078fae3551SRodney W. GrimesThe final three forms of 2088fae3551SRodney W. Grimes.Nm disklabel 2098fae3551SRodney W. Grimesare used to install boostrap code on machines where the bootstrap is part 2108fae3551SRodney W. Grimesof the label. 2118fae3551SRodney W. GrimesThe bootstrap code is comprised of one or two boot programs depending on 2128fae3551SRodney W. Grimesthe machine. 2138fae3551SRodney W. GrimesThe 2148fae3551SRodney W. Grimes.Fl B 2158fae3551SRodney W. Grimesoption is used to denote that bootstrap code is to be installed. 2168fae3551SRodney W. GrimesThe 2178fae3551SRodney W. Grimes.Fl r 2188fae3551SRodney W. Grimesflag is implied by 2198fae3551SRodney W. Grimes.Fl B 2208fae3551SRodney W. Grimesand never needs to be specified. 2218fae3551SRodney W. GrimesThe name of the boot program(s) to be installed can be selected in a 2228fae3551SRodney W. Grimesvariety of ways. 2238fae3551SRodney W. GrimesFirst, the names can be specified explicitly via the 2248fae3551SRodney W. Grimes.Fl b 2258fae3551SRodney W. Grimesand 2268fae3551SRodney W. Grimes.Fl s 2278fae3551SRodney W. Grimesflags. 2288fae3551SRodney W. GrimesOn machines with only a single level of boot program, 2298fae3551SRodney W. Grimes.Fl b 2308fae3551SRodney W. Grimesis the name of that program. 2318fae3551SRodney W. GrimesFor machines with a two-level bootstrap, 2328fae3551SRodney W. Grimes.Fl b 2338fae3551SRodney W. Grimesindicates the primary boot program and 2348fae3551SRodney W. Grimes.Fl s 2358fae3551SRodney W. Grimesthe secondary boot program. 2368fae3551SRodney W. GrimesIf the names are not explicitly given, standard boot programs will be used. 2378fae3551SRodney W. GrimesThe boot programs are located in 2388fae3551SRodney W. Grimes.Pa /usr/mdec . 2398fae3551SRodney W. GrimesThe names of the programs are taken from the ``b0'' and ``b1'' parameters 2408fae3551SRodney W. Grimesof the 2418fae3551SRodney W. Grimes.Xr disktab 5 2428fae3551SRodney W. Grimesentry for the disk if 2438fae3551SRodney W. Grimes.Ar disktype 2448fae3551SRodney W. Grimeswas given and its disktab entry exists and includes those parameters. 2458fae3551SRodney W. GrimesOtherwise, boot program names are derived from the name of the disk. 2468fae3551SRodney W. GrimesThese names are of the form 2478fae3551SRodney W. Grimes.Pa basename Ns boot 2488fae3551SRodney W. Grimesfor the primary (or only) bootstrap, and 2498fae3551SRodney W. Grimes.Pf boot Pa basename 2508fae3551SRodney W. Grimesfor the secondary bootstrap; 2518fae3551SRodney W. Grimesfor example, 2528fae3551SRodney W. Grimes.Pa /usr/mdec/sdboot 2538fae3551SRodney W. Grimesand 2548fae3551SRodney W. Grimes.Pa /usr/mdec/bootsd 2558fae3551SRodney W. Grimesif the disk device is 2568fae3551SRodney W. Grimes.Em sd0 . 2578fae3551SRodney W. Grimes.Pp 2588fae3551SRodney W. GrimesThe first of the three boot-installation forms is used to install 2598fae3551SRodney W. Grimesbootstrap code without changing the existing label. 2608fae3551SRodney W. GrimesIt is essentially a read command with respect to the disk label 2618fae3551SRodney W. Grimesitself and all options are related to the specification of the boot 2628fae3551SRodney W. Grimesprogram as described previously. 2638fae3551SRodney W. GrimesThe final two forms are analogous to the basic write and restore versions 2648fae3551SRodney W. Grimesexcept that they will install bootstrap code in addition to a new label. 2658fae3551SRodney W. Grimes.Sh FILES 2668fae3551SRodney W. Grimes.Bl -tag -width Pa -compact 2678fae3551SRodney W. Grimes.It Pa /etc/disktab 2688fae3551SRodney W. Grimes.It Pa /usr/mdec/ Ns Em xx Ns boot 2698fae3551SRodney W. Grimes.It Pa /usr/mdec/boot Ns Em xx 2708fae3551SRodney W. Grimes.El 2718fae3551SRodney W. Grimes.Sh EXAMPLES 2728fae3551SRodney W. Grimes.Dl disklabel sd0 2738fae3551SRodney W. Grimes.Pp 2748fae3551SRodney W. GrimesDisplay the in-core label for sd0 as obtained via 2758fae3551SRodney W. Grimes.Pa /dev/rsd0c . 2768fae3551SRodney W. Grimes.Pp 2778fae3551SRodney W. Grimes.Dl disklabel -w -r /dev/rsd0c sd2212 foo 2788fae3551SRodney W. Grimes.Pp 2798fae3551SRodney W. GrimesCreate a label for sd0 based on information for ``sd2212'' found in 2808fae3551SRodney W. Grimes.Pa /etc/disktab . 2818fae3551SRodney W. GrimesAny existing bootstrap code will be clobbered. 2828fae3551SRodney W. Grimes.Pp 2838fae3551SRodney W. Grimes.Dl disklabel -e -r sd0 2848fae3551SRodney W. Grimes.Pp 2858fae3551SRodney W. GrimesRead the on-disk label for sd0, edit it and reinstall in-core as well 2868fae3551SRodney W. Grimesas on-disk. 2878fae3551SRodney W. GrimesExisting bootstrap code is unaffected. 2888fae3551SRodney W. Grimes.Pp 2898fae3551SRodney W. Grimes.Dl disklabel -R sd0 mylabel 2908fae3551SRodney W. Grimes.Pp 2918fae3551SRodney W. GrimesRestore the on-disk and in-core label for sd0 from information in 2928fae3551SRodney W. Grimes.Pa mylabel . 2938fae3551SRodney W. GrimesExisting bootstrap code is unaffected. 2948fae3551SRodney W. Grimes.Pp 2958fae3551SRodney W. Grimes.Dl disklabel -B sd0 2968fae3551SRodney W. Grimes.Pp 2978fae3551SRodney W. GrimesInstall a new bootstrap on sd0. 2988fae3551SRodney W. GrimesThe boot code comes from 2998fae3551SRodney W. Grimes.Pa /usr/mdec/sdboot 3008fae3551SRodney W. Grimesand possibly 3018fae3551SRodney W. Grimes.Pa /usr/mdec/bootsd . 3028fae3551SRodney W. GrimesOn-disk and in-core labels are unchanged. 3038fae3551SRodney W. Grimes.Pp 3048fae3551SRodney W. Grimes.Dl disklabel -w -B /dev/rsd0c -b newboot sd2212 3058fae3551SRodney W. Grimes.Pp 3068fae3551SRodney W. GrimesInstall a new label and bootstrap. 3078fae3551SRodney W. GrimesThe label is derived from disktab information for ``sd2212'' and 3088fae3551SRodney W. Grimesinstalled both in-core and on-disk. 3098fae3551SRodney W. GrimesThe bootstrap code comes from the file 3108fae3551SRodney W. Grimes.Pa /usr/mdec/newboot . 3118fae3551SRodney W. Grimes.Sh SEE ALSO 3128fae3551SRodney W. Grimes.Xr disktab 5 , 3138fae3551SRodney W. Grimes.Xr disklabel 5 3148fae3551SRodney W. Grimes.Sh DIAGNOSTICS 3158fae3551SRodney W. GrimesThe kernel device drivers will not allow the size of a disk partition 3168fae3551SRodney W. Grimesto be decreased or the offset of a partition to be changed while it is open. 3178fae3551SRodney W. GrimesSome device drivers create a label containing only a single large partition 3188fae3551SRodney W. Grimesif a disk is unlabeled; thus, the label must be written to the ``a'' 3198fae3551SRodney W. Grimespartition of the disk while it is open. 3208fae3551SRodney W. GrimesThis sometimes requires the desired label to be set in two steps, 3218fae3551SRodney W. Grimesthe first one creating at least one other partition, 3228fae3551SRodney W. Grimesand the second setting the label on the new partition 3238fae3551SRodney W. Grimeswhile shrinking the ``a'' partition. 3248fae3551SRodney W. Grimes.Pp 3258fae3551SRodney W. GrimesOn some machines the bootstrap code may not fit entirely in the area 3268fae3551SRodney W. Grimesallocated for it by some filesystems. 3278fae3551SRodney W. GrimesAs a result, it may not be possible to have filesystems on some partitions 3288fae3551SRodney W. Grimesof a ``bootable'' disk. 3298fae3551SRodney W. GrimesWhen installing bootstrap code, 3308fae3551SRodney W. Grimes.Nm disklabel 3318fae3551SRodney W. Grimeschecks for these cases. 3328fae3551SRodney W. GrimesIf the installed boot code would overlap a partition of type FS_UNUSED 3338fae3551SRodney W. Grimesit is marked as type FS_BOOT. 3348fae3551SRodney W. GrimesThe 3358fae3551SRodney W. Grimes.Xr newfs 8 3368fae3551SRodney W. Grimesutility will disallow creation of filesystems on FS_BOOT partitions. 3378fae3551SRodney W. GrimesConversely, if a partition has a type other than FS_UNUSED or FS_BOOT, 3388fae3551SRodney W. Grimes.Nm disklabel 3398fae3551SRodney W. Grimeswill not install bootstrap code that overlaps it. 3408fae3551SRodney W. Grimes.Sh BUGS 3418fae3551SRodney W. GrimesWhen a disk name is given without a full pathname, 3428fae3551SRodney W. Grimesthe constructed device name uses the ``a'' partition on the tahoe, 3438fae3551SRodney W. Grimesthe ``c'' partition on all others. 344