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 409fe48c6eSRuslan Ermilov.Os 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 64726b61abSRuslan Ermilov.Pp 657c7fb079SRuslan Ermilov.Nm 668fae3551SRodney W. Grimes.Fl B 678fae3551SRodney W. Grimes.Oo 688d48318bSPoul-Henning Kamp.Fl b Ar boot 698fae3551SRodney W. Grimes.Oc 708fae3551SRodney W. Grimes.Ar disk 71ff7d5162SJordan K. Hubbard.Oo Ar disktype/auto Oc 727c7fb079SRuslan Ermilov.Nm 738fae3551SRodney W. Grimes.Fl w 748fae3551SRodney W. Grimes.Fl B 753233afaeSJohn W. De Boskey.Op Fl n 768fae3551SRodney W. Grimes.Oo 778d48318bSPoul-Henning Kamp.Fl b Ar boot 788fae3551SRodney W. Grimes.Oc 79ff7d5162SJordan K. Hubbard.Ar disk Ar disktype/auto 808fae3551SRodney W. Grimes.Oo Ar packid Oc 817c7fb079SRuslan Ermilov.Nm 828fae3551SRodney W. Grimes.Fl R 838fae3551SRodney W. Grimes.Fl B 843233afaeSJohn W. De Boskey.Op Fl n 858fae3551SRodney W. Grimes.Oo 868d48318bSPoul-Henning Kamp.Fl b Ar boot 878fae3551SRodney W. Grimes.Oc 888fae3551SRodney W. Grimes.Ar disk Ar protofile 898fae3551SRodney W. Grimes.Sh DESCRIPTION 90e1205e80SPhilippe CharnierThe 91e1205e80SPhilippe Charnier.Nm 92e1205e80SPhilippe Charnierutility 935a6d7397STim Vanderhoekinstalls, examines or modifies 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 1022c80d96eSTom RhodesThe disk label resides close to or at the beginning of each disk slice. 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 1177c7fb079SRuslan Ermilov.Nm 1184cbdc634SGreg Leheyforms require a disk device name, which should always be the raw 119ff7d5162SJordan K. Hubbarddevice name representing the disk or slice. For example 120ff7d5162SJordan K. Hubbard.Pa da0 1212c80d96eSTom Rhodesrepresents the entire disk regardless of any DOS partitioning, 122ff7d5162SJordan K. Hubbardand 123ff7d5162SJordan K. Hubbard.Pa da0s1 124ff7d5162SJordan K. Hubbardrepresents a slice. Some devices, most notably 125ff7d5162SJordan K. Hubbard.Ar ccd , 126ff7d5162SJordan K. Hubbardrequire that the 127726b61abSRuslan Ermilov.Dq whole-disk 128726b61abSRuslan Ermilov(or 129726b61abSRuslan Ermilov.Dq c ) 130ff7d5162SJordan K. Hubbardpartition be specified. For example 131ff7d5162SJordan K. Hubbard.Pa ccd0c . 132ff7d5162SJordan K. HubbardYou do not have to include the 133ff7d5162SJordan K. Hubbard.Pa /dev/ 134ff7d5162SJordan K. Hubbardpath prefix when specifying the device. 135e1205e80SPhilippe CharnierThe 1364cbdc634SGreg Lehey.Nm 137e1205e80SPhilippe Charnierutility will automatically prepend it. 1384cbdc634SGreg Lehey.Ss Reading the disk label 1394cbdc634SGreg Lehey.Pp 140e40fcc98SDima DorfmanTo examine the label on a disk drive, use 1414cbdc634SGreg Lehey.Nm 1424cbdc634SGreg Leheywithout options: 1434cbdc634SGreg Lehey.Pp 1447c7fb079SRuslan Ermilov.Nm 1454cbdc634SGreg Lehey.Op Fl r 1464cbdc634SGreg Lehey.Ar disk 1474cbdc634SGreg Lehey.Pp 1484cbdc634SGreg Lehey.Ar disk 1494cbdc634SGreg Leheyrepresents the raw disk in question, and may be in the form 1504cbdc634SGreg Lehey.Pa da0 1514cbdc634SGreg Leheyor 15207b0cf9aSDavid E. O'Brien.Pa /dev/da0c . 1534cbdc634SGreg LeheyIt will display all of the parameters associated with the drive and its 1544cbdc634SGreg Leheypartition layout. Unless the 1558fae3551SRodney W. Grimes.Fl r 1568fae3551SRodney W. Grimesflag is given, 1578fae3551SRodney W. Grimesthe kernel's in-core copy of the label is displayed; 1588fae3551SRodney W. Grimesif the disk has no label, or the partition types on the disk are incorrect, 1598fae3551SRodney W. Grimesthe kernel may have constructed or modified the label. 1608fae3551SRodney W. GrimesIf the 1618fae3551SRodney W. Grimes.Fl r 1624cbdc634SGreg Leheyflag is given, 1634cbdc634SGreg Lehey.Nm 164ff7d5162SJordan K. Hubbardreads the label from the raw disk and displays it. Both versions are usually 165ff7d5162SJordan K. Hubbardidentical except in the case where a label has not yet been initialized or 166ff7d5162SJordan K. Hubbardis corrupt. 1674cbdc634SGreg Lehey.Ss Writing a standard label 1688fae3551SRodney W. Grimes.Pp 1694cbdc634SGreg LeheyTo write a standard label, use the form 1704cbdc634SGreg Lehey.Pp 1717c7fb079SRuslan Ermilov.Nm 1728fae3551SRodney W. Grimes.Fl w 1734cbdc634SGreg Lehey.Op Fl r 1743233afaeSJohn W. De Boskey.Op Fl n 175ff7d5162SJordan K. Hubbard.Ar disk Ar disktype/auto 1764cbdc634SGreg Lehey.Oo Ar packid Oc 1774cbdc634SGreg Lehey.Pp 1787c7fb079SRuslan Ermilov.Nm 179ff7d5162SJordan K. Hubbard.Fl w 180ff7d5162SJordan K. Hubbard.Op Fl r 1813233afaeSJohn W. De Boskey.Op Fl n 182ff7d5162SJordan K. Hubbard.Ar disk 183ff7d5162SJordan K. Hubbardauto 184ff7d5162SJordan K. Hubbard.Pp 1858fae3551SRodney W. GrimesThe required arguments to 1866bd343a9SPhilippe Charnier.Nm 1874cbdc634SGreg Leheyare the drive to be labeled and the drive type as described in the 188d0353b83SRuslan Ermilov.Xr disktab 5 1894cbdc634SGreg Leheyfile. The drive parameters and partitions are taken from that file. If 1904cbdc634SGreg Leheydifferent disks of the same physical type are to have different partitions, it 1914cbdc634SGreg Leheywill be necessary to have separate disktab entries describing each, or to edit 1924cbdc634SGreg Leheythe label after installation as described below. The optional argument is a 1934cbdc634SGreg Leheypack identification string, up to 16 characters long. The pack id must be 1943233afaeSJohn W. De Boskeyquoted if it contains blanks. 1953233afaeSJohn W. De Boskey.Pp 1963233afaeSJohn W. De BoskeyIf the 1973233afaeSJohn W. De Boskey.Fl n 1983233afaeSJohn W. De Boskeyflag is given, no data will be written to the device, and instead the 1993233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. 2003233afaeSJohn W. De Boskey.Pp 2013233afaeSJohn W. De BoskeyIf the 2028fae3551SRodney W. Grimes.Fl r 2038fae3551SRodney W. Grimesflag is given, the disk sectors containing the label and bootstrap 2048fae3551SRodney W. Grimeswill be written directly. 2058fae3551SRodney W. GrimesA side-effect of this is that any existing bootstrap code will be overwritten 2064cbdc634SGreg Leheyand the disk rendered unbootable. See the boot options below for a method of 2074cbdc634SGreg Leheywriting the label and the bootstrap at the same time. 2088fae3551SRodney W. GrimesIf 2098fae3551SRodney W. Grimes.Fl r 2108fae3551SRodney W. Grimesis not specified, 2118fae3551SRodney W. Grimesthe existing label will be updated via the in-core copy and any bootstrap 2128fae3551SRodney W. Grimescode will be unaffected. 2138fae3551SRodney W. GrimesIf the disk does not already have a label, the 2148fae3551SRodney W. Grimes.Fl r 2158fae3551SRodney W. Grimesflag must be used. 2168fae3551SRodney W. GrimesIn either case, the kernel's in-core label is replaced. 2178fae3551SRodney W. Grimes.Pp 218425bed3aSJoerg WunschFor a virgin disk that is not known to 219425bed3aSJoerg Wunsch.Xr disktab 5 , 220425bed3aSJoerg Wunsch.Ar disktype 221425bed3aSJoerg Wunschcan be specified as 222425bed3aSJoerg Wunsch.Dq auto . 223425bed3aSJoerg WunschIn this case, the driver is requested to produce a virgin label for the 224425bed3aSJoerg Wunschdisk. This might or might not be successful, depending on whether the 225425bed3aSJoerg Wunschdriver for the disk is able to get the required data without reading 226425bed3aSJoerg Wunschanything from the disk at all. It will likely succeed for all SCSI 227425bed3aSJoerg Wunschdisks, most IDE disks, and vnode devices. Writing a label to the 228425bed3aSJoerg Wunschdisk is the only supported operation, and the 229425bed3aSJoerg Wunsch.Ar disk 230425bed3aSJoerg Wunschitself must be provided as the canonical name, i.e. not as a full 231425bed3aSJoerg Wunschpath name. 232ff7d5162SJordan K. Hubbard.Pp 2333233afaeSJohn W. De BoskeyFor most harddisks, a label based on percentages for most partitions (and 2347733674eSRuslan Ermilovone partition with a size of 2357733674eSRuslan Ermilov.Ql * ) 2367733674eSRuslan Ermilovwill produce a reasonable configuration. 2373233afaeSJohn W. De Boskey.Pp 238ff7d5162SJordan K. HubbardPC-based systems have special requirements in order for the BIOS to properly 239b5c508fbSRuslan Ermilovrecognize a 240b5c508fbSRuslan Ermilov.Fx 241b5c508fbSRuslan Ermilovdisklabel. Older systems may require what is known as a 242726b61abSRuslan Ermilov.Dq dangerously dedicated 243ff7d5162SJordan K. Hubbarddisklabel, which creates a fake DOS partition to work around problems older 2442c80d96eSTom RhodesBIOSes have with modern disk geometries. 2452c80d96eSTom RhodesOn newer systems you generally want 2462c80d96eSTom Rhodesto create a normal DOS partition using 247ff7d5162SJordan K. Hubbard.Ar fdisk 248b5c508fbSRuslan Ermilovand then create a 249b5c508fbSRuslan Ermilov.Fx 250b5c508fbSRuslan Ermilovdisklabel within that slice. This is described 251ff7d5162SJordan K. Hubbardlater on in this page. 252ff7d5162SJordan K. Hubbard.Pp 253ff7d5162SJordan K. HubbardInstalling a new disklabel does not in of itself allow your system to boot 254ff7d5162SJordan K. Hubbarda kernel using that label. You must also install boot blocks, which is 255ff7d5162SJordan K. Hubbarddescribed later on in this manual page. 2564cbdc634SGreg Lehey.Ss Editing an existing disk label 257425bed3aSJoerg Wunsch.Pp 2584cbdc634SGreg LeheyTo edit an existing disk label, use the form 2594cbdc634SGreg Lehey.Pp 2607c7fb079SRuslan Ermilov.Nm 2618fae3551SRodney W. Grimes.Fl e 2624cbdc634SGreg Lehey.Op Fl r 2633233afaeSJohn W. De Boskey.Op Fl n 2644cbdc634SGreg Lehey.Ar disk 2654cbdc634SGreg Lehey.Pp 2664cbdc634SGreg LeheyThis command reads the label from the in-core kernel copy, or directly from the 2674cbdc634SGreg Leheydisk if the 2688fae3551SRodney W. Grimes.Fl r 2694cbdc634SGreg Leheyflag is also specified. The label is written to a file in ASCII and then 2704cbdc634SGreg Leheysupplied to an editor for changes. If no editor is specified in an 2718fae3551SRodney W. Grimes.Ev EDITOR 2728fae3551SRodney W. Grimesenvironment variable, 2738fae3551SRodney W. Grimes.Xr vi 1 2744cbdc634SGreg Leheyis used. When the editor terminates, the label file is used to rewrite the disk 2754cbdc634SGreg Leheylabel. Existing bootstrap code is unchanged regardless of whether 2768fae3551SRodney W. Grimes.Fl r 2773233afaeSJohn W. De Boskeywas specified. If 2783233afaeSJohn W. De Boskey.Fl n 2793233afaeSJohn W. De Boskeyis specified, no data will be written to the device, and instead the 2803233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. This is 2813233afaeSJohn W. De Boskeyuseful to see how a partitioning scheme will work out for a specific disk. 2824cbdc634SGreg Lehey.Ss Restoring a disk label from a file 2838fae3551SRodney W. Grimes.Pp 2844cbdc634SGreg LeheyTo restore a disk label from a file, use the form 2854cbdc634SGreg Lehey.Pp 2867c7fb079SRuslan Ermilov.Nm 2878fae3551SRodney W. Grimes.Fl R 2884cbdc634SGreg Lehey.Op Fl r 2893233afaeSJohn W. De Boskey.Op Fl n 2904cbdc634SGreg Lehey.Ar disk Ar protofile 2918fae3551SRodney W. Grimes.Pp 2926bd343a9SPhilippe Charnier.Nm 2935ef18a82SGreg Leheyis capable of restoring a disk label that was previously saved in a file in ASCII format. 2944cbdc634SGreg LeheyThe prototype file used to create the label should be in the same format as that 2954cbdc634SGreg Leheyproduced when reading or editing a label. Comments are delimited by 2964cbdc634SGreg Lehey.Ar \&# 2974cbdc634SGreg Leheyand newline. As when writing a new label, any existing bootstrap code will be 2984cbdc634SGreg Leheyclobbered if 2994cbdc634SGreg Lehey.Fl r 3004cbdc634SGreg Leheyis specified and will be unaffected otherwise. See the boot options below for a 3014cbdc634SGreg Leheymethod of restoring the label and writing the bootstrap at the same time. 3023233afaeSJohn W. De BoskeyIf 3033233afaeSJohn W. De Boskey.Fl n 3043233afaeSJohn W. De Boskeyis used, no data will be written to the device, and instead the 3053233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. This is 3063233afaeSJohn W. De Boskeyuseful to see how a partitioning scheme will work out for a specific disk. 3074cbdc634SGreg Lehey.Ss Installing bootstraps 3088fae3551SRodney W. Grimes.Pp 3098fae3551SRodney W. GrimesThe final three forms of 3106bd343a9SPhilippe Charnier.Nm 311ff7d5162SJordan K. Hubbardare used to install bootstrap code. If you are creating a 312726b61abSRuslan Ermilov.Dq dangerously-dedicated 3132c80d96eSTom Rhodesslice for compatibility with older PC systems, 314ff7d5162SJordan K. Hubbardyou generally want to specify the raw disk name such as 315ff7d5162SJordan K. Hubbard.Pa da0 . 3162c80d96eSTom RhodesIf you are creating a label within an existing DOS slice, 3172c80d96eSTom Rhodesyou should specify 3182c80d96eSTom Rhodesthe partition name such as 3192c80d96eSTom Rhodes.Pa da0s1a . 3202c80d96eSTom RhodesMaking a slice bootable can be tricky. If you are using a normal DOS 321ff7d5162SJordan K. Hubbardslice you typically install (or leave) a standard MBR on the base disk and 322b5c508fbSRuslan Ermilovthen install the 323b5c508fbSRuslan Ermilov.Fx 324b5c508fbSRuslan Ermilovbootblocks in the slice. 3254cbdc634SGreg Lehey.Pp 3267c7fb079SRuslan Ermilov.Nm 3278fae3551SRodney W. Grimes.Fl B 3284cbdc634SGreg Lehey.Oo 3298d48318bSPoul-Henning Kamp.Fl b Ar boot 3304cbdc634SGreg Lehey.Oc 3314cbdc634SGreg Lehey.Ar disk 3324cbdc634SGreg Lehey.Oo Ar disktype Oc 3334cbdc634SGreg Lehey.Pp 3344cbdc634SGreg LeheyThis form installs the bootstrap only. It does not change the disk label. 335726b61abSRuslan ErmilovYou should never use this command on a base disk unless you intend to create a 336726b61abSRuslan Ermilov.Dq dangerously-dedicated 337726b61abSRuslan Ermilovdisk, such as 338ff7d5162SJordan K. Hubbard.Ar da0 . 339ff7d5162SJordan K. HubbardThis command is typically run on a slice such as 340ff7d5162SJordan K. Hubbard.Ar da0s1 . 3414cbdc634SGreg Lehey.Pp 3427c7fb079SRuslan Ermilov.Nm 3434cbdc634SGreg Lehey.Fl w 3444cbdc634SGreg Lehey.Fl B 3453233afaeSJohn W. De Boskey.Op Fl n 3464cbdc634SGreg Lehey.Oo 3478d48318bSPoul-Henning Kamp.Fl b Ar boot 3484cbdc634SGreg Lehey.Oc 3494cbdc634SGreg Lehey.Ar disk Ar disktype 3504cbdc634SGreg Lehey.Oo Ar packid Oc 3514cbdc634SGreg Lehey.Pp 352726b61abSRuslan ErmilovThis form corresponds to the 353726b61abSRuslan Ermilov.Dq write label 354726b61abSRuslan Ermilovcommand described above. 3554cbdc634SGreg LeheyIn addition to writing a new volume label, it also installs the bootstrap. 356726b61abSRuslan ErmilovIf run on a base disk this command will create a 357726b61abSRuslan Ermilov.Dq dangerously-dedicated 358b60884cdSBen Smithurstlabel. This command is normally run on a slice rather than a base disk. 3593233afaeSJohn W. De BoskeyIf 3603233afaeSJohn W. De Boskey.Fl n 3613233afaeSJohn W. De Boskeyis used, no data will be written to the device, and instead the 3623233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. 3634cbdc634SGreg Lehey.Pp 3647c7fb079SRuslan Ermilov.Nm 3654cbdc634SGreg Lehey.Fl R 3664cbdc634SGreg Lehey.Fl B 3673233afaeSJohn W. De Boskey.Op Fl n 3684cbdc634SGreg Lehey.Oo 3698d48318bSPoul-Henning Kamp.Fl b Ar boot 3704cbdc634SGreg Lehey.Oc 3714cbdc634SGreg Lehey.Ar disk Ar protofile 3724cbdc634SGreg Lehey.Pp 373726b61abSRuslan ErmilovThis form corresponds to the 374726b61abSRuslan Ermilov.Dq restore label 375726b61abSRuslan Ermilovcommand described above. 3764cbdc634SGreg LeheyIn addition to restoring the volume label, it also installs the bootstrap. 377726b61abSRuslan ErmilovIf run on a base disk this command will create a 378726b61abSRuslan Ermilov.Dq dangerously-dedicated 379b60884cdSBen Smithurstlabel. This command is normally run on a slice rather than a base disk. 3804cbdc634SGreg Lehey.Pp 3814cbdc634SGreg LeheyThe bootstrap commands always access the disk directly, so it is not necessary 3824cbdc634SGreg Leheyto specify the 3838fae3551SRodney W. Grimes.Fl r 3843233afaeSJohn W. De Boskeyflag. If 3853233afaeSJohn W. De Boskey.Fl n 3863233afaeSJohn W. De Boskeyis used, no data will be written to the device, and instead the 3873233afaeSJohn W. De Boskeydisklabel that would have been written will be printed to stdout. 3884cbdc634SGreg Lehey.Pp 389ef9ab0b3SRuslan ErmilovThe bootstrap code is comprised of two boot programs, both 390ef9ab0b3SRuslan Ermilovcompiled into a single 391ef9ab0b3SRuslan Ermilov.Pa /boot/boot 392ef9ab0b3SRuslan Ermilovimage. 393ef9ab0b3SRuslan ErmilovAn alternative boot image may be specified with the 3948fae3551SRodney W. Grimes.Fl b 395ef9ab0b3SRuslan Ermilovoption. 396ff7d5162SJordan K. Hubbard.Ss Initializing/Formatting a bootable disk from scratch 397ff7d5162SJordan K. Hubbard.Pp 398ff7d5162SJordan K. HubbardTo initialize a disk from scratch the following sequence is recommended. 399ff7d5162SJordan K. HubbardPlease note that this will wipe everything that was previously on the disk, 400b5c508fbSRuslan Ermilovincluding any 401b5c508fbSRuslan Ermilov.No non- Ns Fx 402b5c508fbSRuslan Ermilovslices. 403ff7d5162SJordan K. Hubbard.Bl -enum 404ff7d5162SJordan K. Hubbard.It 405ff7d5162SJordan K. HubbardUse 4062c80d96eSTom Rhodes.Xr fdisk 8 4072c80d96eSTom Rhodesto initialize the hard disk, and create a slice table, referred to 4082c80d96eSTom Rhodesas the partition table in DOS. 4092c80d96eSTom RhodesHere you will define disk slices for your system. 410ff7d5162SJordan K. Hubbard.It 411ff7d5162SJordan K. HubbardUse 412facc6767SRuslan Ermilov.Nm 4132c80d96eSTom Rhodesto define and write partitions and mount points. 4142c80d96eSTom RhodesYou are not required to define the mount points here though, 4152c80d96eSTom Rhodesthey can be defined later using 4162c80d96eSTom Rhodes.Xr mount 8 . 417ff7d5162SJordan K. Hubbard.It 4182c80d96eSTom RhodesFinally use 4192c80d96eSTom Rhodes.Xr newfs 8 4202c80d96eSTom Rhodesto create a file system on the new partition. 4212c80d96eSTom RhodesA typical partitioning scheme would be to have an 422726b61abSRuslan Ermilov.Dq a 423726b61abSRuslan Ermilovpartition 424726b61abSRuslan Ermilovof approximately 128MB to hold the root file system, a 425726b61abSRuslan Ermilov.Dq b 426726b61abSRuslan Ermilovpartition for 427726b61abSRuslan Ermilovswap, a 428726b61abSRuslan Ermilov.Dq d 429726b61abSRuslan Ermilovpartition for /var (usually 128MB), an 430726b61abSRuslan Ermilov.Dq e 431726b61abSRuslan Ermilovpartition 432726b61abSRuslan Ermilovfor /var/tmp (usually 128MB), an 433726b61abSRuslan Ermilov.Dq f 434726b61abSRuslan Ermilovpartition for /usr (usually around 2G), 435726b61abSRuslan Ermilovand finally a 436726b61abSRuslan Ermilov.Dq g 437b60884cdSBen Smithurstpartition for /home (usually all remaining space). 438ff7d5162SJordan K. HubbardYour mileage may vary. 439ff7d5162SJordan K. Hubbard.El 440ff7d5162SJordan K. Hubbard.Pp 4417c7fb079SRuslan Ermilov.Nm fdisk Fl BI Ar da0 442ff7d5162SJordan K. Hubbard.Pp 4437c7fb079SRuslan Ermilov.Nm 444ff7d5162SJordan K. Hubbard.Fl w 445ff7d5162SJordan K. Hubbard.Fl B 446ff7d5162SJordan K. Hubbard.Ar da0s1 447ff7d5162SJordan K. Hubbardauto 448ff7d5162SJordan K. Hubbard.Pp 449ff7d5162SJordan K. Hubbard.Pp 4507c7fb079SRuslan Ermilov.Nm 451ff7d5162SJordan K. Hubbard.Fl e 452ff7d5162SJordan K. Hubbard.Ar da0s1 4538fae3551SRodney W. Grimes.Sh FILES 454ef9ab0b3SRuslan Ermilov.Bl -tag -width ".Pa /etc/disktab" -compact 455ef9ab0b3SRuslan Ermilov.It Pa /boot/boot 456ef9ab0b3SRuslan ErmilovDefault boot image. 4578fae3551SRodney W. Grimes.It Pa /etc/disktab 458ef9ab0b3SRuslan ErmilovDisk description file. 4598fae3551SRodney W. Grimes.El 4604cbdc634SGreg Lehey.Sh SAVED FILE FORMAT 461e1205e80SPhilippe CharnierThe 4624cbdc634SGreg Lehey.Nm 463e1205e80SPhilippe Charnierutility 4644cbdc634SGreg Leheyuses an ASCII version of the label when examining, editing or restoring a disk 4654cbdc634SGreg Leheylabel. The format is: 4664cbdc634SGreg Lehey.Bd -literal -offset 4n 46707b0cf9aSDavid E. O'Brien# /dev/da1c: 4684cbdc634SGreg Leheytype: SCSI 46907b0cf9aSDavid E. O'Briendisk: da0s1 4704cbdc634SGreg Leheylabel: 4714cbdc634SGreg Leheyflags: 4724cbdc634SGreg Leheybytes/sector: 512 4734cbdc634SGreg Leheysectors/track: 51 4744cbdc634SGreg Leheytracks/cylinder: 19 4754cbdc634SGreg Leheysectors/cylinder: 969 4764cbdc634SGreg Leheycylinders: 1211 4774cbdc634SGreg Leheysectors/unit: 1173930 4784cbdc634SGreg Leheyrpm: 3600 4794cbdc634SGreg Leheyinterleave: 1 4804cbdc634SGreg Leheytrackskew: 0 4814cbdc634SGreg Leheycylinderskew: 0 4824cbdc634SGreg Leheyheadswitch: 0 # milliseconds 4834cbdc634SGreg Leheytrack-to-track seek: 0 # milliseconds 4844cbdc634SGreg Leheydrivedata: 0 4854cbdc634SGreg Lehey 4864cbdc634SGreg Lehey8 partitions: 4874cbdc634SGreg Lehey# size offset fstype [fsize bsize bps/cpg] 4884cbdc634SGreg Lehey a: 81920 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 84*) 4894cbdc634SGreg Lehey b: 160000 81920 swap # (Cyl. 84* - 218*) 4904cbdc634SGreg Lehey c: 1173930 0 unused 0 0 # (Cyl. 0 - 1211*) 4914cbdc634SGreg Lehey h: 962010 211920 vinum # (Cyl. 218*- 1211*) 4924cbdc634SGreg Lehey.Ed 4934cbdc634SGreg Lehey.Pp 4944cbdc634SGreg LeheyLines starting with a # mark are comments. Most of the other specifications are 4954cbdc634SGreg Leheyno longer used. The ones which must still be set correctly are: 4964cbdc634SGreg Lehey.Pp 4974cbdc634SGreg Lehey.Bl -hang -width 20n 4984cbdc634SGreg Lehey.It Nm label 4994cbdc634SGreg Leheyis an optional label, set by the 5004cbdc634SGreg Lehey.Ar packid 5014cbdc634SGreg Leheyoption when writing a label. 5024cbdc634SGreg Lehey.It Nm flags 5034cbdc634SGreg LeheyFlags may be 5044cbdc634SGreg Lehey.Ar removable , 5054cbdc634SGreg Lehey.Ar ecc 5064cbdc634SGreg Leheyor 5074cbdc634SGreg Lehey.Ar badsect . 5084cbdc634SGreg Lehey.Ar removable 509b5c508fbSRuslan Ermilovis set for removable media drives, but no current 510b5c508fbSRuslan Ermilov.Fx 511b5c508fbSRuslan Ermilovdriver evaluates this 5124cbdc634SGreg Leheyflag. 5134cbdc634SGreg Lehey.Ar ecc 5144cbdc634SGreg Leheyis no longer supported; 5154cbdc634SGreg Lehey.Ar badsect 5164cbdc634SGreg Leheyspecifies that the drive can perform bad sector remapping. 5174cbdc634SGreg Lehey.It Nm sectors/unit 5184cbdc634SGreg Leheydescribes the total size of the disk. This value must be correct. 5194cbdc634SGreg Lehey.It Nm the partition table 5207733674eSRuslan ErmilovThis is the 5217733674eSRuslan Ermilov.Ux 5227733674eSRuslan Ermilovpartition table, not the Microsoft partition table described in 5234cbdc634SGreg Lehey.Xr fdisk 8 . 5244cbdc634SGreg Lehey.El 5254cbdc634SGreg Lehey.Pp 5264cbdc634SGreg LeheyThe partition table can have up to 8 entries. It contains the following 5274cbdc634SGreg Leheyinformation: 5284cbdc634SGreg Lehey.Bl -hang -width 10n 5294cbdc634SGreg Lehey.It identifier 5304cbdc634SGreg LeheyThe partition identifier is a single letter in the range 5317733674eSRuslan Ermilov.Dq a 5324cbdc634SGreg Leheyto 5337733674eSRuslan Ermilov.Dq h . 5344cbdc634SGreg LeheyBy convention, partition 5357733674eSRuslan Ermilov.Dq c 5364cbdc634SGreg Leheyis reserved to describe the entire disk. 5374cbdc634SGreg Lehey.It size 5383233afaeSJohn W. De Boskeyis the size of the partition in sectors, 5397733674eSRuslan Ermilov.Cm K 5403233afaeSJohn W. De Boskey(kilobytes - 1024), 5417733674eSRuslan Ermilov.Cm M 5423233afaeSJohn W. De Boskey(megabytes - 1024*1024), 5437733674eSRuslan Ermilov.Cm G 5443233afaeSJohn W. De Boskey(gigabytes - 1024*1024*1024), 5457733674eSRuslan Ermilov.Cm % 5463233afaeSJohn W. De Boskey(percentage of free space AFTER removing any fixed-size partitions other 5473233afaeSJohn W. De Boskeythan partition 5487733674eSRuslan Ermilov.Dq c) , 5497733674eSRuslan Ermilovor 5507733674eSRuslan Ermilov.Cm * 5517733674eSRuslan Ermilov(all remaining free space AFTER fixed-size and percentage 5523233afaeSJohn W. De Boskeypartitions). For partition 5537733674eSRuslan Ermilov.Dq c , 5547733674eSRuslan Ermilova size of 5557733674eSRuslan Ermilov.Cm * 5567733674eSRuslan Ermilovindicates the entire disk. Lowercase versions of 5577733674eSRuslan Ermilov.Cm K , M , 5587733674eSRuslan Ermilovand 5597733674eSRuslan Ermilov.Cm G 5603233afaeSJohn W. De Boskeyare allowed. 5613233afaeSJohn W. De BoskeySize and type should be specifed without any spaces between them. 5623233afaeSJohn W. De Boskey.Pp 5633233afaeSJohn W. De BoskeyExample: 2097152, 1g, 1024m and 1048576k are all the same size 5643233afaeSJohn W. De Boskey(assuming 512-byte sectors). 5654cbdc634SGreg Lehey.It offset 5663233afaeSJohn W. De Boskeyis the offset of the start of the partition from the beginning of the 5677733674eSRuslan Ermilovdrive in sectors, or 5687733674eSRuslan Ermilov.Cm * 5697733674eSRuslan Ermilovto have 5703233afaeSJohn W. De Boskey.Nm 5713233afaeSJohn W. De Boskeycalculate the correct offset to use (the end of the previous partition plus 5723233afaeSJohn W. De Boskeyone, ignoring partition 5737733674eSRuslan Ermilov.Dq c . 5743233afaeSJohn W. De BoskeyFor partition 5757733674eSRuslan Ermilov.Dq c , 5767733674eSRuslan Ermilov.Cm * 5777733674eSRuslan Ermilovwill be interpreted as an offset of 0. 5784cbdc634SGreg Lehey.It fstype 57970e48365SGreg Leheydescribes the purpose of the partition. The example shows all currently used 58070e48365SGreg Leheypartition types. 58170e48365SGreg LeheyFor UFS file systems and ccd partitions, use type 5827733674eSRuslan Ermilov.Cm 4.2BSD . 58370e48365SGreg LeheyFor Vinum drives, use type 58470e48365SGreg Lehey.Cm vinum . 5853233afaeSJohn W. De BoskeyOther common types are 5867733674eSRuslan Ermilov.Cm unused 5873233afaeSJohn W. De Boskeyand 5887733674eSRuslan Ermilov.Cm swap . 5892f1aba69SRuslan ErmilovBy convention, partition 5902f1aba69SRuslan Ermilov.Dq c 5912f1aba69SRuslan Ermilovrepresents the entire slice and should be of type 59270e48365SGreg Lehey.Cm unused , 59370e48365SGreg Leheythough 59470e48365SGreg Lehey.Nm 59570e48365SGreg Leheydoes not enforce this convention. 596e1205e80SPhilippe CharnierThe 59770e48365SGreg Lehey.Nm 598e1205e80SPhilippe Charnierutility 59970e48365SGreg Leheyalso knows about a number of other partition types, none of which are in current 60070e48365SGreg Leheyuse. 60170e48365SGreg LeheySee the definitions starting with 6022f1aba69SRuslan Ermilov.Dv FS_UNUSED 6032f1aba69SRuslan Ermilovin 6044cbdc634SGreg Lehey.Pa /usr/include/sys/disklabel.h 60570e48365SGreg Leheyfor more details. 6064cbdc634SGreg Lehey.It fsize 6073233afaeSJohn W. De BoskeyFor 6087733674eSRuslan Ermilov.Cm 4.2BSD 609857dcea0SRuslan Ermilovand LFS file systems only, the fragment size. Defaults to 1024 for 610857dcea0SRuslan Ermilovpartitions smaller than 1 GB, 4096 for partitions 1GB or larger. 6114cbdc634SGreg Lehey.It bsize 6123233afaeSJohn W. De BoskeyFor 6137733674eSRuslan Ermilov.Cm 4.2BSD 614857dcea0SRuslan Ermilovand LFS file systems only, the block size. Defaults to 8192 for 615857dcea0SRuslan Ermilovpartitions smaller than 1 GB, 16384 for partitions 1GB or larger. 6164cbdc634SGreg Lehey.It bps/cpg 6173233afaeSJohn W. De BoskeyFor 6187733674eSRuslan Ermilov.Cm 4.2BSD 6193233afaeSJohn W. De Boskeyfile systems, the number of cylinders in a cylinder group. For LFS file 6203233afaeSJohn W. De Boskeysystems, the segment shift value. Defaults to 16 for 6213233afaeSJohn W. De Boskeypartitions smaller than 1 GB, 64 for partitions 1GB or larger. 6224cbdc634SGreg Lehey.El 623b60884cdSBen Smithurst.Pp 6244cbdc634SGreg LeheyThe remainder of the line is a comment and shows the cylinder allocations based 6254cbdc634SGreg Leheyon the obsolete (but possibly correct) geometry information about the drive. 6264cbdc634SGreg LeheyThe asterisk (*) indicates that the partition does not begin or end exactly on a 6274cbdc634SGreg Leheycylinder boundary. 6288fae3551SRodney W. Grimes.Sh EXAMPLES 6299f9930a2SRobert Nordier.Dl disklabel da0 6308fae3551SRodney W. Grimes.Pp 6314cbdc634SGreg LeheyDisplay the in-core label for 632ff7d5162SJordan K. Hubbard.Pa da0s1 6334cbdc634SGreg Leheyas obtained via 634ff7d5162SJordan K. Hubbard.Pa /dev/da0s1 . 635b5c508fbSRuslan ErmilovWhen reading a label, 636b5c508fbSRuslan Ermilov.Fx 637b5c508fbSRuslan Ermilovwill allow you to specify the base disk name 638ff7d5162SJordan K. Hubbardeven if the label resides on a slice. However, to be proper you should 639726b61abSRuslan Ermilovspecify the base disk name only if you are using a 640726b61abSRuslan Ermilov.Dq dangerously-dedicated 641ff7d5162SJordan K. Hubbardlabel. Normally you specify the slice. 6428fae3551SRodney W. Grimes.Pp 643ff7d5162SJordan K. Hubbard.Dl disklabel da0s1 > savedlabel 6444cbdc634SGreg Lehey.Pp 6454cbdc634SGreg LeheySave the in-core label for 646ff7d5162SJordan K. Hubbard.Pa da0s1 6474cbdc634SGreg Leheyinto the file 6484cbdc634SGreg Lehey.Pa savedlabel . 6494cbdc634SGreg LeheyThis file can be used with the 6504cbdc634SGreg Lehey.Fl R 6514cbdc634SGreg Leheyflag to restore the label at a later date. 6524cbdc634SGreg Lehey.Pp 653ff7d5162SJordan K. Hubbard.Dl disklabel -w -r /dev/da0s1 da2212 foo 6548fae3551SRodney W. Grimes.Pp 6554cbdc634SGreg LeheyCreate a label for 656ff7d5162SJordan K. Hubbard.Pa da0s1 6574cbdc634SGreg Leheybased on information for 658726b61abSRuslan Ermilov.Dq da2212 659726b61abSRuslan Ermilovfound in 6608fae3551SRodney W. Grimes.Pa /etc/disktab . 6618fae3551SRodney W. GrimesAny existing bootstrap code will be clobbered. 6628fae3551SRodney W. Grimes.Pp 663ff7d5162SJordan K. Hubbard.Dl disklabel -e -r da0s1 6648fae3551SRodney W. Grimes.Pp 6654cbdc634SGreg LeheyRead the on-disk label for 666ff7d5162SJordan K. Hubbard.Pa da0s1 , 6674cbdc634SGreg Leheyedit it and reinstall in-core as well as on-disk. Existing bootstrap code is 6684cbdc634SGreg Leheyunaffected. 6698fae3551SRodney W. Grimes.Pp 6703233afaeSJohn W. De Boskey.Dl disklabel -e -r -n da0s1 6713233afaeSJohn W. De Boskey.Pp 6723233afaeSJohn W. De BoskeyRead the on-disk label for 6733233afaeSJohn W. De Boskey.Pa da0s1 , 6743233afaeSJohn W. De Boskeyedit it, and display what the new label would be (in sectors). It does 6753233afaeSJohn W. De BoskeyNOT install the new label either in-core or on-disk. 6763233afaeSJohn W. De Boskey.Pp 677ff7d5162SJordan K. Hubbard.Dl disklabel -r -w da0s1 auto 678425bed3aSJoerg Wunsch.Pp 6794cbdc634SGreg LeheyTry to auto-detect the required information from 680ff7d5162SJordan K. Hubbard.Pa da0s1 , 6814cbdc634SGreg Leheyand write a new label to the disk. Use another disklabel -e command to edit the 682425bed3aSJoerg Wunschpartitioning and file system information. 683425bed3aSJoerg Wunsch.Pp 684ff7d5162SJordan K. Hubbard.Dl disklabel -R da0s1 savedlabel 6858fae3551SRodney W. Grimes.Pp 6864cbdc634SGreg LeheyRestore the on-disk and in-core label for 687ff7d5162SJordan K. Hubbard.Pa da0s1 6884cbdc634SGreg Leheyfrom information in 6894cbdc634SGreg Lehey.Pa savedlabel . 6908fae3551SRodney W. GrimesExisting bootstrap code is unaffected. 6918fae3551SRodney W. Grimes.Pp 6923233afaeSJohn W. De Boskey.Dl disklabel -R -n da0s1 label_layout 6933233afaeSJohn W. De Boskey.Pp 6943233afaeSJohn W. De BoskeyDisplay what the label would be for 6953233afaeSJohn W. De Boskey.Pa da0s1 6963233afaeSJohn W. De Boskeyusing the partition layout in 6973233afaeSJohn W. De Boskey.Pa label_layout . 6983233afaeSJohn W. De BoskeyThis is useful for determining how much space would be alloted for various 6997733674eSRuslan Ermilovpartitions with a labelling scheme using 7007733674eSRuslan Ermilov.Cm % Ns -based 7017733674eSRuslan Ermilovor 7027733674eSRuslan Ermilov.Cm * 7037733674eSRuslan Ermilovpartition sizes. 7043233afaeSJohn W. De Boskey.Pp 705ff7d5162SJordan K. Hubbard.Dl disklabel -B da0s1 7068fae3551SRodney W. Grimes.Pp 7074cbdc634SGreg LeheyInstall a new bootstrap on 708ff7d5162SJordan K. Hubbard.Pa da0s1 . 7098fae3551SRodney W. GrimesThe boot code comes from 7108d48318bSPoul-Henning Kamp.Pa /boot/boot . 7118fae3551SRodney W. GrimesOn-disk and in-core labels are unchanged. 7128fae3551SRodney W. Grimes.Pp 7138d48318bSPoul-Henning Kamp.Dl disklabel -w -B /dev/da0s1 -b newboot da2212 7148fae3551SRodney W. Grimes.Pp 7158fae3551SRodney W. GrimesInstall a new label and bootstrap. 716726b61abSRuslan ErmilovThe label is derived from disktab information for 717726b61abSRuslan Ermilov.Dq da2212 718726b61abSRuslan Ermilovand installed both in-core and on-disk. 7194cbdc634SGreg LeheyThe bootstrap code comes from the files 7208d48318bSPoul-Henning Kamp.Pa /boot/newboot 721ff7d5162SJordan K. Hubbard.Pp 722ff7d5162SJordan K. Hubbard.Dl dd if=/dev/zero of=/dev/da0 bs=512 count=32 723ff7d5162SJordan K. Hubbard.Dl fdisk -BI da0 724ff7d5162SJordan K. Hubbard.Dl dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 72566866007SRuslan Ermilov.Dl disklabel -w -B da0s1 auto 726ff7d5162SJordan K. Hubbard.Dl disklabel -e da0s1 727ff7d5162SJordan K. Hubbard.Pp 728ff7d5162SJordan K. HubbardCompletely wipe any prior information on the disk, creating a new bootable 729726b61abSRuslan Ermilovdisk with a DOS partition table containing one 730726b61abSRuslan Ermilov.Dq whole-disk 731726b61abSRuslan Ermilovslice. Then 732ff7d5162SJordan K. Hubbardinitialize the slice, then edit it to your needs. The 733ff7d5162SJordan K. Hubbard.Pa dd 734ff7d5162SJordan K. Hubbardcommands are optional, but may be necessary for some BIOSes to properly 735ff7d5162SJordan K. Hubbardrecognize the disk. 7363233afaeSJohn W. De Boskey.Pp 7373233afaeSJohn W. De BoskeyThis is an example disklabel that uses some of the new partition size types 7387733674eSRuslan Ermilovsuch as 7397733674eSRuslan Ermilov.Cm % , M , G , 7407733674eSRuslan Ermilovand 7417733674eSRuslan Ermilov.Cm * , 7427733674eSRuslan Ermilovwhich could be used as a source file for 7433233afaeSJohn W. De Boskey.Pp 7443233afaeSJohn W. De Boskey.Dl disklabel -R ad0s1c new_label_file 7453233afaeSJohn W. De Boskey.Bd -literal -offset 4n 7463233afaeSJohn W. De Boskey# /dev/ad0s1c: 7473233afaeSJohn W. De Boskeytype: ESDI 7483233afaeSJohn W. De Boskeydisk: ad0s1 7493233afaeSJohn W. De Boskeylabel: 7503233afaeSJohn W. De Boskeyflags: 7513233afaeSJohn W. De Boskeybytes/sector: 512 7523233afaeSJohn W. De Boskeysectors/track: 63 7533233afaeSJohn W. De Boskeytracks/cylinder: 16 7543233afaeSJohn W. De Boskeysectors/cylinder: 1008 7553233afaeSJohn W. De Boskeycylinders: 40633 7563233afaeSJohn W. De Boskeysectors/unit: 40959009 7573233afaeSJohn W. De Boskeyrpm: 3600 7583233afaeSJohn W. De Boskeyinterleave: 1 7593233afaeSJohn W. De Boskeytrackskew: 0 7603233afaeSJohn W. De Boskeycylinderskew: 0 7613233afaeSJohn W. De Boskeyheadswitch: 0 # milliseconds 7623233afaeSJohn W. De Boskeytrack-to-track seek: 0 # milliseconds 7633233afaeSJohn W. De Boskeydrivedata: 0 7643233afaeSJohn W. De Boskey 7653233afaeSJohn W. De Boskey8 partitions: 7663233afaeSJohn W. De Boskey# size offset fstype [fsize bsize bps/cpg] 7673233afaeSJohn W. De Boskey a: 400M 0 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) 7683233afaeSJohn W. De Boskey b: 1G * swap 7693233afaeSJohn W. De Boskey c: * * unused 7703233afaeSJohn W. De Boskey e: 204800 * 4.2BSD 7713233afaeSJohn W. De Boskey f: 5g * 4.2BSD 7723233afaeSJohn W. De Boskey g: * * 4.2BSD 7733233afaeSJohn W. De Boskey.Ed 7748fae3551SRodney W. Grimes.Sh SEE ALSO 77570e48365SGreg Lehey.Xr ccd 4 , 776af202156SWolfram Schneider.Xr disklabel 5 , 7774cbdc634SGreg Lehey.Xr disktab 5 , 778aa7c9adaSMike Pritchard.Xr boot0cfg 8 , 77970e48365SGreg Lehey.Xr fdisk 8 , 78070e48365SGreg Lehey.Xr vinum 8 7818fae3551SRodney W. Grimes.Sh DIAGNOSTICS 7828fae3551SRodney W. GrimesThe kernel device drivers will not allow the size of a disk partition 7838fae3551SRodney W. Grimesto be decreased or the offset of a partition to be changed while it is open. 7848fae3551SRodney W. GrimesSome device drivers create a label containing only a single large partition 7854cbdc634SGreg Leheyif a disk is unlabeled; thus, the label must be written to the 786726b61abSRuslan Ermilov.Dq a 7874cbdc634SGreg Leheypartition of the disk while it is open. This sometimes requires the desired 7884cbdc634SGreg Leheylabel to be set in two steps, the first one creating at least one other 7894cbdc634SGreg Leheypartition, and the second setting the label on the new partition while shrinking 7904cbdc634SGreg Leheythe 791726b61abSRuslan Ermilov.Dq a 7924cbdc634SGreg Leheypartition. 7938fae3551SRodney W. Grimes.Pp 7948fae3551SRodney W. GrimesOn some machines the bootstrap code may not fit entirely in the area 7958fae3551SRodney W. Grimesallocated for it by some file systems. 7968fae3551SRodney W. GrimesAs a result, it may not be possible to have file systems on some partitions 797726b61abSRuslan Ermilovof a 798726b61abSRuslan Ermilov.Dq bootable 799726b61abSRuslan Ermilovdisk. 8008fae3551SRodney W. GrimesWhen installing bootstrap code, 8016bd343a9SPhilippe Charnier.Nm 8028fae3551SRodney W. Grimeschecks for these cases. 8038fae3551SRodney W. GrimesIf the installed boot code would overlap a partition of type FS_UNUSED 8048fae3551SRodney W. Grimesit is marked as type FS_BOOT. 8058fae3551SRodney W. GrimesThe 8068fae3551SRodney W. Grimes.Xr newfs 8 8078fae3551SRodney W. Grimesutility will disallow creation of file systems on FS_BOOT partitions. 8088fae3551SRodney W. GrimesConversely, if a partition has a type other than FS_UNUSED or FS_BOOT, 8096bd343a9SPhilippe Charnier.Nm 8108fae3551SRodney W. Grimeswill not install bootstrap code that overlaps it. 8118fae3551SRodney W. Grimes.Sh BUGS 8128fae3551SRodney W. GrimesWhen a disk name is given without a full pathname, 813726b61abSRuslan Ermilovthe constructed device name uses the 814726b61abSRuslan Ermilov.Dq c 815726b61abSRuslan Ermilovpartition. 816d70e4e53SJoerg Wunsch.Pp 817d70e4e53SJoerg WunschFor the i386 architecture, the primary bootstrap sector contains 818d70e4e53SJoerg Wunschan embedded 819d70e4e53SJoerg Wunsch.Em fdisk 820d70e4e53SJoerg Wunschtable. 821e1205e80SPhilippe CharnierThe 822e1205e80SPhilippe Charnier.Nm 823e1205e80SPhilippe Charnierutility takes care to not clobber it when installing a bootstrap only 824d70e4e53SJoerg Wunsch.Pq Fl B , 825d70e4e53SJoerg Wunschor when editing an existing label 826d70e4e53SJoerg Wunsch.Pq Fl e , 827d70e4e53SJoerg Wunschbut it unconditionally writes the primary bootstrap program onto 828d70e4e53SJoerg Wunschthe disk for 829d70e4e53SJoerg Wunsch.Fl w 830d70e4e53SJoerg Wunschor 831d70e4e53SJoerg Wunsch.Fl R , 832d70e4e53SJoerg Wunschthus replacing the 833d70e4e53SJoerg Wunsch.Em fdisk 834d70e4e53SJoerg Wunschtable by the dummy one in the bootstrap program. This is only of 835753d686dSRuslan Ermilovconcern if the disk is fully dedicated, so that the 836753d686dSRuslan Ermilov.Bx 837753d686dSRuslan Ermilovdisklabel 838d70e4e53SJoerg Wunschstarts at absolute block 0 on the disk. 8394cbdc634SGreg Lehey.Pp 840e1205e80SPhilippe CharnierThe 8414cbdc634SGreg Lehey.Nm 842e1205e80SPhilippe Charnierutility 8433233afaeSJohn W. De Boskeydoes not perform all possible error checking. Warning *is* given if partitions 8447733674eSRuslan Ermilovoverlap; if an absolute offset does not match the expected offset; if the 8457733674eSRuslan Ermilov.Dq c 8467733674eSRuslan Ermilovpartition does not start at 0 or does not cover the entire slice; if a 8473233afaeSJohn W. De Boskeypartition runs past the end of the device; and a number of other errors; but 8483233afaeSJohn W. De Boskeyno warning is given if space remains unused. 849