1.\" Copyright (c) 1987, 1988, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" Symmetric Computer Systems. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. All advertising materials mentioning features or use of this software 16.\" must display the following acknowledgment: 17.\" This product includes software developed by the University of 18.\" California, Berkeley and its contributors. 19.\" 4. Neither the name of the University nor the names of its contributors 20.\" may be used to endorse or promote products derived from this software 21.\" without specific prior written permission. 22.\" 23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 36.\" $FreeBSD: src/sbin/disklabel/disklabel.8,v 1.15.2.22 2003/04/17 17:56:34 trhodes Exp $ 37.\" $DragonFly: src/sbin/disklabel64/disklabel64.8,v 1.13 2008/09/16 20:45:36 thomas Exp $ 38.\" 39.Dd August 21, 2008 40.Dt DISKLABEL64 8 41.Os 42.Sh NAME 43.Nm disklabel64 44.Nd read and write 64 bit disk pack label 45.Sh SYNOPSIS 46.Nm 47.Op Fl r 48.Ar disk 49.Nm 50.Fl w 51.Op Fl r 52.Op Fl n 53.Ar disk Ar disktype Ns / Ns Cm auto 54.Oo Ar packid Oc 55.Nm 56.Fl e 57.Op Fl r 58.Op Fl n 59.Ar disk 60.Nm 61.Fl R 62.Op Fl r 63.Op Fl n 64.Ar disk Ar protofile 65.Nm 66.Op Fl NW 67.Ar disk 68.\" .Pp 69.\" .Nm 70.\" .Fl B 71.\" .Oo 72.\" .Fl b Ar boot1 73.\" .Fl s Ar boot2 74.\" .Oc 75.\" .Ar disk 76.\" .Oo Ar disktype Ns / Ns Cm auto Oc 77.\" .Nm 78.\" .Fl w 79.\" .Fl B 80.\" .Op Fl n 81.\" .Oo 82.\" .Fl b Ar boot1 83.\" .Fl s Ar boot2 84.\" .Oc 85.\" .Ar disk Ar disktype Ns / Ns Cm auto 86.\" .Oo Ar packid Oc 87.\" .Nm 88.\" .Fl R 89.\" .Fl B 90.\" .Op Fl n 91.\" .Oo 92.\" .Fl b Ar boot1 93.\" .Fl s Ar boot2 94.\" .Oc 95.\" .Ar disk Ar protofile 96.\" .Oo Ar disktype Ns / Ns Cm auto Oc 97.Sh DESCRIPTION 98The 99.Nm 100utility 101installs, examines or modifies a 64 bit label on a disk drive or pack. 102When writing 103the label, it can be used to change the drive identification, the disk 104partitions on the drive, or to replace a damaged label. 105There are several forms 106of the command that read (display), install or edit the label on a disk. 107.\" In 108.\" addition, 109.\" .Nm 110.\" can install bootstrap code. 111.Ss Raw or in-core label 112The disk label resides close to or at the beginning of each disk slice. 113For faster access, the kernel maintains a copy in core at all times. 114By 115default, most forms of the 116.Nm 117command access the in-core copy of the label. 118To access the raw (on-disk) 119copy, use the 120.Fl r 121option. 122This option allows a label to be installed on a disk without kernel 123support for a label, such as when labels are first installed on a system; it 124must be used when first installing a label on a disk. 125The specific effect of 126.Fl r 127is described under each command. 128.Ss Disk device name 129All 130.Nm 131forms require a disk device name, which should always be the raw 132device name representing the disk or slice. 133.Dx 134uses the following scheme for slice numbering: 135If the disk doesn't use GPT (typically laid out by 136.Xr gpt 8 ) , 137but e.g.\& MBR (typically laid out by 138.Xr fdisk 8 ) , 139then slice 0, e.g.\& 140.Pa da0s0 , 141represents the entire disk regardless of any DOS partitioning. 142Slice 0 is called the compatibility slice, 143and slice 1 and onward, e.g.\& 144.Pa da0s1 , 145represents a 146.Bx 147slice. 148If the disk does use GPT then all slices are 149.Bx 150slices, slice 0 isn't special, it is just the first slice on the disk. 151You do not have to include the 152.Pa /dev/ 153path prefix when specifying the device. 154The 155.Nm 156utility will automatically prepend it. 157.Ss Reading the disk label 158To examine the label on a disk drive, use 159.Nm 160without options: 161.Pp 162.Nm 163.Op Fl r 164.Ar disk 165.Pp 166.Ar disk 167represents the raw disk in question, and may be in the form 168.Pa da0s1 169or 170.Pa /dev/da0s1 . 171It will display all of the parameters associated with the drive and its 172partition layout. 173Unless the 174.Fl r 175flag is given, 176the kernel's in-core copy of the label is displayed; 177if the disk has no label, or the partition types on the disk are incorrect, 178the kernel may have constructed or modified the label. 179If the 180.Fl r 181flag is given, 182.Nm 183reads the label from the raw disk and displays it. 184Both versions are usually 185identical except in the case where a label has not yet been initialized or 186is corrupt. 187.Ss Writing a standard label 188To write a standard label, use the form 189.Pp 190.Nm 191.Fl w 192.Op Fl r 193.Op Fl n 194.Ar disk Ar disktype Ns / Ns Cm auto 195.Oo Ar packid Oc 196.Pp 197The required arguments to 198.Nm 199are the drive to be labeled and the drive type as described in the 200.Xr disktab 5 201file. 202The drive parameters and partitions are taken from that file. 203If 204different disks of the same physical type are to have different partitions, it 205will be necessary to have separate disktab entries describing each, or to edit 206the label after installation as described below. 207The optional argument is a 208pack identification string, up to 16 characters long. 209The pack id must be 210quoted if it contains blanks. 211.Pp 212If the 213.Fl n 214flag is given, no data will be written to the device, and instead the 215disklabel that would have been written will be printed to stdout. 216.Pp 217If the 218.Fl r 219flag is given, the disk sectors containing the label 220.\" and bootstrap 221will be written directly. 222.\" A side-effect of this is that any existing bootstrap code will be overwritten 223.\" and the disk rendered unbootable. 224.\" See the boot options below for a method of 225.\" writing the label and the bootstrap at the same time. 226If 227.Fl r 228is not specified, 229the existing label will be updated via the in-core copy. 230.\" and any bootstrap code will be unaffected. 231If the disk does not already have a label, the 232.Fl r 233flag must be used. 234In either case, the kernel's in-core label is replaced. 235.Pp 236For a virgin disk that is not known to 237.Xr disktab 5 , 238.Ar disktype 239can be specified as 240.Cm auto . 241In this case, the driver is requested to produce a virgin label for the 242disk. 243This might or might not be successful, depending on whether the 244driver for the disk is able to get the required data without reading 245anything from the disk at all. 246It will likely succeed for all SCSI 247disks, most IDE disks, and vnode devices. 248Writing a label to the 249disk is the only supported operation, and the 250.Ar disk 251itself must be provided as the canonical name, i.e.\& not as a full 252path name. 253.Pp 254For most harddisks, a label based on percentages for most partitions (and 255one partition with a size of 256.Ql * ) 257will produce a reasonable configuration. 258.Pp 259PC-based systems have special requirements in order for the BIOS to properly 260recognize a 261.Dx 262disklabel. 263Older systems may require what is known as a 264.Dq dangerously dedicated 265disklabel, which creates a fake DOS partition to work around problems older 266BIOSes have with modern disk geometries. 267On newer systems you generally want 268to create a normal DOS partition using 269.Ar fdisk 270and then create a 271.Dx 272disklabel within that slice. 273This is described 274later on in this page. 275.\" .Pp 276.\" Installing a new disklabel does not in of itself allow your system to boot 277.\" a kernel using that label. 278.\" You must also install boot blocks, which is 279.\" described later on in this manual page. 280.Ss Editing an existing disk label 281To edit an existing disk label, use the form 282.Pp 283.Nm 284.Fl e 285.Op Fl r 286.Op Fl n 287.Ar disk 288.Pp 289This command reads the label from the in-core kernel copy, or directly from the 290disk if the 291.Fl r 292flag is also specified. 293The label is written to a file in ASCII and then 294supplied to an editor for changes. 295If no editor is specified in an 296.Ev EDITOR 297environment variable, 298.Xr vi 1 299is used. 300When the editor terminates, the label file is used to rewrite the disk 301label. 302.\" Existing bootstrap code is unchanged regardless of whether 303.\" .Fl r 304.\" was specified. 305If 306.Fl n 307is specified, no data will be written to the device, and instead the 308disklabel that would have been written will be printed to stdout. 309This is 310useful to see how a partitioning scheme will work out for a specific disk. 311.Ss Restoring a disk label from a file 312To restore a disk label from a file, use the form 313.Pp 314.Nm 315.Fl R 316.Op Fl r 317.Op Fl n 318.Ar disk Ar protofile 319.Pp 320.Nm 321is capable of restoring a disk label that was previously saved in a file 322in ASCII format. 323The prototype file used to create the label should be in the same format 324as that produced when reading or editing a label. 325Comments are delimited by 326.Ql # 327and newline. 328.\" As when writing a new label, any existing bootstrap code will be 329.\" clobbered if 330.\" .Fl r 331.\" is specified and will be unaffected otherwise. 332.\" See the boot options below for a 333.\" method of restoring the label and writing the bootstrap at the same time. 334If 335.Fl n 336is used, no data will be written to the device, and instead the 337disklabel that would have been written will be printed to stdout. 338This is 339useful to see how a partitioning scheme will work out for a specific disk. 340.Ss Enabling and disabling writing to the disk label area 341By default, it is not possible to write to the disk label area at the beginning 342of a disk. 343The disk driver arranges for 344.Xr write 2 345and similar system calls 346to return 347.Er EROFS 348on any attempt to do so. 349If you need 350to write to this area (for example, to obliterate the label), use the form 351.Pp 352.Nm 353.Fl W 354.Ar disk 355.Pp 356To disallow writing to the label area after previously allowing it, use the 357command 358.Pp 359.Nm 360.Fl N 361.Ar disk 362.\" .Ss Installing bootstraps 363.\" The final three forms of 364.\" .Nm 365.\" are used to install bootstrap code. 366.\" If you are creating a 367.\" .Dq dangerously-dedicated 368.\" slice for compatibility with older PC systems, 369.\" you generally want to specify the compatibility slice, such as 370.\" .Pa da0s0 . 371.\" If you are creating a label within an existing DOS slice, 372.\" you should specify 373.\" the slice name such as 374.\" .Pa da0s1 . 375.\" Making a slice bootable can be tricky. 376.\" If you are using a normal DOS 377.\" slice you typically install (or leave) a standard MBR on the base disk and 378.\" then install the 379.\" .Dx 380.\" bootblocks in the slice. 381.\" .Pp 382.\" .Nm 383.\" .Fl B 384.\" .Oo 385.\" .Fl b Ar boot1 386.\" .Fl s Ar boot2 387.\" .Oc 388.\" .Ar disk 389.\" .Oo Ar disktype Ns / Ns Cm auto Oc 390.\" .Pp 391.\" This form installs the bootstrap only. 392.\" It does not change the disk label. 393.\" You should never use this command on the compatibility slice unless you 394.\" intend to create a 395.\" .Dq dangerously-dedicated 396.\" disk, such as 397.\" .Ar da0s0 . 398.\" This command is typically run on a 399.\" .Bx 400.\" slice such as 401.\" .Ar da0s1 . 402.\" .Pp 403.\" .Nm 404.\" .Fl w 405.\" .Fl B 406.\" .Op Fl n 407.\" .Oo 408.\" .Fl b Ar boot1 409.\" .Fl s Ar boot2 410.\" .Oc 411.\" .Ar disk Ar disktype Ns / Ns Cm auto 412.\" .Oo Ar packid Oc 413.\" .Pp 414.\" This form corresponds to the 415.\" .Dq write label 416.\" command described above. 417.\" In addition to writing a new volume label, it also installs the bootstrap. 418.\" If run on the compatibility slice this command will create a 419.\" .Dq dangerously-dedicated 420.\" label. 421.\" This command is normally run on a 422.\" .Bx 423.\" slice rather than the compatibility 424.\" slice. 425.\" If 426.\" .Fl n 427.\" is used, no data will be written to the device, and instead the 428.\" disklabel that would have been written will be printed to stdout. 429.\" .Pp 430.\" .Nm 431.\" .Fl R 432.\" .Fl B 433.\" .Op Fl n 434.\" .Oo 435.\" .Fl b Ar boot1 436.\" .Fl s Ar boot2 437.\" .Oc 438.\" .Ar disk Ar protofile 439.\" .Oo Ar disktype Ns / Ns Cm auto Oc 440.\" .Pp 441.\" This form corresponds to the 442.\" .Dq restore label 443.\" command described above. 444.\" In addition to restoring the volume label, it also installs the bootstrap. 445.\" If run on the compatibility slice this command will create a 446.\" .Dq dangerously-dedicated 447.\" label. 448.\" This command is normally run on a 449.\" .Bx 450.\" slice rather than the compatibility 451.\" slice. 452.\" .Pp 453.\" The bootstrap commands always access the disk directly, so it is not necessary 454.\" to specify the 455.\" .Fl r 456.\" flag. 457.\" If 458.\" .Fl n 459.\" is used, no data will be written to the device, and instead the 460.\" disklabel that would have been written will be printed to stdout. 461.\" .Pp 462.\" The bootstrap code is comprised of two boot programs. 463.\" Specify the name of the 464.\" boot programs to be installed in one of these ways: 465.\" .Bl -enum 466.\" .It 467.\" Specify the names explicitly with the 468.\" .Fl b 469.\" and 470.\" .Fl s 471.\" flags. 472.\" .Fl b 473.\" indicates the primary boot program and 474.\" .Fl s 475.\" the secondary boot program. 476.\" The boot programs are located in 477.\" .Pa /boot . 478.\" .It 479.\" If the 480.\" .Fl b 481.\" and 482.\" .Fl s 483.\" flags are not specified, but 484.\" .Ar disktype 485.\" was specified, the names of the programs are taken from the 486.\" .Dq b0 487.\" and 488.\" .Dq b1 489.\" parameters of the 490.\" .Xr disktab 5 491.\" entry for the disk if the disktab entry exists and includes those parameters. 492.\" .It 493.\" Otherwise, the default boot image names are used: 494.\" .Pa /boot/boot1 495.\" and 496.\" .Pa /boot/boot2 497.\" for the standard stage1 and stage2 boot images. 498.\" .El 499.\" .Ss Initializing/Formatting a bootable disk from scratch 500.Ss Initializing/Formatting a disk from scratch 501To initialize a disk from scratch the following sequence is recommended. 502Please note that this will wipe everything that was previously on the disk, 503including any 504.No non- Ns Dx 505slices. 506.Bl -enum 507.It 508Use 509.Xr gpt 8 510or 511.Xr fdisk 8 512to initialize the hard disk, and create a GPT or MBR slice table, referred to 513as the 514.Dq "partition table" 515in 516.Tn DOS . 517.It 518Use 519.Nm 520to define partitions on 521.Dx 522slices created in the previous step. 523.It 524Finally use 525.Xr newfs 8 526or 527.Xr newfs_hammer 8 528to create file systems on new partitions. 529.El 530.Pp 531A typical partitioning scheme would be to have an 532.Ql a 533partition 534of approximately 512MB to hold the root file system, a 535.Ql b 536partition for 537swap (usually 4GB), a 538.Ql d 539partition for 540.Pa /var 541(usually 2GB), an 542.Ql e 543partition 544for 545.Pa /var/tmp 546(usually 2GB), an 547.Ql f 548partition for 549.Pa /usr 550(usually around 4GB), 551and finally a 552.Ql g 553partition for 554.Pa /home 555(usually all remaining space). 556If you are tight on space all sizes can be halved. 557Your mileage may vary. 558.Pp 559.Nm gpt create Pa da0 560.Pp 561.Nm gpt add Pa da0 562.Pp 563.Nm 564.\" .Fl w B 565.Fl r w 566.Pa da0s0 567.Cm auto 568.Pp 569.Nm 570.Fl e 571.Pa da0s0 572.Sh FILES 573.Bl -tag -width ".Pa /etc/disktab" -compact 574.\" .It Pa /boot/boot1 575.\" Default stage1 boot image. 576.\" .It Pa /boot/boot2 577.\" Default stage2 boot image. 578.It Pa /etc/disktab 579Disk description file. 580.El 581.Sh SAVED FILE FORMAT 582The 583.Nm 584utility 585uses an 586.Tn ASCII 587version of the label when examining, editing, or restoring a disk 588label. 589The format is: 590.Bd -literal -offset 4n 591# /dev/ad4s4: 592# 593# Informational fields calculated from the above 594# All byte equivalent offsets must be aligned 595# 596# boot space: 32768 bytes 597# data space: 121790552 blocks # 118936.09 MB (124713525248 bytes) 598# 599diskid: 5e3ef4db-4e24-11dd-8318-010e0cd0bad1 600label: 601boot2 data base: 0x000000001000 602partitions data base: 0x000000009000 603partitions data stop: 0x001d0981f000 604backup label: 0x001d0981f000 605total size: 0x001d09820000 # 118936.12 MB 606alignment: 4096 607display block size: 1024 # for partition display only 608 60916 partitions: 610# size offset fstype fsuuid 611 a: 524288 0 4.2BSD # 512.000MB 612 b: 4194304 524288 swap # 4096.000MB 613 d: 2097152 4718592 4.2BSD # 2048.000MB 614 e: 2097152 6815744 4.2BSD # 2048.000MB 615 f: 4194304 8912896 4.2BSD # 4096.000MB 616 g: 4194304 13107200 4.2BSD # 4096.000MB 617 h: 94003288 17301504 HAMMER # 91800.086MB 618 i: 5242880 111304792 ccd # 5120.000MB 619 j: 5242880 116547672 vinum # 5120.000MB 620 a-stor_uuid: 4370efdb-4e25-11dd-8318-010e0cd0bad1 621 b-stor_uuid: 4370eff4-4e25-11dd-8318-010e0cd0bad1 622 d-stor_uuid: 4370f00b-4e25-11dd-8318-010e0cd0bad1 623 e-stor_uuid: 4370f024-4e25-11dd-8318-010e0cd0bad1 624 f-stor_uuid: 4370f03a-4e25-11dd-8318-010e0cd0bad1 625 g-stor_uuid: 4370f053-4e25-11dd-8318-010e0cd0bad1 626 h-stor_uuid: 4370f06a-4e25-11dd-8318-010e0cd0bad1 627 i-stor_uuid: 4370f083-4e25-11dd-8318-010e0cd0bad1 628 j-stor_uuid: 4370f099-4e25-11dd-8318-010e0cd0bad1 629.Ed 630.Pp 631Lines starting with a 632.Ql # 633mark are comments. 634The specifications which can be changed are: 635.Bl -inset 636.It Ar label 637is an optional label, set by the 638.Ar packid 639option when writing a label. 640.It Ar "the partition table" 641is the 642.Ux 643partition table, not the 644.Tn DOS 645partition table described in 646.Xr fdisk 8 . 647.El 648.Pp 649The partition table can have up to 16 entries. 650It contains the following information: 651.Bl -tag -width indent 652.It Ar # 653The partition identifier is a single letter in the range 654.Ql a 655to 656.Ql p . 657.It Ar size 658The size of the partition in sectors, 659.Cm K 660(kilobytes - 1024), 661.Cm M 662(megabytes - 1024*1024), 663.Cm G 664(gigabytes - 1024*1024*1024), 665.Cm % 666(percentage of free space 667.Em after 668removing any fixed-size partitions), 669.Cm * 670(all remaining free space 671.Em after 672fixed-size and percentage partitions). 673Lowercase versions of 674.Cm K , M , 675and 676.Cm G 677are allowed. 678Size and type should be specified without any spaces between them. 679.Pp 680Example: 2097152, 1G, 1024M and 1048576K are all the same size 681(assuming 512-byte sectors). 682.It Ar offset 683The offset of the start of the partition from the beginning of the 684drive in sectors, or 685.Cm * 686to have 687.Nm 688calculate the correct offset to use (the end of the previous partition plus 689one. 690.It Ar fstype 691Describes the purpose of the partition. 692The example shows all currently used partition types. 693For 694.Xr UFS 5 695file systems, use type 696.Cm 4.2BSD . 697For 698.Xr HAMMER 5 699file systems, use type 700.Cm HAMMER . 701For 702.Xr ccd 4 703partitions, use type 704.Cm ccd . 705For Vinum drives, use type 706.Cm vinum . 707Other common types are 708.Cm swap 709and 710.Cm unused . 711The 712.Nm 713utility 714also knows about a number of other partition types, 715none of which are in current use. 716(See 717.Dv fstypenames 718in 719.In sys/dtype.h 720for more details). 721.El 722.Pp 723The remainder of the line is a comment and shows the size of the partition 724in MB. 725.Sh EXAMPLES 726.Dl "disklabel64 da0s1" 727.Pp 728Display the in-core label for the first slice of the 729.Pa da0 730disk, as obtained via 731.Pa /dev/da0s1 . 732(If the disk is 733.Dq dangerously-dedicated , 734the compatibility slice name should be specified, such as 735.Pa da0s0 . ) 736.Pp 737.Dl "disklabel64 da0s1 > savedlabel" 738.Pp 739Save the in-core label for 740.Pa da0s1 741into the file 742.Pa savedlabel . 743This file can be used with the 744.Fl R 745option to restore the label at a later date. 746.Pp 747.Dl "disklabel64 -w -r /dev/da0s1 da2212 foo" 748.Pp 749Create a label for 750.Pa da0s1 751based on information for 752.Dq da2212 753found in 754.Pa /etc/disktab . 755.\" Any existing bootstrap code will be clobbered 756.\" and the disk rendered unbootable. 757.Pp 758.Dl "disklabel64 -e -r da0s1" 759.Pp 760Read the on-disk label for 761.Pa da0s1 , 762edit it, and reinstall in-core as well as on-disk. 763.\" Existing bootstrap code is unaffected. 764.Pp 765.Dl "disklabel64 -e -r -n da0s1" 766.Pp 767Read the on-disk label for 768.Pa da0s1 , 769edit it, and display what the new label would be (in sectors). 770It does 771.Em not 772install the new label either in-core or on-disk. 773.Pp 774.Dl "disklabel64 -r -w da0s1 auto" 775.Pp 776Try to auto-detect the required information from 777.Pa da0s1 , 778and write a new label to the disk. 779Use another 780.Nm Fl e 781command to edit the partitioning information. 782.Pp 783.Dl "disklabel64 -R da0s1 savedlabel" 784.Pp 785Restore the on-disk and in-core label for 786.Pa da0s1 787from information in 788.Pa savedlabel . 789.\" Existing bootstrap code is unaffected. 790.Pp 791.Dl "disklabel64 -R -n da0s1 label_layout" 792.Pp 793Display what the label would be for 794.Pa da0s1 795using the partition layout in 796.Pa label_layout . 797This is useful for determining how much space would be allotted for various 798partitions with a labelling scheme using 799.Cm % Ns -based 800or 801.Cm * 802partition sizes. 803.Pp 804.\" .Dl disklabel64 -B da0s1 805.\" .Pp 806.\" Install a new bootstrap on 807.\" .Pa da0s1 . 808.\" The boot code comes from 809.\" .Pa /boot/boot1 810.\" and possibly 811.\" .Pa /boot/boot2 . 812.\" On-disk and in-core labels are unchanged. 813.\" .Pp 814.\" .Dl disklabel64 -w -B /dev/da0s1 -b newboot1 -s newboot2 da2212 815.\" .Pp 816.\" Install a new label and bootstrap. 817.\" The label is derived from disktab information for 818.\" .Dq da2212 819.\" and installed both in-core and on-disk. 820.\" The bootstrap code comes from the files 821.\" .Pa /boot/newboot1 822.\" and 823.\" .Pa /boot/newboot2 . 824.\" .Pp 825.\" .Dl dd if=/dev/zero of=/dev/da0 bs=512 count=32 826.\" .Dl fdisk -BI da0 827.\" .Dl dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 828.\" .Dl disklabel64 -w -B da0s1 auto 829.\" .Dl disklabel64 -e da0s1 830.\" .Pp 831.\" Completely wipe any prior information on the disk, creating a new bootable 832.\" disk with a DOS partition table containing one 833.\" .Dq whole-disk 834.\" slice. 835.\" Then 836.\" initialize the slice, then edit it to your needs. 837.\" The 838.\" .Pa dd 839.\" commands are optional, but may be necessary for some BIOSes to properly 840.\" recognize the disk. 841.\" .Pp 842This is an example disklabel that uses some of the new partition size types 843such as 844.Cm % , M , G , 845and 846.Cm * , 847which could be used as a source file for 848.Pp 849.Dl disklabel64 -R ad0s1 new_label_file 850.Bd -literal -offset 4n 851# /dev/ad4s4: 852# 853# Informational fields calculated from the above 854# All byte equivalent offsets must be aligned 855# 856# boot space: 32768 bytes 857# data space: 121790552 blocks # 118936.09 MB (124713525248 bytes) 858# 859diskid: b1db58a3-4e26-11dd-8318-010e0cd0bad1 860label: 861boot2 data base: 0x000000001000 862partitions data base: 0x000000009000 863partitions data stop: 0x001d0981f000 864backup label: 0x001d0981f000 865total size: 0x001d09820000 # 118936.12 MB 866alignment: 4096 867display block size: 1024 # for partition display only 868 86916 partitions: 870# size offset fstype fsuuid 871 a: 512M 0 4.2BSD 872 b: 4G * swap 873 d: 2G * 4.2BSD 874 e: 2048M * 4.2BSD 875 f: 4G * 4.2BSD 876 g: 4G * 4.2BSD 877 h: * * HAMMER 878 i: 5g * ccd 879 j: 5120m * vinum 880.Ed 881.Sh DIAGNOSTICS 882The kernel device drivers will not allow the size of a disk partition 883to be decreased or the offset of a partition to be changed while it is open. 884Some device drivers create a label containing only a single large partition 885if a disk is unlabeled; thus, the label must be written to the 886.Ql a 887partition of the disk while it is open. 888This sometimes requires the desired 889label to be set in two steps, the first one creating at least one other 890partition, and the second setting the label on the new partition while 891shrinking the 892.Ql a 893partition. 894.\" .Pp 895.\" On some machines the bootstrap code may not fit entirely in the area 896.\" allocated for it by some file systems. 897.\" As a result, it may not be possible to have file systems on some partitions 898.\" of a 899.\" .Dq bootable 900.\" disk. 901.\" When installing bootstrap code, 902.\" .Nm 903.\" checks for these cases. 904.\" If the installed boot code would overlap a partition of type 905.\" .Dv FS_UNUSED 906.\" it is marked as type 907.\" .Dv FS_BOOT . 908.\" The 909.\" .Xr newfs 8 910.\" utility will disallow creation of file systems on 911.\" .Dv FS_BOOT 912.\" partitions. 913.\" Conversely, if a partition has a type other than 914.\" .Dv FS_UNUSED 915.\" or 916.\" .Dv FS_BOOT , 917.\" .Nm 918.\" will not install bootstrap code that overlaps it. 919.Sh SEE ALSO 920.Xr dd 1 , 921.Xr uuid 3 , 922.Xr ccd 4 , 923.Xr disklabel64 5 , 924.Xr disktab 5 , 925.Xr boot0cfg 8 , 926.Xr diskinfo 8 , 927.Xr disklabel 8 , 928.Xr fdisk 8 , 929.Xr gpt 8 , 930.Xr newfs 8 , 931.Xr newfs_hammer 8 , 932.Xr vinum 8 933.Sh BUGS 934.\" For the i386 architecture, the primary bootstrap sector contains 935.\" an embedded 936.\" .Em fdisk 937.\" table. 938.\" The 939.\" .Nm 940.\" utility takes care to not clobber it when installing a bootstrap only 941.\" .Pq Fl B , 942.\" or when editing an existing label 943.\" .Pq Fl e , 944.\" but it unconditionally writes the primary bootstrap program onto 945.\" the disk for 946.\" .Fl w 947.\" or 948.\" .Fl R , 949.\" thus replacing the 950.\" .Em fdisk 951.\" table by the dummy one in the bootstrap program. 952.\" This is only of 953.\" concern if the disk is fully dedicated, so that the 954.\" .Bx 955.\" disklabel 956.\" starts at absolute block 0 on the disk. 957.\" .Pp 958The 959.Nm 960utility 961does not perform all possible error checking. 962Warning 963.Em is 964given if partitions 965overlap; if an absolute offset does not match the expected offset; 966if a 967partition runs past the end of the device; and a number of other errors; but 968no warning is given if space remains unused. 969.Pp 970.Dx 971doesn't support booting from 972.Nm 973partitions. 974