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.11 2008/08/22 21:00:01 swildner 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/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/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/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/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/auto 195.Oo Ar packid Oc 196.Pp 197.Nm 198.Fl w 199.Op Fl r 200.Op Fl n 201.Ar disk 202auto 203.Pp 204The required arguments to 205.Nm 206are the drive to be labeled and the drive type as described in the 207.Xr disktab 5 208file. 209The drive parameters and partitions are taken from that file. 210If 211different disks of the same physical type are to have different partitions, it 212will be necessary to have separate disktab entries describing each, or to edit 213the label after installation as described below. 214The optional argument is a 215pack identification string, up to 16 characters long. 216The pack id must be 217quoted if it contains blanks. 218.Pp 219If the 220.Fl n 221flag is given, no data will be written to the device, and instead the 222disklabel that would have been written will be printed to stdout. 223.Pp 224If the 225.Fl r 226flag is given, the disk sectors containing the label 227.\" and bootstrap 228will be written directly. 229.\" A side-effect of this is that any existing bootstrap code will be overwritten 230.\" and the disk rendered unbootable. 231.\" See the boot options below for a method of 232.\" writing the label and the bootstrap at the same time. 233If 234.Fl r 235is not specified, 236the existing label will be updated via the in-core copy. 237.\" and any bootstrap code will be unaffected. 238If the disk does not already have a label, the 239.Fl r 240flag must be used. 241In either case, the kernel's in-core label is replaced. 242.Pp 243For a virgin disk that is not known to 244.Xr disktab 5 , 245.Ar disktype 246can be specified as 247.Dq auto . 248In this case, the driver is requested to produce a virgin label for the 249disk. 250This might or might not be successful, depending on whether the 251driver for the disk is able to get the required data without reading 252anything from the disk at all. 253It will likely succeed for all SCSI 254disks, most IDE disks, and vnode devices. 255Writing a label to the 256disk is the only supported operation, and the 257.Ar disk 258itself must be provided as the canonical name, i.e.\& not as a full 259path name. 260.Pp 261For most harddisks, a label based on percentages for most partitions (and 262one partition with a size of 263.Ql * ) 264will produce a reasonable configuration. 265.Pp 266PC-based systems have special requirements in order for the BIOS to properly 267recognize a 268.Dx 269disklabel. 270Older systems may require what is known as a 271.Dq dangerously dedicated 272disklabel, which creates a fake DOS partition to work around problems older 273BIOSes have with modern disk geometries. 274On newer systems you generally want 275to create a normal DOS partition using 276.Ar fdisk 277and then create a 278.Dx 279disklabel within that slice. 280This is described 281later on in this page. 282.\" .Pp 283.\" Installing a new disklabel does not in of itself allow your system to boot 284.\" a kernel using that label. 285.\" You must also install boot blocks, which is 286.\" described later on in this manual page. 287.Ss Editing an existing disk label 288To edit an existing disk label, use the form 289.Pp 290.Nm 291.Fl e 292.Op Fl r 293.Op Fl n 294.Ar disk 295.Pp 296This command reads the label from the in-core kernel copy, or directly from the 297disk if the 298.Fl r 299flag is also specified. 300The label is written to a file in ASCII and then 301supplied to an editor for changes. 302If no editor is specified in an 303.Ev EDITOR 304environment variable, 305.Xr vi 1 306is used. 307When the editor terminates, the label file is used to rewrite the disk 308label. 309.\" Existing bootstrap code is unchanged regardless of whether 310.\" .Fl r 311.\" was specified. 312If 313.Fl n 314is specified, no data will be written to the device, and instead the 315disklabel that would have been written will be printed to stdout. 316This is 317useful to see how a partitioning scheme will work out for a specific disk. 318.Ss Restoring a disk label from a file 319To restore a disk label from a file, use the form 320.Pp 321.Nm 322.Fl R 323.Op Fl r 324.Op Fl n 325.Ar disk Ar protofile 326.Pp 327.Nm 328is capable of restoring a disk label that was previously saved in a file 329in ASCII format. 330The prototype file used to create the label should be in the same format 331as that produced when reading or editing a label. 332Comments are delimited by 333.Ar \&# 334and newline. 335.\" As when writing a new label, any existing bootstrap code will be 336.\" clobbered if 337.\" .Fl r 338.\" is specified and will be unaffected otherwise. 339.\" See the boot options below for a 340.\" method of restoring the label and writing the bootstrap at the same time. 341If 342.Fl n 343is used, no data will be written to the device, and instead the 344disklabel that would have been written will be printed to stdout. 345This is 346useful to see how a partitioning scheme will work out for a specific disk. 347.Ss Enabling and disabling writing to the disk label area 348By default, it is not possible to write to the disk label area at the beginning 349of a disk. 350The disk driver arranges for 351.Xr write 2 352and similar system calls 353to return 354.Er EROFS 355on any attempt to do so. 356If you need 357to write to this area (for example, to obliterate the label), use the form 358.Pp 359.Nm 360.Fl W 361.Ar disk 362.Pp 363To disallow writing to the label area after previously allowing it, use the 364command 365.Pp 366.Nm 367.Fl N 368.Ar disk 369.\" .Ss Installing bootstraps 370.\" The final three forms of 371.\" .Nm 372.\" are used to install bootstrap code. 373.\" If you are creating a 374.\" .Dq dangerously-dedicated 375.\" slice for compatibility with older PC systems, 376.\" you generally want to specify the compatibility slice, such as 377.\" .Pa da0s0 . 378.\" If you are creating a label within an existing DOS slice, 379.\" you should specify 380.\" the slice name such as 381.\" .Pa da0s1 . 382.\" Making a slice bootable can be tricky. 383.\" If you are using a normal DOS 384.\" slice you typically install (or leave) a standard MBR on the base disk and 385.\" then install the 386.\" .Dx 387.\" bootblocks in the slice. 388.\" .Pp 389.\" .Nm 390.\" .Fl B 391.\" .Oo 392.\" .Fl b Ar boot1 393.\" .Fl s Ar boot2 394.\" .Oc 395.\" .Ar disk 396.\" .Oo Ar disktype Oc 397.\" .Pp 398.\" This form installs the bootstrap only. 399.\" It does not change the disk label. 400.\" You should never use this command on the compatibility slice unless you 401.\" intend to create a 402.\" .Dq dangerously-dedicated 403.\" disk, such as 404.\" .Ar da0s0 . 405.\" This command is typically run on a 406.\" .Bx 407.\" slice such as 408.\" .Ar da0s1 . 409.\" .Pp 410.\" .Nm 411.\" .Fl w 412.\" .Fl B 413.\" .Op Fl n 414.\" .Oo 415.\" .Fl b Ar boot1 416.\" .Fl s Ar boot2 417.\" .Oc 418.\" .Ar disk Ar disktype 419.\" .Oo Ar packid Oc 420.\" .Pp 421.\" This form corresponds to the 422.\" .Dq write label 423.\" command described above. 424.\" In addition to writing a new volume label, it also installs the bootstrap. 425.\" If run on the compatibility slice this command will create a 426.\" .Dq dangerously-dedicated 427.\" label. 428.\" This command is normally run on a 429.\" .Bx 430.\" slice rather than the compatibility 431.\" slice. 432.\" If 433.\" .Fl n 434.\" is used, no data will be written to the device, and instead the 435.\" disklabel that would have been written will be printed to stdout. 436.\" .Pp 437.\" .Nm 438.\" .Fl R 439.\" .Fl B 440.\" .Op Fl n 441.\" .Oo 442.\" .Fl b Ar boot1 443.\" .Fl s Ar boot2 444.\" .Oc 445.\" .Ar disk Ar protofile 446.\" .Oo Ar disktype Oc 447.\" .Pp 448.\" This form corresponds to the 449.\" .Dq restore label 450.\" command described above. 451.\" In addition to restoring the volume label, it also installs the bootstrap. 452.\" If run on the compatibility slice this command will create a 453.\" .Dq dangerously-dedicated 454.\" label. 455.\" This command is normally run on a 456.\" .Bx 457.\" slice rather than the compatibility 458.\" slice. 459.\" .Pp 460.\" The bootstrap commands always access the disk directly, so it is not necessary 461.\" to specify the 462.\" .Fl r 463.\" flag. 464.\" If 465.\" .Fl n 466.\" is used, no data will be written to the device, and instead the 467.\" disklabel that would have been written will be printed to stdout. 468.\" .Pp 469.\" The bootstrap code is comprised of two boot programs. 470.\" Specify the name of the 471.\" boot programs to be installed in one of these ways: 472.\" .Bl -enum 473.\" .It 474.\" Specify the names explicitly with the 475.\" .Fl b 476.\" and 477.\" .Fl s 478.\" flags. 479.\" .Fl b 480.\" indicates the primary boot program and 481.\" .Fl s 482.\" the secondary boot program. 483.\" The boot programs are located in 484.\" .Pa /boot . 485.\" .It 486.\" If the 487.\" .Fl b 488.\" and 489.\" .Fl s 490.\" flags are not specified, but 491.\" .Ar disktype 492.\" was specified, the names of the programs are taken from the 493.\" .Dq b0 494.\" and 495.\" .Dq b1 496.\" parameters of the 497.\" .Xr disktab 5 498.\" entry for the disk if the disktab entry exists and includes those parameters. 499.\" .It 500.\" Otherwise, the default boot image names are used: 501.\" .Pa /boot/boot1 502.\" and 503.\" .Pa /boot/boot2 504.\" for the standard stage1 and stage2 boot images. 505.\" .El 506.\" .Ss Initializing/Formatting a bootable disk from scratch 507.Ss Initializing/Formatting a disk from scratch 508To initialize a disk from scratch the following sequence is recommended. 509Please note that this will wipe everything that was previously on the disk, 510including any 511.No non- Ns Dx 512slices. 513.Bl -enum 514.It 515Use 516.Xr gpt 8 517or 518.Xr fdisk 8 519to initialize the hard disk, and create a GPT or MBR slice table, referred to 520as the 521.Dq "partition table" 522in 523.Tn DOS . 524.It 525Use 526.Nm 527to define partitions on 528.Dx 529slices created in the previous step. 530.It 531Finally use 532.Xr newfs 8 533or 534.Xr newfs_hammer 8 535to create file systems on new partitions. 536.El 537.Pp 538A typical partitioning scheme would be to have an 539.Ql a 540partition 541of approximately 512MB to hold the root file system, a 542.Ql b 543partition for 544swap (usually 4GB), a 545.Ql d 546partition for 547.Pa /var 548(usually 2GB), an 549.Ql e 550partition 551for 552.Pa /var/tmp 553(usually 2GB), an 554.Ql f 555partition for 556.Pa /usr 557(usually around 4GB), 558and finally a 559.Ql g 560partition for 561.Pa /home 562(usually all remaining space). 563If you are tight on space all sizes can be halved. 564Your mileage may vary. 565.Pp 566.Nm gpt create Pa da0 567.Pp 568.Nm gpt add Pa da0 569.Pp 570.Nm 571.\" .Fl w B 572.Fl r w 573.Pa da0s0 574.Cm auto 575.Pp 576.Nm 577.Fl e 578.Pa da0s0 579.Sh FILES 580.Bl -tag -width ".Pa /etc/disktab" -compact 581.\" .It Pa /boot/boot1 582.\" Default stage1 boot image. 583.\" .It Pa /boot/boot2 584.\" Default stage2 boot image. 585.It Pa /etc/disktab 586Disk description file. 587.El 588.Sh SAVED FILE FORMAT 589The 590.Nm 591utility 592uses an 593.Tn ASCII 594version of the label when examining, editing, or restoring a disk 595label. 596The format is: 597.Bd -literal -offset 4n 598# /dev/ad4s4: 599# 600# Informational fields calculated from the above 601# All byte equivalent offsets must be aligned 602# 603# boot space: 32768 bytes 604# data space: 121790552 blocks # 118936.09 MB (124713525248 bytes) 605# 606diskid: 5e3ef4db-4e24-11dd-8318-010e0cd0bad1 607label: 608boot2 data base: 0x000000001000 609partitions data base: 0x000000009000 610partitions data stop: 0x001d0981f000 611backup label: 0x001d0981f000 612total size: 0x001d09820000 # 118936.12 MB 613alignment: 4096 614display block size: 1024 # for partition display only 615 61616 partitions: 617# size offset fstype fsuuid 618 a: 524288 0 4.2BSD # 512.000MB 619 b: 4194304 524288 swap # 4096.000MB 620 d: 2097152 4718592 4.2BSD # 2048.000MB 621 e: 2097152 6815744 4.2BSD # 2048.000MB 622 f: 4194304 8912896 4.2BSD # 4096.000MB 623 g: 4194304 13107200 4.2BSD # 4096.000MB 624 h: 94003288 17301504 HAMMER # 91800.086MB 625 i: 5242880 111304792 ccd # 5120.000MB 626 j: 5242880 116547672 vinum # 5120.000MB 627 a-stor_uuid: 4370efdb-4e25-11dd-8318-010e0cd0bad1 628 b-stor_uuid: 4370eff4-4e25-11dd-8318-010e0cd0bad1 629 d-stor_uuid: 4370f00b-4e25-11dd-8318-010e0cd0bad1 630 e-stor_uuid: 4370f024-4e25-11dd-8318-010e0cd0bad1 631 f-stor_uuid: 4370f03a-4e25-11dd-8318-010e0cd0bad1 632 g-stor_uuid: 4370f053-4e25-11dd-8318-010e0cd0bad1 633 h-stor_uuid: 4370f06a-4e25-11dd-8318-010e0cd0bad1 634 i-stor_uuid: 4370f083-4e25-11dd-8318-010e0cd0bad1 635 j-stor_uuid: 4370f099-4e25-11dd-8318-010e0cd0bad1 636.Ed 637.Pp 638Lines starting with a 639.Ql # 640mark are comments. 641The specifications which can be changed are: 642.Bl -inset 643.It Ar label 644is an optional label, set by the 645.Ar packid 646option when writing a label. 647.It Ar "the partition table" 648is the 649.Ux 650partition table, not the 651.Tn DOS 652partition table described in 653.Xr fdisk 8 . 654.El 655.Pp 656The partition table can have up to 16 entries. 657It contains the following information: 658.Bl -tag -width indent 659.It Ar # 660The partition identifier is a single letter in the range 661.Ql a 662to 663.Ql p . 664.It Ar size 665The size of the partition in sectors, 666.Cm K 667(kilobytes - 1024), 668.Cm M 669(megabytes - 1024*1024), 670.Cm G 671(gigabytes - 1024*1024*1024), 672.Cm % 673(percentage of free space 674.Em after 675removing any fixed-size partitions), 676.Cm * 677(all remaining free space 678.Em after 679fixed-size and percentage partitions). 680Lowercase versions of 681.Cm K , M , 682and 683.Cm G 684are allowed. 685Size and type should be specified without any spaces between them. 686.Pp 687Example: 2097152, 1G, 1024M and 1048576K are all the same size 688(assuming 512-byte sectors). 689.It Ar offset 690The offset of the start of the partition from the beginning of the 691drive in sectors, or 692.Cm * 693to have 694.Nm 695calculate the correct offset to use (the end of the previous partition plus 696one. 697.It Ar fstype 698Describes the purpose of the partition. 699The example shows all currently used partition types. 700For 701.Tn UFS 702file systems, use type 703.Cm 4.2BSD . 704For 705.Xr HAMMER 5 706file systems, use type 707.Cm HAMMER . 708For 709.Xr ccd 4 710partitions, use type 711.Cm ccd . 712For Vinum drives, use type 713.Cm vinum . 714Other common types are 715.Cm swap 716and 717.Cm unused . 718The 719.Nm 720utility 721also knows about a number of other partition types, 722none of which are in current use. 723(See 724.Dv fstypenames 725in 726.In sys/dtype.h 727for more details). 728.El 729.Pp 730The remainder of the line is a comment and shows the size of the partition 731in MB. 732.Sh EXAMPLES 733.Dl "disklabel64 da0s1" 734.Pp 735Display the in-core label for the first slice of the 736.Pa da0 737disk, as obtained via 738.Pa /dev/da0s1 . 739(If the disk is 740.Dq dangerously-dedicated , 741the compatibility slice name should be specified, such as 742.Pa da0s0 . ) 743.Pp 744.Dl "disklabel64 da0s1 > savedlabel" 745.Pp 746Save the in-core label for 747.Pa da0s1 748into the file 749.Pa savedlabel . 750This file can be used with the 751.Fl R 752option to restore the label at a later date. 753.Pp 754.Dl "disklabel64 -w -r /dev/da0s1 da2212 foo" 755.Pp 756Create a label for 757.Pa da0s1 758based on information for 759.Dq da2212 760found in 761.Pa /etc/disktab . 762.\" Any existing bootstrap code will be clobbered 763.\" and the disk rendered unbootable. 764.Pp 765.Dl "disklabel64 -e -r da0s1" 766.Pp 767Read the on-disk label for 768.Pa da0s1 , 769edit it, and reinstall in-core as well as on-disk. 770.\" Existing bootstrap code is unaffected. 771.Pp 772.Dl "disklabel64 -e -r -n da0s1" 773.Pp 774Read the on-disk label for 775.Pa da0s1 , 776edit it, and display what the new label would be (in sectors). 777It does 778.Em not 779install the new label either in-core or on-disk. 780.Pp 781.Dl "disklabel64 -r -w da0s1 auto" 782.Pp 783Try to auto-detect the required information from 784.Pa da0s1 , 785and write a new label to the disk. 786Use another 787.Nm Fl e 788command to edit the partitioning information. 789.Pp 790.Dl "disklabel64 -R da0s1 savedlabel" 791.Pp 792Restore the on-disk and in-core label for 793.Pa da0s1 794from information in 795.Pa savedlabel . 796.\" Existing bootstrap code is unaffected. 797.Pp 798.Dl "disklabel64 -R -n da0s1 label_layout" 799.Pp 800Display what the label would be for 801.Pa da0s1 802using the partition layout in 803.Pa label_layout . 804This is useful for determining how much space would be allotted for various 805partitions with a labelling scheme using 806.Cm % Ns -based 807or 808.Cm * 809partition sizes. 810.Pp 811.\" .Dl disklabel64 -B da0s1 812.\" .Pp 813.\" Install a new bootstrap on 814.\" .Pa da0s1 . 815.\" The boot code comes from 816.\" .Pa /boot/boot1 817.\" and possibly 818.\" .Pa /boot/boot2 . 819.\" On-disk and in-core labels are unchanged. 820.\" .Pp 821.\" .Dl disklabel64 -w -B /dev/da0s1 -b newboot1 -s newboot2 da2212 822.\" .Pp 823.\" Install a new label and bootstrap. 824.\" The label is derived from disktab information for 825.\" .Dq da2212 826.\" and installed both in-core and on-disk. 827.\" The bootstrap code comes from the files 828.\" .Pa /boot/newboot1 829.\" and 830.\" .Pa /boot/newboot2 . 831.\" .Pp 832.\" .Dl dd if=/dev/zero of=/dev/da0 bs=512 count=32 833.\" .Dl fdisk -BI da0 834.\" .Dl dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 835.\" .Dl disklabel64 -w -B da0s1 auto 836.\" .Dl disklabel64 -e da0s1 837.\" .Pp 838.\" Completely wipe any prior information on the disk, creating a new bootable 839.\" disk with a DOS partition table containing one 840.\" .Dq whole-disk 841.\" slice. 842.\" Then 843.\" initialize the slice, then edit it to your needs. 844.\" The 845.\" .Pa dd 846.\" commands are optional, but may be necessary for some BIOSes to properly 847.\" recognize the disk. 848.\" .Pp 849This is an example disklabel that uses some of the new partition size types 850such as 851.Cm % , M , G , 852and 853.Cm * , 854which could be used as a source file for 855.Pp 856.Dl disklabel64 -R ad0s1 new_label_file 857.Bd -literal -offset 4n 858# /dev/ad4s4: 859# 860# Informational fields calculated from the above 861# All byte equivalent offsets must be aligned 862# 863# boot space: 32768 bytes 864# data space: 121790552 blocks # 118936.09 MB (124713525248 bytes) 865# 866diskid: b1db58a3-4e26-11dd-8318-010e0cd0bad1 867label: 868boot2 data base: 0x000000001000 869partitions data base: 0x000000009000 870partitions data stop: 0x001d0981f000 871backup label: 0x001d0981f000 872total size: 0x001d09820000 # 118936.12 MB 873alignment: 4096 874display block size: 1024 # for partition display only 875 87616 partitions: 877# size offset fstype fsuuid 878 a: 512M 0 4.2BSD 879 b: 4G * swap 880 d: 2G * 4.2BSD 881 e: 2048M * 4.2BSD 882 f: 4G * 4.2BSD 883 g: 4G * 4.2BSD 884 h: * * HAMMER 885 i: 5g * ccd 886 j: 5120m * vinum 887.Ed 888.Sh DIAGNOSTICS 889The kernel device drivers will not allow the size of a disk partition 890to be decreased or the offset of a partition to be changed while it is open. 891Some device drivers create a label containing only a single large partition 892if a disk is unlabeled; thus, the label must be written to the 893.Dq a 894partition of the disk while it is open. 895This sometimes requires the desired 896label to be set in two steps, the first one creating at least one other 897partition, and the second setting the label on the new partition while 898shrinking the 899.Dq a 900partition. 901.\" .Pp 902.\" On some machines the bootstrap code may not fit entirely in the area 903.\" allocated for it by some file systems. 904.\" As a result, it may not be possible to have file systems on some partitions 905.\" of a 906.\" .Dq bootable 907.\" disk. 908.\" When installing bootstrap code, 909.\" .Nm 910.\" checks for these cases. 911.\" If the installed boot code would overlap a partition of type 912.\" .Dv FS_UNUSED 913.\" it is marked as type 914.\" .Dv FS_BOOT . 915.\" The 916.\" .Xr newfs 8 917.\" utility will disallow creation of file systems on 918.\" .Dv FS_BOOT 919.\" partitions. 920.\" Conversely, if a partition has a type other than 921.\" .Dv FS_UNUSED 922.\" or 923.\" .Dv FS_BOOT , 924.\" .Nm 925.\" will not install bootstrap code that overlaps it. 926.Sh SEE ALSO 927.Xr dd 1 , 928.Xr uuid 3 , 929.Xr ccd 4 , 930.Xr disklabel64 5 , 931.Xr disktab 5 , 932.Xr boot0cfg 8 , 933.Xr diskinfo 8 , 934.Xr disklabel 8 , 935.Xr fdisk 8 , 936.Xr gpt 8 , 937.Xr newfs 8 , 938.Xr newfs_hammer 8 , 939.Xr vinum 8 940.Sh BUGS 941Installing a 942.Xr disklabel 8 943label on a slice with a 944.Nm 945label installed requires reboot. First the existing label 946has to be overwritten, eg. by 947.Xr dd 1 , 948see above, then a reboot is required before the new label can be installed. 949.Pp 950.\" For the i386 architecture, the primary bootstrap sector contains 951.\" an embedded 952.\" .Em fdisk 953.\" table. 954.\" The 955.\" .Nm 956.\" utility takes care to not clobber it when installing a bootstrap only 957.\" .Pq Fl B , 958.\" or when editing an existing label 959.\" .Pq Fl e , 960.\" but it unconditionally writes the primary bootstrap program onto 961.\" the disk for 962.\" .Fl w 963.\" or 964.\" .Fl R , 965.\" thus replacing the 966.\" .Em fdisk 967.\" table by the dummy one in the bootstrap program. 968.\" This is only of 969.\" concern if the disk is fully dedicated, so that the 970.\" .Bx 971.\" disklabel 972.\" starts at absolute block 0 on the disk. 973.\" .Pp 974The 975.Nm 976utility 977does not perform all possible error checking. 978Warning 979.Em is 980given if partitions 981overlap; if an absolute offset does not match the expected offset; 982if a 983partition runs past the end of the device; and a number of other errors; but 984no warning is given if space remains unused. 985.Pp 986.Dx 987doesn't support booting from 988.Nm 989partitions. 990