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 367f3dea24SPeter Wemm.\" $FreeBSD$ 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 457c7fb079SRuslan Ermilov.Nm 468fae3551SRodney W. Grimes.Op Fl r 478fae3551SRodney W. Grimes.Ar disk 487c7fb079SRuslan Ermilov.Nm 498fae3551SRodney W. Grimes.Fl w 508fae3551SRodney W. Grimes.Op Fl r 513233afaeSJohn W. De Boskey.Op Fl n 52ff7d5162SJordan K. Hubbard.Ar disk Ar disktype/auto 538fae3551SRodney W. Grimes.Oo Ar packid Oc 547c7fb079SRuslan Ermilov.Nm 558fae3551SRodney W. Grimes.Fl e 568fae3551SRodney W. Grimes.Op Fl r 573233afaeSJohn W. De Boskey.Op Fl n 588fae3551SRodney W. Grimes.Ar disk 597c7fb079SRuslan Ermilov.Nm 608fae3551SRodney W. Grimes.Fl R 618fae3551SRodney W. Grimes.Op Fl r 623233afaeSJohn W. De Boskey.Op Fl n 638fae3551SRodney W. Grimes.Ar disk Ar protofile 647c7fb079SRuslan Ermilov.Nm 658fae3551SRodney W. Grimes.Op Fl NW 668fae3551SRodney W. Grimes.Ar disk 67726b61abSRuslan Ermilov.Pp 687c7fb079SRuslan Ermilov.Nm 698fae3551SRodney W. Grimes.Fl B 708fae3551SRodney W. Grimes.Oo 718fae3551SRodney W. Grimes.Fl b Ar boot1 724cbdc634SGreg Lehey.Fl s Ar boot2 738fae3551SRodney W. Grimes.Oc 748fae3551SRodney W. Grimes.Ar disk 75ff7d5162SJordan K. Hubbard.Oo Ar disktype/auto Oc 767c7fb079SRuslan Ermilov.Nm 778fae3551SRodney W. Grimes.Fl w 788fae3551SRodney W. Grimes.Fl B 793233afaeSJohn W. De Boskey.Op Fl n 808fae3551SRodney W. Grimes.Oo 818fae3551SRodney W. Grimes.Fl b Ar boot1 824cbdc634SGreg Lehey.Fl s Ar boot2 838fae3551SRodney W. Grimes.Oc 84ff7d5162SJordan K. Hubbard.Ar disk Ar disktype/auto 858fae3551SRodney W. Grimes.Oo Ar packid Oc 867c7fb079SRuslan Ermilov.Nm 878fae3551SRodney W. Grimes.Fl R 888fae3551SRodney W. Grimes.Fl B 893233afaeSJohn W. De Boskey.Op Fl n 908fae3551SRodney W. Grimes.Oo 918fae3551SRodney W. Grimes.Fl b Ar boot1 924cbdc634SGreg Lehey.Fl s Ar boot2 938fae3551SRodney W. Grimes.Oc 948fae3551SRodney W. Grimes.Ar disk Ar protofile 95ff7d5162SJordan K. Hubbard.Oo Ar disktype/auto Oc 968fae3551SRodney W. Grimes.Sh DESCRIPTION 978fae3551SRodney W. Grimes.Nm Disklabel 985a6d7397STim Vanderhoekinstalls, examines or modifies the label on a disk drive or pack. When writing 994cbdc634SGreg Leheythe label, it can be used to change the drive identification, the disk 1004cbdc634SGreg Leheypartitions on the drive, or to replace a damaged label. There are several forms 1014cbdc634SGreg Leheyof the command that read (display), install or edit the label on a disk. In 1024cbdc634SGreg Leheyaddition, 1036bd343a9SPhilippe Charnier.Nm 1044cbdc634SGreg Leheycan install bootstrap code. 1054cbdc634SGreg Lehey.Ss Raw or in-core label 1064cbdc634SGreg Lehey.Pp 1074cbdc634SGreg LeheyThe disk label is resident close to or at the beginning of each disk partition. 1084cbdc634SGreg LeheyFor faster access, the kernel maintains a copy in core at all times. By 1094cbdc634SGreg Leheydefault, most 1104cbdc634SGreg Lehey.Nm 1114cbdc634SGreg Leheyaccess the in-core copy of the label. To access the raw (on-disk) copy, use the 1124cbdc634SGreg Lehey.Fl r 1134cbdc634SGreg Leheyoption. This option allows a label to be installed on a disk without kernel 1144cbdc634SGreg Leheysupport for a label, such as when labels are first installed on a system; it 1154cbdc634SGreg Leheymust be used when first installing a label on a disk. The specific effect of 1168fae3551SRodney W. Grimes.Fl r 1178fae3551SRodney W. Grimesis described under each command. 1188fae3551SRodney W. Grimes.Pp 1194cbdc634SGreg Lehey.Ss Disk device name 1204cbdc634SGreg Lehey.Pp 1214cbdc634SGreg LeheyAll 1227c7fb079SRuslan Ermilov.Nm 1234cbdc634SGreg Leheyforms require a disk device name, which should always be the raw 124ff7d5162SJordan K. Hubbarddevice name representing the disk or slice. For example 125ff7d5162SJordan K. Hubbard.Pa da0 126ff7d5162SJordan K. Hubbardrepresents the entire disk irregardless of any DOS partitioning, 127ff7d5162SJordan K. Hubbardand 128ff7d5162SJordan K. Hubbard.Pa da0s1 129ff7d5162SJordan K. Hubbardrepresents a slice. Some devices, most notably 130ff7d5162SJordan K. Hubbard.Ar ccd , 131ff7d5162SJordan K. Hubbardrequire that the 132726b61abSRuslan Ermilov.Dq whole-disk 133726b61abSRuslan Ermilov(or 134726b61abSRuslan Ermilov.Dq c ) 135ff7d5162SJordan K. Hubbardpartition be specified. For example 136ff7d5162SJordan K. Hubbard.Pa ccd0c . 137ff7d5162SJordan K. HubbardYou do not have to include the 138ff7d5162SJordan K. Hubbard.Pa /dev/ 139ff7d5162SJordan K. Hubbardpath prefix when specifying the device. 1404cbdc634SGreg Lehey.Nm 141ff7d5162SJordan K. Hubbardwill automatically prepend it. 1424cbdc634SGreg Lehey.Ss Reading the disk label 1434cbdc634SGreg Lehey.Pp 1444cbdc634SGreg LeheyTo examine or save the label on a disk drive, use 1454cbdc634SGreg Lehey.Nm 1464cbdc634SGreg Leheywithout options: 1474cbdc634SGreg Lehey.Pp 1487c7fb079SRuslan Ermilov.Nm 1494cbdc634SGreg Lehey.Op Fl r 1504cbdc634SGreg Lehey.Ar disk 1514cbdc634SGreg Lehey.Pp 1524cbdc634SGreg Lehey.Ar disk 1534cbdc634SGreg Leheyrepresents the raw disk in question, and may be in the form 1544cbdc634SGreg Lehey.Pa da0 1554cbdc634SGreg Leheyor 15607b0cf9aSDavid E. O'Brien.Pa /dev/da0c . 1574cbdc634SGreg LeheyIt will display all of the parameters associated with the drive and its 1584cbdc634SGreg Leheypartition layout. Unless the 1598fae3551SRodney W. Grimes.Fl r 1608fae3551SRodney W. Grimesflag is given, 1618fae3551SRodney W. Grimesthe kernel's in-core copy of the label is displayed; 1628fae3551SRodney W. Grimesif the disk has no label, or the partition types on the disk are incorrect, 1638fae3551SRodney W. Grimesthe kernel may have constructed or modified the label. 1648fae3551SRodney W. GrimesIf the 1658fae3551SRodney W. Grimes.Fl r 1664cbdc634SGreg Leheyflag is given, 1674cbdc634SGreg Lehey.Nm 168ff7d5162SJordan K. Hubbardreads the label from the raw disk and displays it. Both versions are usually 169ff7d5162SJordan K. Hubbardidentical except in the case where a label has not yet been initialized or 170ff7d5162SJordan K. Hubbardis corrupt. 1714cbdc634SGreg Lehey.Ss Writing a standard label 1728fae3551SRodney W. Grimes.Pp 1734cbdc634SGreg LeheyTo write a standard label, use the form 1744cbdc634SGreg Lehey.Pp 1757c7fb079SRuslan Ermilov.Nm 1768fae3551SRodney W. Grimes.Fl w 1774cbdc634SGreg Lehey.Op Fl r 1783233afaeSJohn W. De Boskey.Op Fl n 179ff7d5162SJordan K. Hubbard.Ar disk Ar disktype/auto 1804cbdc634SGreg Lehey.Oo Ar packid Oc 1814cbdc634SGreg Lehey.Pp 1827c7fb079SRuslan Ermilov.Nm 183ff7d5162SJordan K. Hubbard.Fl w 184ff7d5162SJordan K. Hubbard.Op Fl r 1853233afaeSJohn W. De Boskey.Op Fl n 186ff7d5162SJordan K. Hubbard.Ar disk 187ff7d5162SJordan K. Hubbardauto 188ff7d5162SJordan K. Hubbard.Pp 1898fae3551SRodney W. GrimesThe required arguments to 1906bd343a9SPhilippe Charnier.Nm 1914cbdc634SGreg Leheyare the drive to be labeled and the drive type as described in the 192d0353b83SRuslan Ermilov.Xr disktab 5 1934cbdc634SGreg Leheyfile. The drive parameters and partitions are taken from that file. If 1944cbdc634SGreg Leheydifferent disks of the same physical type are to have different partitions, it 1954cbdc634SGreg Leheywill be necessary to have separate disktab entries describing each, or to edit 1964cbdc634SGreg Leheythe label after installation as described below. The optional argument is a 1974cbdc634SGreg Leheypack identification string, up to 16 characters long. The pack id must be 1983233afaeSJohn W. De Boskeyquoted if it contains blanks. 1993233afaeSJohn W. De Boskey.Pp 2003233afaeSJohn W. De BoskeyIf the 2013233afaeSJohn W. De Boskey.Fl n 2023233afaeSJohn W. De Boskeyflag is given, no data will be written to the device, and instead the 2033233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. 2043233afaeSJohn W. De Boskey.Pp 2053233afaeSJohn W. De BoskeyIf the 2068fae3551SRodney W. Grimes.Fl r 2078fae3551SRodney W. Grimesflag is given, the disk sectors containing the label and bootstrap 2088fae3551SRodney W. Grimeswill be written directly. 2098fae3551SRodney W. GrimesA side-effect of this is that any existing bootstrap code will be overwritten 2104cbdc634SGreg Leheyand the disk rendered unbootable. See the boot options below for a method of 2114cbdc634SGreg Leheywriting the label and the bootstrap at the same time. 2128fae3551SRodney W. GrimesIf 2138fae3551SRodney W. Grimes.Fl r 2148fae3551SRodney W. Grimesis not specified, 2158fae3551SRodney W. Grimesthe existing label will be updated via the in-core copy and any bootstrap 2168fae3551SRodney W. Grimescode will be unaffected. 2178fae3551SRodney W. GrimesIf the disk does not already have a label, the 2188fae3551SRodney W. Grimes.Fl r 2198fae3551SRodney W. Grimesflag must be used. 2208fae3551SRodney W. GrimesIn either case, the kernel's in-core label is replaced. 2218fae3551SRodney W. Grimes.Pp 222425bed3aSJoerg WunschFor a virgin disk that is not known to 223425bed3aSJoerg Wunsch.Xr disktab 5 , 224425bed3aSJoerg Wunsch.Ar disktype 225425bed3aSJoerg Wunschcan be specified as 226425bed3aSJoerg Wunsch.Dq auto . 227425bed3aSJoerg WunschIn this case, the driver is requested to produce a virgin label for the 228425bed3aSJoerg Wunschdisk. This might or might not be successful, depending on whether the 229425bed3aSJoerg Wunschdriver for the disk is able to get the required data without reading 230425bed3aSJoerg Wunschanything from the disk at all. It will likely succeed for all SCSI 231425bed3aSJoerg Wunschdisks, most IDE disks, and vnode devices. Writing a label to the 232425bed3aSJoerg Wunschdisk is the only supported operation, and the 233425bed3aSJoerg Wunsch.Ar disk 234425bed3aSJoerg Wunschitself must be provided as the canonical name, i.e. not as a full 235425bed3aSJoerg Wunschpath name. 236ff7d5162SJordan K. Hubbard.Pp 2373233afaeSJohn W. De BoskeyFor most harddisks, a label based on percentages for most partitions (and 2383233afaeSJohn W. De Boskeyone partition with a size of '*') will produce a reasonable configuration. 2393233afaeSJohn W. De Boskey.Pp 240ff7d5162SJordan K. HubbardPC-based systems have special requirements in order for the BIOS to properly 241b5c508fbSRuslan Ermilovrecognize a 242b5c508fbSRuslan Ermilov.Fx 243b5c508fbSRuslan Ermilovdisklabel. Older systems may require what is known as a 244726b61abSRuslan Ermilov.Dq dangerously dedicated 245ff7d5162SJordan K. Hubbarddisklabel, which creates a fake DOS partition to work around problems older 246ff7d5162SJordan K. HubbardBIOSes have with modern disk geometries. On newer systems you generally want 247ff7d5162SJordan K. Hubbardto create a normal DOS slice using 248ff7d5162SJordan K. Hubbard.Ar fdisk 249b5c508fbSRuslan Ermilovand then create a 250b5c508fbSRuslan Ermilov.Fx 251b5c508fbSRuslan Ermilovdisklabel within that slice. This is described 252ff7d5162SJordan K. Hubbardlater on in this page. 253ff7d5162SJordan K. Hubbard.Pp 254ff7d5162SJordan K. HubbardInstalling a new disklabel does not in of itself allow your system to boot 255ff7d5162SJordan K. Hubbarda kernel using that label. You must also install boot blocks, which is 256ff7d5162SJordan K. Hubbarddescribed later on in this manual page. 2574cbdc634SGreg Lehey.Ss Editing an existing disk label 258425bed3aSJoerg Wunsch.Pp 2594cbdc634SGreg LeheyTo edit an existing disk label, use the form 2604cbdc634SGreg Lehey.Pp 2617c7fb079SRuslan Ermilov.Nm 2628fae3551SRodney W. Grimes.Fl e 2634cbdc634SGreg Lehey.Op Fl r 2643233afaeSJohn W. De Boskey.Op Fl n 2654cbdc634SGreg Lehey.Ar disk 2664cbdc634SGreg Lehey.Pp 2674cbdc634SGreg LeheyThis command reads the label from the in-core kernel copy, or directly from the 2684cbdc634SGreg Leheydisk if the 2698fae3551SRodney W. Grimes.Fl r 2704cbdc634SGreg Leheyflag is also specified. The label is written to a file in ASCII and then 2714cbdc634SGreg Leheysupplied to an editor for changes. If no editor is specified in an 2728fae3551SRodney W. Grimes.Ev EDITOR 2738fae3551SRodney W. Grimesenvironment variable, 2748fae3551SRodney W. Grimes.Xr vi 1 2754cbdc634SGreg Leheyis used. When the editor terminates, the label file is used to rewrite the disk 2764cbdc634SGreg Leheylabel. Existing bootstrap code is unchanged regardless of whether 2778fae3551SRodney W. Grimes.Fl r 2783233afaeSJohn W. De Boskeywas specified. If 2793233afaeSJohn W. De Boskey.Fl n 2803233afaeSJohn W. De Boskeyis specified, no data will be written to the device, and instead the 2813233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. This is 2823233afaeSJohn W. De Boskeyuseful to see how a partitioning scheme will work out for a specific disk. 2834cbdc634SGreg Lehey.Ss Restoring a disk label from a file 2848fae3551SRodney W. Grimes.Pp 2854cbdc634SGreg LeheyTo restore a disk label from a file, use the form 2864cbdc634SGreg Lehey.Pp 2877c7fb079SRuslan Ermilov.Nm 2888fae3551SRodney W. Grimes.Fl R 2894cbdc634SGreg Lehey.Op Fl r 2903233afaeSJohn W. De Boskey.Op Fl n 2914cbdc634SGreg Lehey.Ar disk Ar protofile 2928fae3551SRodney W. Grimes.Pp 2936bd343a9SPhilippe Charnier.Nm 2945ef18a82SGreg Leheyis capable of restoring a disk label that was previously saved in a file in ASCII format. 2954cbdc634SGreg LeheyThe prototype file used to create the label should be in the same format as that 2964cbdc634SGreg Leheyproduced when reading or editing a label. Comments are delimited by 2974cbdc634SGreg Lehey.Ar \&# 2984cbdc634SGreg Leheyand newline. As when writing a new label, any existing bootstrap code will be 2994cbdc634SGreg Leheyclobbered if 3004cbdc634SGreg Lehey.Fl r 3014cbdc634SGreg Leheyis specified and will be unaffected otherwise. See the boot options below for a 3024cbdc634SGreg Leheymethod of restoring the label and writing the bootstrap at the same time. 3033233afaeSJohn W. De BoskeyIf 3043233afaeSJohn W. De Boskey.Fl n 3053233afaeSJohn W. De Boskeyis used, no data will be written to the device, and instead the 3063233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. This is 3073233afaeSJohn W. De Boskeyuseful to see how a partitioning scheme will work out for a specific disk. 3084cbdc634SGreg Lehey.Ss Enabling and disabling writing to the disk label area 3094cbdc634SGreg Lehey.Pp 3104cbdc634SGreg LeheyBy default, it is not possible to write to the disk label area at the beginning 3114cbdc634SGreg Leheyof a disk. The disk driver silently ignores any attempt to do so. If you need 3124cbdc634SGreg Leheyto write to this area (for example, to obliterate the label), use the form 3134cbdc634SGreg Lehey.Pp 3147c7fb079SRuslan Ermilov.Nm 3154cbdc634SGreg Lehey.Op Fl W 3164cbdc634SGreg Lehey.Ar disk 3174cbdc634SGreg Lehey.Pp 3184cbdc634SGreg LeheyTo disallow writing to the label area after previously allowing it, use the 3194cbdc634SGreg Leheycommand 3204cbdc634SGreg Lehey.Pp 3217c7fb079SRuslan Ermilov.Nm 3224cbdc634SGreg Lehey.Op Fl N 3234cbdc634SGreg Lehey.Ar disk 3244cbdc634SGreg Lehey.Ss Installing bootstraps 3258fae3551SRodney W. Grimes.Pp 3268fae3551SRodney W. GrimesThe final three forms of 3276bd343a9SPhilippe Charnier.Nm 328ff7d5162SJordan K. Hubbardare used to install bootstrap code. If you are creating a 329726b61abSRuslan Ermilov.Dq dangerously-dedicated 330726b61abSRuslan Ermilovpartition for compatibility with older PC systems, 331ff7d5162SJordan K. Hubbardyou generally want to specify the raw disk name such as 332ff7d5162SJordan K. Hubbard.Pa da0 . 333ff7d5162SJordan K. HubbardIf you are creating a label within an existing DOS slice, you should specify 334ff7d5162SJordan K. Hubbardthe slice name such as 335ff7d5162SJordan K. Hubbard.Pa da0s1 . 336ff7d5162SJordan K. HubbardMaking a partition bootable can be tricky. If you are using a normal DOS 337ff7d5162SJordan K. Hubbardslice you typically install (or leave) a standard MBR on the base disk and 338b5c508fbSRuslan Ermilovthen install the 339b5c508fbSRuslan Ermilov.Fx 340b5c508fbSRuslan Ermilovbootblocks in the slice. 3414cbdc634SGreg Lehey.Pp 3427c7fb079SRuslan Ermilov.Nm 3438fae3551SRodney W. Grimes.Fl B 3444cbdc634SGreg Lehey.Oo 3454cbdc634SGreg Lehey.Fl b Ar boot1 3464cbdc634SGreg Lehey.Fl s Ar boot2 3474cbdc634SGreg Lehey.Oc 3484cbdc634SGreg Lehey.Ar disk 3494cbdc634SGreg Lehey.Oo Ar disktype Oc 3504cbdc634SGreg Lehey.Pp 3514cbdc634SGreg LeheyThis form installs the bootstrap only. It does not change the disk label. 352726b61abSRuslan ErmilovYou should never use this command on a base disk unless you intend to create a 353726b61abSRuslan Ermilov.Dq dangerously-dedicated 354726b61abSRuslan Ermilovdisk, such as 355ff7d5162SJordan K. Hubbard.Ar da0 . 356ff7d5162SJordan K. HubbardThis command is typically run on a slice such as 357ff7d5162SJordan K. Hubbard.Ar da0s1 . 3584cbdc634SGreg Lehey.Pp 3597c7fb079SRuslan Ermilov.Nm 3604cbdc634SGreg Lehey.Fl w 3614cbdc634SGreg Lehey.Fl B 3623233afaeSJohn W. De Boskey.Op Fl n 3634cbdc634SGreg Lehey.Oo 3644cbdc634SGreg Lehey.Fl b Ar boot1 3654cbdc634SGreg Lehey.Fl s Ar boot2 3664cbdc634SGreg Lehey.Oc 3674cbdc634SGreg Lehey.Ar disk Ar disktype 3684cbdc634SGreg Lehey.Oo Ar packid Oc 3694cbdc634SGreg Lehey.Pp 370726b61abSRuslan ErmilovThis form corresponds to the 371726b61abSRuslan Ermilov.Dq write label 372726b61abSRuslan Ermilovcommand described above. 3734cbdc634SGreg LeheyIn addition to writing a new volume label, it also installs the bootstrap. 374726b61abSRuslan ErmilovIf run on a base disk this command will create a 375726b61abSRuslan Ermilov.Dq dangerously-dedicated 376b60884cdSBen Smithurstlabel. This command is normally run on a slice rather than a base disk. 3773233afaeSJohn W. De BoskeyIf 3783233afaeSJohn W. De Boskey.Fl n 3793233afaeSJohn W. De Boskeyis used, no data will be written to the device, and instead the 3803233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. 3814cbdc634SGreg Lehey.Pp 3827c7fb079SRuslan Ermilov.Nm 3834cbdc634SGreg Lehey.Fl R 3844cbdc634SGreg Lehey.Fl B 3853233afaeSJohn W. De Boskey.Op Fl n 3864cbdc634SGreg Lehey.Oo 3874cbdc634SGreg Lehey.Fl b Ar boot1 3884cbdc634SGreg Lehey.Fl s Ar boot2 3894cbdc634SGreg Lehey.Oc 3904cbdc634SGreg Lehey.Ar disk Ar protofile 3914cbdc634SGreg Lehey.Oo Ar disktype Oc 3924cbdc634SGreg Lehey.Pp 393726b61abSRuslan ErmilovThis form corresponds to the 394726b61abSRuslan Ermilov.Dq restore label 395726b61abSRuslan Ermilovcommand described above. 3964cbdc634SGreg LeheyIn addition to restoring the volume label, it also installs the bootstrap. 397726b61abSRuslan ErmilovIf run on a base disk this command will create a 398726b61abSRuslan Ermilov.Dq dangerously-dedicated 399b60884cdSBen Smithurstlabel. This command is normally run on a slice rather than a base disk. 4004cbdc634SGreg Lehey.Pp 4014cbdc634SGreg LeheyThe bootstrap commands always access the disk directly, so it is not necessary 4024cbdc634SGreg Leheyto specify the 4038fae3551SRodney W. Grimes.Fl r 4043233afaeSJohn W. De Boskeyflag. If 4053233afaeSJohn W. De Boskey.Fl n 4063233afaeSJohn W. De Boskeyis used, no data will be written to the device, and instead the 4073233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. 4084cbdc634SGreg Lehey.Pp 4094cbdc634SGreg LeheyThe bootstrap code is comprised of two boot programs. Specify the name of the 4104cbdc634SGreg Leheyboot programs to be installed in one of these ways: 4114cbdc634SGreg Lehey.Bl -enum 4124cbdc634SGreg Lehey.It 4134cbdc634SGreg LeheySpecify the names explicitly with the 4148fae3551SRodney W. Grimes.Fl b 4158fae3551SRodney W. Grimesand 4168fae3551SRodney W. Grimes.Fl s 4178fae3551SRodney W. Grimesflags. 4188fae3551SRodney W. Grimes.Fl b 4198fae3551SRodney W. Grimesindicates the primary boot program and 4208fae3551SRodney W. Grimes.Fl s 4214cbdc634SGreg Leheythe secondary boot program. The boot programs are located in 422efba76d7SJordan K. Hubbard.Pa /boot . 4234cbdc634SGreg Lehey.It 4244cbdc634SGreg LeheyIf the 4254cbdc634SGreg Lehey.Fl b 4264cbdc634SGreg Leheyand 4274cbdc634SGreg Lehey.Fl s 4284cbdc634SGreg Leheyflags are not specified, but 4298fae3551SRodney W. Grimes.Ar disktype 4304cbdc634SGreg Leheywas specified, the names of the programs are taken from the 431726b61abSRuslan Ermilov.Dq b0 432726b61abSRuslan Ermilovand 433726b61abSRuslan Ermilov.Dq b1 4344cbdc634SGreg Leheyparameters of the 4354cbdc634SGreg Lehey.Xr disktab 5 4364cbdc634SGreg Leheyentry for the disk if the disktab entry exists and includes those parameters. 4374cbdc634SGreg Lehey.It 4384cbdc634SGreg LeheyOtherwise, the default boot image names are used: 439efba76d7SJordan K. Hubbard.Pa /boot/boot1 4408fae3551SRodney W. Grimesand 441efba76d7SJordan K. Hubbard.Pa /boot/boot2 442efba76d7SJordan K. Hubbardfor the standard stage1 and stage2 boot images (details may vary 443efba76d7SJordan K. Hubbardon architectures like the Alpha, where only a single-stage boot is used). 4444cbdc634SGreg Lehey.El 445ff7d5162SJordan K. Hubbard.Ss Initializing/Formatting a bootable disk from scratch 446ff7d5162SJordan K. Hubbard.Pp 447ff7d5162SJordan K. HubbardTo initialize a disk from scratch the following sequence is recommended. 448ff7d5162SJordan K. HubbardPlease note that this will wipe everything that was previously on the disk, 449b5c508fbSRuslan Ermilovincluding any 450b5c508fbSRuslan Ermilov.No non- Ns Fx 451b5c508fbSRuslan Ermilovslices. 452ff7d5162SJordan K. Hubbard.Bl -enum 453ff7d5162SJordan K. Hubbard.It 454ff7d5162SJordan K. HubbardUse 455ff7d5162SJordan K. Hubbard.Ar fdisk 456ff7d5162SJordan K. Hubbardto initialize the DOS partition table, creating a real whole-disk slice to 457b5c508fbSRuslan Ermilovhold the 458b5c508fbSRuslan Ermilov.Fx 459b5c508fbSRuslan Ermilovdisklabel, and installing a master boot record. 460ff7d5162SJordan K. Hubbard.It 461ff7d5162SJordan K. HubbardUse 462ff7d5162SJordan K. Hubbard.Ar disklabel 463b5c508fbSRuslan Ermilovto initialize a virgin 464b5c508fbSRuslan Ermilov.Fx 465b5c508fbSRuslan Ermilovdisklabel and install 466b5c508fbSRuslan Ermilov.Fx 467b5c508fbSRuslan Ermilovboot blocks. 468ff7d5162SJordan K. Hubbard.It 469ff7d5162SJordan K. HubbardUse 470ff7d5162SJordan K. Hubbard.Ar disklabel 471b60884cdSBen Smithurstto edit your newly created label, adding appropriate partitions. 472ff7d5162SJordan K. Hubbard.It 473ff7d5162SJordan K. HubbardFinally newfs the filesystem partitions you created in the label. A typical 474b60884cdSBen Smithurstdisklabel partitioning scheme would be to have an 475726b61abSRuslan Ermilov.Dq a 476726b61abSRuslan Ermilovpartition 477726b61abSRuslan Ermilovof approximately 128MB to hold the root filesystem, a 478726b61abSRuslan Ermilov.Dq b 479726b61abSRuslan Ermilovpartition for 480726b61abSRuslan Ermilovswap, a 481726b61abSRuslan Ermilov.Dq d 482726b61abSRuslan Ermilovpartition for /var (usually 128MB), an 483726b61abSRuslan Ermilov.Dq e 484726b61abSRuslan Ermilovpartition 485726b61abSRuslan Ermilovfor /var/tmp (usually 128MB), an 486726b61abSRuslan Ermilov.Dq f 487726b61abSRuslan Ermilovpartition for /usr (usually around 2G), 488726b61abSRuslan Ermilovand finally a 489726b61abSRuslan Ermilov.Dq g 490b60884cdSBen Smithurstpartition for /home (usually all remaining space). 491ff7d5162SJordan K. HubbardYour mileage may vary. 492ff7d5162SJordan K. Hubbard.El 493ff7d5162SJordan K. Hubbard.Pp 4947c7fb079SRuslan Ermilov.Nm fdisk Fl BI Ar da0 495ff7d5162SJordan K. Hubbard.Pp 4967c7fb079SRuslan Ermilov.Nm 497ff7d5162SJordan K. Hubbard.Fl w 498ff7d5162SJordan K. Hubbard.Fl r 499ff7d5162SJordan K. Hubbard.Fl B 500ff7d5162SJordan K. Hubbard.Ar da0s1 501ff7d5162SJordan K. Hubbardauto 502ff7d5162SJordan K. Hubbard.Pp 503ff7d5162SJordan K. Hubbard.Pp 5047c7fb079SRuslan Ermilov.Nm 505ff7d5162SJordan K. Hubbard.Fl e 506ff7d5162SJordan K. Hubbard.Ar da0s1 507ff7d5162SJordan K. Hubbard.Pp 5088fae3551SRodney W. Grimes.Sh FILES 5098fae3551SRodney W. Grimes.Bl -tag -width Pa -compact 5108fae3551SRodney W. Grimes.It Pa /etc/disktab 511efba76d7SJordan K. Hubbard.It Pa /boot/ 512efba76d7SJordan K. Hubbard.It Pa /boot/boot<n> 5138fae3551SRodney W. Grimes.El 5144cbdc634SGreg Lehey.Sh SAVED FILE FORMAT 5154cbdc634SGreg Lehey.Nm 5164cbdc634SGreg Leheyuses an ASCII version of the label when examining, editing or restoring a disk 5174cbdc634SGreg Leheylabel. The format is: 5184cbdc634SGreg Lehey.Bd -literal -offset 4n 51907b0cf9aSDavid E. O'Brien# /dev/da1c: 5204cbdc634SGreg Leheytype: SCSI 52107b0cf9aSDavid E. O'Briendisk: da0s1 5224cbdc634SGreg Leheylabel: 5234cbdc634SGreg Leheyflags: 5244cbdc634SGreg Leheybytes/sector: 512 5254cbdc634SGreg Leheysectors/track: 51 5264cbdc634SGreg Leheytracks/cylinder: 19 5274cbdc634SGreg Leheysectors/cylinder: 969 5284cbdc634SGreg Leheycylinders: 1211 5294cbdc634SGreg Leheysectors/unit: 1173930 5304cbdc634SGreg Leheyrpm: 3600 5314cbdc634SGreg Leheyinterleave: 1 5324cbdc634SGreg Leheytrackskew: 0 5334cbdc634SGreg Leheycylinderskew: 0 5344cbdc634SGreg Leheyheadswitch: 0 # milliseconds 5354cbdc634SGreg Leheytrack-to-track seek: 0 # milliseconds 5364cbdc634SGreg Leheydrivedata: 0 5374cbdc634SGreg Lehey 5384cbdc634SGreg Lehey8 partitions: 5394cbdc634SGreg Lehey# size offset fstype [fsize bsize bps/cpg] 5404cbdc634SGreg Lehey a: 81920 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 84*) 5414cbdc634SGreg Lehey b: 160000 81920 swap # (Cyl. 84* - 218*) 5424cbdc634SGreg Lehey c: 1173930 0 unused 0 0 # (Cyl. 0 - 1211*) 5434cbdc634SGreg Lehey h: 962010 211920 vinum # (Cyl. 218*- 1211*) 5444cbdc634SGreg Lehey.Ed 5454cbdc634SGreg Lehey.Pp 5464cbdc634SGreg LeheyLines starting with a # mark are comments. Most of the other specifications are 5474cbdc634SGreg Leheyno longer used. The ones which must still be set correctly are: 5484cbdc634SGreg Lehey.Pp 5494cbdc634SGreg Lehey.Bl -hang -width 20n 5504cbdc634SGreg Lehey.It Nm label 5514cbdc634SGreg Leheyis an optional label, set by the 5524cbdc634SGreg Lehey.Ar packid 5534cbdc634SGreg Leheyoption when writing a label. 5544cbdc634SGreg Lehey.It Nm flags 5554cbdc634SGreg LeheyFlags may be 5564cbdc634SGreg Lehey.Ar removable , 5574cbdc634SGreg Lehey.Ar ecc 5584cbdc634SGreg Leheyor 5594cbdc634SGreg Lehey.Ar badsect . 5604cbdc634SGreg Lehey.Ar removable 561b5c508fbSRuslan Ermilovis set for removable media drives, but no current 562b5c508fbSRuslan Ermilov.Fx 563b5c508fbSRuslan Ermilovdriver evaluates this 5644cbdc634SGreg Leheyflag. 5654cbdc634SGreg Lehey.Ar ecc 5664cbdc634SGreg Leheyis no longer supported; 5674cbdc634SGreg Lehey.Ar badsect 5684cbdc634SGreg Leheyspecifies that the drive can perform bad sector remapping. 5694cbdc634SGreg Lehey.It Nm sectors/unit 5704cbdc634SGreg Leheydescribes the total size of the disk. This value must be correct. 5714cbdc634SGreg Lehey.It Nm the partition table 5724cbdc634SGreg LeheyThis is the UNIX partition table, not the Microsoft partition table described in 5734cbdc634SGreg Lehey.Xr fdisk 8 . 5744cbdc634SGreg Lehey.El 5754cbdc634SGreg Lehey.Pp 5764cbdc634SGreg LeheyThe partition table can have up to 8 entries. It contains the following 5774cbdc634SGreg Leheyinformation: 5784cbdc634SGreg Lehey.Bl -hang -width 10n 5794cbdc634SGreg Lehey.It identifier 5804cbdc634SGreg LeheyThe partition identifier is a single letter in the range 5814cbdc634SGreg Lehey.Nm a 5824cbdc634SGreg Leheyto 5834cbdc634SGreg Lehey.Nm h . 5844cbdc634SGreg LeheyBy convention, partition 5854cbdc634SGreg Lehey.Nm c 5864cbdc634SGreg Leheyis reserved to describe the entire disk. 5874cbdc634SGreg Lehey.It size 5883233afaeSJohn W. De Boskeyis the size of the partition in sectors, 5893233afaeSJohn W. De Boskey.Nm K 5903233afaeSJohn W. De Boskey(kilobytes - 1024), 5913233afaeSJohn W. De Boskey.Nm M 5923233afaeSJohn W. De Boskey(megabytes - 1024*1024), 5933233afaeSJohn W. De Boskey.Nm G 5943233afaeSJohn W. De Boskey(gigabytes - 1024*1024*1024), 5953233afaeSJohn W. De Boskey.Nm % 5963233afaeSJohn W. De Boskey(percentage of free space AFTER removing any fixed-size partitions other 5973233afaeSJohn W. De Boskeythan partition 5983233afaeSJohn W. De Boskey.Nm c 5993233afaeSJohn W. De Boskey), or * (all remaining free space AFTER fixed-size and percentage 6003233afaeSJohn W. De Boskeypartitions). For partition 6013233afaeSJohn W. De Boskey.Nm c , 6023233afaeSJohn W. De Boskeya size of * indicates the entire disk. Lowercase versions of K, M, and G 6033233afaeSJohn W. De Boskeyare allowed. 6043233afaeSJohn W. De BoskeySize and type should be specifed without any spaces between them. 6053233afaeSJohn W. De Boskey.Pp 6063233afaeSJohn W. De BoskeyExample: 2097152, 1g, 1024m and 1048576k are all the same size 6073233afaeSJohn W. De Boskey(assuming 512-byte sectors). 6084cbdc634SGreg Lehey.It offset 6093233afaeSJohn W. De Boskeyis the offset of the start of the partition from the beginning of the 6103233afaeSJohn W. De Boskeydrive in sectors, or * to have 6113233afaeSJohn W. De Boskey.Nm 6123233afaeSJohn W. De Boskeycalculate the correct offset to use (the end of the previous partition plus 6133233afaeSJohn W. De Boskeyone, ignoring partition 6143233afaeSJohn W. De Boskey.Nm c . 6153233afaeSJohn W. De BoskeyFor partition 6163233afaeSJohn W. De Boskey.Nm c , 6173233afaeSJohn W. De Boskey* will be interpreted as an offset of 0. 6184cbdc634SGreg Lehey.It fstype 6194cbdc634SGreg Leheydescribes the purpose of the partition. The example shows most normal usages. 6203233afaeSJohn W. De BoskeyFor UFS file systems, use type 6213233afaeSJohn W. De Boskey.Nm 4.2BSD . 6223233afaeSJohn W. De BoskeyOther common types are 6233233afaeSJohn W. De Boskey.Nm unused 6243233afaeSJohn W. De Boskeyand 6253233afaeSJohn W. De Boskey.Nm swap . 6263233afaeSJohn W. De BoskeySee 6274cbdc634SGreg Lehey.Pa /usr/include/sys/disklabel.h 6284cbdc634SGreg Leheyfor a complete list. 6294cbdc634SGreg Lehey.It fsize 6303233afaeSJohn W. De BoskeyFor 6313233afaeSJohn W. De Boskey.Nm 4.2BSD 6323233afaeSJohn W. De Boskeyand LFS file systems only, the fragment size. Defaults to 8192 for 6333233afaeSJohn W. De Boskeypartitions smaller than 1 GB, 16384 for partitions 1GB or larger. 6344cbdc634SGreg Lehey.It bsize 6353233afaeSJohn W. De BoskeyFor 6363233afaeSJohn W. De Boskey.Nm 4.2BSD 6373233afaeSJohn W. De Boskeyand LFS file systems only, the block size. Defaults to 1024 for 6383233afaeSJohn W. De Boskeypartitions smaller than 1 GB, 4096 for partitions 1GB or larger. 6394cbdc634SGreg Lehey.It bps/cpg 6403233afaeSJohn W. De BoskeyFor 6413233afaeSJohn W. De Boskey.Nm 4.2BSD 6423233afaeSJohn W. De Boskeyfile systems, the number of cylinders in a cylinder group. For LFS file 6433233afaeSJohn W. De Boskeysystems, the segment shift value. Defaults to 16 for 6443233afaeSJohn W. De Boskeypartitions smaller than 1 GB, 64 for partitions 1GB or larger. 6454cbdc634SGreg Lehey.El 646b60884cdSBen Smithurst.Pp 6474cbdc634SGreg LeheyThe remainder of the line is a comment and shows the cylinder allocations based 6484cbdc634SGreg Leheyon the obsolete (but possibly correct) geometry information about the drive. 6494cbdc634SGreg LeheyThe asterisk (*) indicates that the partition does not begin or end exactly on a 6504cbdc634SGreg Leheycylinder boundary. 6518fae3551SRodney W. Grimes.Sh EXAMPLES 6529f9930a2SRobert Nordier.Dl disklabel da0 6538fae3551SRodney W. Grimes.Pp 6544cbdc634SGreg LeheyDisplay the in-core label for 655ff7d5162SJordan K. Hubbard.Pa da0s1 6564cbdc634SGreg Leheyas obtained via 657ff7d5162SJordan K. Hubbard.Pa /dev/da0s1 . 658b5c508fbSRuslan ErmilovWhen reading a label, 659b5c508fbSRuslan Ermilov.Fx 660b5c508fbSRuslan Ermilovwill allow you to specify the base disk name 661ff7d5162SJordan K. Hubbardeven if the label resides on a slice. However, to be proper you should 662726b61abSRuslan Ermilovspecify the base disk name only if you are using a 663726b61abSRuslan Ermilov.Dq dangerously-dedicated 664ff7d5162SJordan K. Hubbardlabel. Normally you specify the slice. 6658fae3551SRodney W. Grimes.Pp 666ff7d5162SJordan K. Hubbard.Dl disklabel da0s1 > savedlabel 6674cbdc634SGreg Lehey.Pp 6684cbdc634SGreg LeheySave the in-core label for 669ff7d5162SJordan K. Hubbard.Pa da0s1 6704cbdc634SGreg Leheyinto the file 6714cbdc634SGreg Lehey.Pa savedlabel . 6724cbdc634SGreg LeheyThis file can be used with the 6734cbdc634SGreg Lehey.Fl R 6744cbdc634SGreg Leheyflag to restore the label at a later date. 6754cbdc634SGreg Lehey.Pp 676ff7d5162SJordan K. Hubbard.Dl disklabel -w -r /dev/da0s1 da2212 foo 6778fae3551SRodney W. Grimes.Pp 6784cbdc634SGreg LeheyCreate a label for 679ff7d5162SJordan K. Hubbard.Pa da0s1 6804cbdc634SGreg Leheybased on information for 681726b61abSRuslan Ermilov.Dq da2212 682726b61abSRuslan Ermilovfound in 6838fae3551SRodney W. Grimes.Pa /etc/disktab . 6848fae3551SRodney W. GrimesAny existing bootstrap code will be clobbered. 6858fae3551SRodney W. Grimes.Pp 686ff7d5162SJordan K. Hubbard.Dl disklabel -e -r da0s1 6878fae3551SRodney W. Grimes.Pp 6884cbdc634SGreg LeheyRead the on-disk label for 689ff7d5162SJordan K. Hubbard.Pa da0s1 , 6904cbdc634SGreg Leheyedit it and reinstall in-core as well as on-disk. Existing bootstrap code is 6914cbdc634SGreg Leheyunaffected. 6928fae3551SRodney W. Grimes.Pp 6933233afaeSJohn W. De Boskey.Dl disklabel -e -r -n da0s1 6943233afaeSJohn W. De Boskey.Pp 6953233afaeSJohn W. De BoskeyRead the on-disk label for 6963233afaeSJohn W. De Boskey.Pa da0s1 , 6973233afaeSJohn W. De Boskeyedit it, and display what the new label would be (in sectors). It does 6983233afaeSJohn W. De BoskeyNOT install the new label either in-core or on-disk. 6993233afaeSJohn W. De Boskey.Pp 700ff7d5162SJordan K. Hubbard.Dl disklabel -r -w da0s1 auto 701425bed3aSJoerg Wunsch.Pp 7024cbdc634SGreg LeheyTry to auto-detect the required information from 703ff7d5162SJordan K. Hubbard.Pa da0s1 , 7044cbdc634SGreg Leheyand write a new label to the disk. Use another disklabel -e command to edit the 705425bed3aSJoerg Wunschpartitioning and file system information. 706425bed3aSJoerg Wunsch.Pp 707ff7d5162SJordan K. Hubbard.Dl disklabel -R da0s1 savedlabel 7088fae3551SRodney W. Grimes.Pp 7094cbdc634SGreg LeheyRestore the on-disk and in-core label for 710ff7d5162SJordan K. Hubbard.Pa da0s1 7114cbdc634SGreg Leheyfrom information in 7124cbdc634SGreg Lehey.Pa savedlabel . 7138fae3551SRodney W. GrimesExisting bootstrap code is unaffected. 7148fae3551SRodney W. Grimes.Pp 7153233afaeSJohn W. De Boskey.Dl disklabel -R -n da0s1 label_layout 7163233afaeSJohn W. De Boskey.Pp 7173233afaeSJohn W. De BoskeyDisplay what the label would be for 7183233afaeSJohn W. De Boskey.Pa da0s1 7193233afaeSJohn W. De Boskeyusing the partition layout in 7203233afaeSJohn W. De Boskey.Pa label_layout . 7213233afaeSJohn W. De BoskeyThis is useful for determining how much space would be alloted for various 7223233afaeSJohn W. De Boskeypartitions with a labelling scheme using %-based or * partition sizes. 7233233afaeSJohn W. De Boskey.Pp 724ff7d5162SJordan K. Hubbard.Dl disklabel -B da0s1 7258fae3551SRodney W. Grimes.Pp 7264cbdc634SGreg LeheyInstall a new bootstrap on 727ff7d5162SJordan K. Hubbard.Pa da0s1 . 7288fae3551SRodney W. GrimesThe boot code comes from 729efba76d7SJordan K. Hubbard.Pa /boot/boot1 7308fae3551SRodney W. Grimesand possibly 731efba76d7SJordan K. Hubbard.Pa /boot/boot2 . 7328fae3551SRodney W. GrimesOn-disk and in-core labels are unchanged. 7338fae3551SRodney W. Grimes.Pp 734ff7d5162SJordan K. Hubbard.Dl disklabel -w -B /dev/da0s1 -b newboot1 -s newboot da2212 7358fae3551SRodney W. Grimes.Pp 7368fae3551SRodney W. GrimesInstall a new label and bootstrap. 737726b61abSRuslan ErmilovThe label is derived from disktab information for 738726b61abSRuslan Ermilov.Dq da2212 739726b61abSRuslan Ermilovand installed both in-core and on-disk. 7404cbdc634SGreg LeheyThe bootstrap code comes from the files 7414cbdc634SGreg Lehey.Pa /boot/newboot1 7424cbdc634SGreg Leheyand 7434cbdc634SGreg Lehey.Pa /boot/newboot2 . 744ff7d5162SJordan K. Hubbard.Pp 745ff7d5162SJordan K. Hubbard.Dl dd if=/dev/zero of=/dev/da0 bs=512 count=32 746ff7d5162SJordan K. Hubbard.Dl fdisk -BI da0 747ff7d5162SJordan K. Hubbard.Dl dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 748ff7d5162SJordan K. Hubbard.Dl disklabel -w -r -B da0s1 auto 749ff7d5162SJordan K. Hubbard.Dl disklabel -e da0s1 750ff7d5162SJordan K. Hubbard.Pp 751ff7d5162SJordan K. HubbardCompletely wipe any prior information on the disk, creating a new bootable 752726b61abSRuslan Ermilovdisk with a DOS partition table containing one 753726b61abSRuslan Ermilov.Dq whole-disk 754726b61abSRuslan Ermilovslice. Then 755ff7d5162SJordan K. Hubbardinitialize the slice, then edit it to your needs. The 756ff7d5162SJordan K. Hubbard.Pa dd 757ff7d5162SJordan K. Hubbardcommands are optional, but may be necessary for some BIOSes to properly 758ff7d5162SJordan K. Hubbardrecognize the disk. 7593233afaeSJohn W. De Boskey.Pp 7603233afaeSJohn W. De BoskeyThis is an example disklabel that uses some of the new partition size types 7613233afaeSJohn W. De Boskeysuch as %, M, G, and *, which could be used as a source file for 7623233afaeSJohn W. De Boskey.Pp 7633233afaeSJohn W. De Boskey.Dl disklabel -R ad0s1c new_label_file 7643233afaeSJohn W. De Boskey.Bd -literal -offset 4n 7653233afaeSJohn W. De Boskey# /dev/ad0s1c: 7663233afaeSJohn W. De Boskeytype: ESDI 7673233afaeSJohn W. De Boskeydisk: ad0s1 7683233afaeSJohn W. De Boskeylabel: 7693233afaeSJohn W. De Boskeyflags: 7703233afaeSJohn W. De Boskeybytes/sector: 512 7713233afaeSJohn W. De Boskeysectors/track: 63 7723233afaeSJohn W. De Boskeytracks/cylinder: 16 7733233afaeSJohn W. De Boskeysectors/cylinder: 1008 7743233afaeSJohn W. De Boskeycylinders: 40633 7753233afaeSJohn W. De Boskeysectors/unit: 40959009 7763233afaeSJohn W. De Boskeyrpm: 3600 7773233afaeSJohn W. De Boskeyinterleave: 1 7783233afaeSJohn W. De Boskeytrackskew: 0 7793233afaeSJohn W. De Boskeycylinderskew: 0 7803233afaeSJohn W. De Boskeyheadswitch: 0 # milliseconds 7813233afaeSJohn W. De Boskeytrack-to-track seek: 0 # milliseconds 7823233afaeSJohn W. De Boskeydrivedata: 0 7833233afaeSJohn W. De Boskey 7843233afaeSJohn W. De Boskey8 partitions: 7853233afaeSJohn W. De Boskey# size offset fstype [fsize bsize bps/cpg] 7863233afaeSJohn W. De Boskey a: 400M 0 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) 7873233afaeSJohn W. De Boskey b: 1G * swap 7883233afaeSJohn W. De Boskey c: * * unused 7893233afaeSJohn W. De Boskey e: 204800 * 4.2BSD 7903233afaeSJohn W. De Boskey f: 5g * 4.2BSD 7913233afaeSJohn W. De Boskey g: * * 4.2BSD 7923233afaeSJohn W. De Boskey.Ed 7938fae3551SRodney W. Grimes.Sh SEE ALSO 794af202156SWolfram Schneider.Xr disklabel 5 , 7954cbdc634SGreg Lehey.Xr disktab 5 , 796aa7c9adaSMike Pritchard.Xr boot0cfg 8 , 79770846e5cSMike Pritchard.Xr fdisk 8 7988fae3551SRodney W. Grimes.Sh DIAGNOSTICS 7998fae3551SRodney W. GrimesThe kernel device drivers will not allow the size of a disk partition 8008fae3551SRodney W. Grimesto be decreased or the offset of a partition to be changed while it is open. 8018fae3551SRodney W. GrimesSome device drivers create a label containing only a single large partition 8024cbdc634SGreg Leheyif a disk is unlabeled; thus, the label must be written to the 803726b61abSRuslan Ermilov.Dq a 8044cbdc634SGreg Leheypartition of the disk while it is open. This sometimes requires the desired 8054cbdc634SGreg Leheylabel to be set in two steps, the first one creating at least one other 8064cbdc634SGreg Leheypartition, and the second setting the label on the new partition while shrinking 8074cbdc634SGreg Leheythe 808726b61abSRuslan Ermilov.Dq a 8094cbdc634SGreg Leheypartition. 8108fae3551SRodney W. Grimes.Pp 8118fae3551SRodney W. GrimesOn some machines the bootstrap code may not fit entirely in the area 8128fae3551SRodney W. Grimesallocated for it by some filesystems. 8138fae3551SRodney W. GrimesAs a result, it may not be possible to have filesystems on some partitions 814726b61abSRuslan Ermilovof a 815726b61abSRuslan Ermilov.Dq bootable 816726b61abSRuslan Ermilovdisk. 8178fae3551SRodney W. GrimesWhen installing bootstrap code, 8186bd343a9SPhilippe Charnier.Nm 8198fae3551SRodney W. Grimeschecks for these cases. 8208fae3551SRodney W. GrimesIf the installed boot code would overlap a partition of type FS_UNUSED 8218fae3551SRodney W. Grimesit is marked as type FS_BOOT. 8228fae3551SRodney W. GrimesThe 8238fae3551SRodney W. Grimes.Xr newfs 8 8248fae3551SRodney W. Grimesutility will disallow creation of filesystems on FS_BOOT partitions. 8258fae3551SRodney W. GrimesConversely, if a partition has a type other than FS_UNUSED or FS_BOOT, 8266bd343a9SPhilippe Charnier.Nm 8278fae3551SRodney W. Grimeswill not install bootstrap code that overlaps it. 8288fae3551SRodney W. Grimes.Sh BUGS 8298fae3551SRodney W. GrimesWhen a disk name is given without a full pathname, 830726b61abSRuslan Ermilovthe constructed device name uses the 831726b61abSRuslan Ermilov.Dq c 832726b61abSRuslan Ermilovpartition. 833d70e4e53SJoerg Wunsch.Pp 834d70e4e53SJoerg WunschFor the i386 architecture, the primary bootstrap sector contains 835d70e4e53SJoerg Wunschan embedded 836d70e4e53SJoerg Wunsch.Em fdisk 837d70e4e53SJoerg Wunschtable. 838d70e4e53SJoerg Wunsch.Nm Disklabel 839d70e4e53SJoerg Wunschtakes care to not clobber it when installing a bootstrap only 840d70e4e53SJoerg Wunsch.Pq Fl B , 841d70e4e53SJoerg Wunschor when editing an existing label 842d70e4e53SJoerg Wunsch.Pq Fl e , 843d70e4e53SJoerg Wunschbut it unconditionally writes the primary bootstrap program onto 844d70e4e53SJoerg Wunschthe disk for 845d70e4e53SJoerg Wunsch.Fl w 846d70e4e53SJoerg Wunschor 847d70e4e53SJoerg Wunsch.Fl R , 848d70e4e53SJoerg Wunschthus replacing the 849d70e4e53SJoerg Wunsch.Em fdisk 850d70e4e53SJoerg Wunschtable by the dummy one in the bootstrap program. This is only of 851d70e4e53SJoerg Wunschconcern if the disk is fully dedicated, so that the BSD disklabel 852d70e4e53SJoerg Wunschstarts at absolute block 0 on the disk. 8534cbdc634SGreg Lehey.Pp 8544cbdc634SGreg Lehey.Nm 8553233afaeSJohn W. De Boskeydoes not perform all possible error checking. Warning *is* given if partitions 8563233afaeSJohn W. De Boskeyoverlap; if an absolute offset doesn't match the expected offset; if the 8573233afaeSJohn W. De Boskey.Nm c 8583233afaeSJohn W. De Boskeypartition doesn't start at 0 or doesn't cover the entire slice; if a 8593233afaeSJohn W. De Boskeypartition runs past the end of the device; and a number of other errors; but 8603233afaeSJohn W. De Boskeyno warning is given if space remains unused. 861