1*854d339cSjan.\" $OpenBSD: disklabel.8,v 1.157 2024/03/22 21:49:52 jan Exp $ 2df930be7Sderaadt.\" $NetBSD: disklabel.8,v 1.9 1995/03/18 14:54:38 cgd Exp $ 3df930be7Sderaadt.\" 4df930be7Sderaadt.\" Copyright (c) 1987, 1988, 1991, 1993 5df930be7Sderaadt.\" The Regents of the University of California. All rights reserved. 6df930be7Sderaadt.\" 7df930be7Sderaadt.\" This code is derived from software contributed to Berkeley by 8df930be7Sderaadt.\" Symmetric Computer Systems. 9df930be7Sderaadt.\" 10df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without 11df930be7Sderaadt.\" modification, are permitted provided that the following conditions 12df930be7Sderaadt.\" are met: 13df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright 14df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer. 15df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 16df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer in the 17df930be7Sderaadt.\" documentation and/or other materials provided with the distribution. 181ef0d710Smillert.\" 3. Neither the name of the University nor the names of its contributors 19df930be7Sderaadt.\" may be used to endorse or promote products derived from this software 20df930be7Sderaadt.\" without specific prior written permission. 21df930be7Sderaadt.\" 22df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25df930be7Sderaadt.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32df930be7Sderaadt.\" SUCH DAMAGE. 33df930be7Sderaadt.\" 34df930be7Sderaadt.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 35df930be7Sderaadt.\" 36*854d339cSjan.Dd $Mdocdate: March 22 2024 $ 37df930be7Sderaadt.Dt DISKLABEL 8 38fc8533a3Saaron.Os 39df930be7Sderaadt.Sh NAME 40df930be7Sderaadt.Nm disklabel 41df930be7Sderaadt.Nd read and write disk pack label 42df930be7Sderaadt.Sh SYNOPSIS 437349792aSaaron.Nm disklabel 4426695851Skrw.Op Fl Acdtv 45352d199bSkrw.Op Fl h | p Ar unit 462c6e8a17Shenning.Op Fl T Ar file 47df930be7Sderaadt.Ar disk 487349792aSaaron.Nm disklabel 49df930be7Sderaadt.Fl w 5026695851Skrw.Op Fl Acdnv 51a2c1f847Shenning.Op Fl T Ar file 5248c01a1fSjmc.Ar disk disktype 53a7d4bc8dSjmc.Op Ar packid 547349792aSaaron.Nm disklabel 55df930be7Sderaadt.Fl e 5626695851Skrw.Op Fl Acdnv 57a2c1f847Shenning.Op Fl T Ar file 58df930be7Sderaadt.Ar disk 597349792aSaaron.Nm disklabel 60562be226Smillert.Fl E 6126695851Skrw.Op Fl Acdnv 62f8b10a94Shalex.Op Fl F Ns | Ns Fl f Ar file 632c6e8a17Shenning.Op Fl T Ar file 64562be226Smillert.Ar disk 657349792aSaaron.Nm disklabel 66df930be7Sderaadt.Fl R 673d193836Ssobrado.Op Fl nv 68038e2c8cSkrw.Op Fl F Ns | Ns Fl f Ar file 6948c01a1fSjmc.Ar disk protofile 70df930be7Sderaadt.Sh DESCRIPTION 71689e3035SaaronThe 7258aefd4bSaaron.Nm 73689e3035Saaronutility can be used to install, examine, or modify the label on a disk drive or 749615e1d4Saaronpack. 7552317843SjmcThe disk label contains information about disk characteristics 7652317843Sjmc.Pq size, type, etc. 7752317843Sjmcand the partition layout, stored on the disk itself. 789615e1d4SaaronIt is used by the operating system to optimize disk I/O and 79689e3035Saaronlocate the filesystems resident on the disk. 8096d3359eSangelos.Pp 81e10d8082Sjmc.Nm 82e10d8082Sjmcsupports 15 configurable partitions, 83e10d8082Sjmc.Sq a 84e10d8082Sjmcthrough 85e10d8082Sjmc.Sq p , 86e10d8082Sjmcexcluding 87e10d8082Sjmc.Sq c . 88e10d8082SjmcThe 89e10d8082Sjmc.Sq c 90e10d8082Sjmcpartition describes the entire physical disk, is automatically created 91e10d8082Sjmcby the kernel, and cannot be modified or deleted by 92e10d8082Sjmc.Nm . 93e10d8082SjmcBy convention, the 94e10d8082Sjmc.Sq a 95e10d8082Sjmcpartition of the boot disk is the root partition, and the 96e10d8082Sjmc.Sq b 97e10d8082Sjmcpartition of the boot disk is the swap partition, 98e10d8082Sjmcbut all other letters can be used in any order for any other 99e10d8082Sjmcpartitions as desired. 100e10d8082Sjmc.Pp 101689e3035SaaronThe options are as follows: 102f1ba3473Saaron.Bl -tag -width Ds 103557f712bSkrw.It Fl A 10434ae4198SkrwAutomatically allocate all the disk space in the 10534ae4198Skrw.Ox 10634ae4198Skrwportion of the disk in the recommended manner. 10708e2816dSjmcSee 10808e2816dSjmc.Sx AUTOMATIC DISK ALLOCATION , 10908e2816dSjmcbelow. 11052317843Sjmc.It Fl c 11152317843SjmcClear the system's in-core copy of the label and update it based on 11252317843Sjmcthe on-disk label. 11396d3359eSangelos.It Fl d 11496d3359eSangelosUse the 1155362a395Smillert.Em default 1169615e1d4Saaronlabel. 1179615e1d4SaaronThis ignores any existing 1185362a395Smillert.Ox 1193ce6036eSkrwdisk label on the disk. 12052317843Sjmc.It Fl E 121aa475002SkrwUse the built-in command-driven label editor described below. 12252317843Sjmc.It Fl e 12352317843SjmcEdit an existing disk label using the editor specified in the 12452317843Sjmc.Ev EDITOR 12552317843Sjmcenvironment variable, or 12652317843Sjmc.Xr vi 1 12752317843Sjmcif none is specified. 128f8b10a94Shalex.It Fl F Ar file 12996d3359eSangelosWrite entries to 130f8b10a94Shalex.Ar file 13196d3359eSangelosin 13296d3359eSangelos.Xr fstab 5 13306a29444Skrwformat for any partitions for which mount point information is known. 13408149649SjmcThe entries will be written using disklabel UIDs. 1359615e1d4SaaronThe 13687e66bbaSkrw.Fl F 13796d3359eSangelosflag is only valid when used in conjunction with the 13896d3359eSangelos.Fl E 139d6d80bb0Skrwor 140038e2c8cSkrw.Fl R 141d6d80bb0Skrwflags. 1429615e1d4SaaronIf 143f8b10a94Shalex.Ar file 14496d3359eSangelosalready exists, it will be overwritten. 145f8b10a94Shalex.It Fl f Ar file 146d6d80bb0SkrwThe same as 14787e66bbaSkrw.Fl F 14887e66bbaSkrwexcept that entries will be written using disk device names. 149352d199bSkrw.It Fl h 150352d199bSkrwPrint partition sizes in human readable format. 15152317843Sjmc.It Fl n 15252317843SjmcMake no permanent changes to the disklabel 15352317843Sjmc.Pq useful for debugging purposes . 15429c2f9a4Stedu.It Fl p Ar unit 155352d199bSkrwPrint partition sizes in 15629c2f9a4Stedu.Ar unit 15729c2f9a4Steduinstead of sectors. 1581af8dde3SottoValid units are b(ytes), c(ylinders), k(ilobytes), m(egabytes), g(igabytes) 1591af8dde3Sottoand t(erabytes). 16096d3359eSangelos.It Fl R 16196d3359eSangelosRestore a disk label that was formatted in a prior operation and 16267336cefSbluhmsaved in an ASCII file. 163a2c1f847Shenning.It Fl T Ar file 164a2c1f847ShenningRead the template for automatic allocation from 165a2c1f847Shenning.Ar file 166a2c1f847Shenninginstead of using the builtin one. 167a2c1f847ShenningSee 168a2c1f847Shenning.Sx AUTOMATIC DISK ALLOCATION 169a2c1f847Shenningbelow for the format. 170bc9d58e0SkrwIf 171bc9d58e0Skrw.Ar file 172bc9d58e0Skrwis a single dash 173bc9d58e0Skrw.Pq Sq - , 174bc9d58e0Skrwthe template is read from the standard input. 1752c6e8a17Shenning.It Fl t 1762c6e8a17ShenningFormat the label as a 1772c6e8a17Shenning.Xr disktab 5 1782c6e8a17Shenningentry. 17952317843Sjmc.It Fl v 18052317843SjmcPrint additional information during operation 18152317843Sjmc.Pq verbose mode . 18252317843Sjmc.It Fl w 18352317843SjmcWrite a standard label on the designated drive. 18452317843Sjmc.It Ar disk 18552317843SjmcSpecify the 18652317843Sjmc.Ar disk 18752317843Sjmcto operate on. 18831f2f9dfSjmcIt can be specified by its full pathname, by an abbreviated disk form, 18931f2f9dfSjmcor by its disklabel UID. 19052317843SjmcIn its abbreviated form, the path to the device, the 19152317843Sjmc.Sq r 192fa1df152Sottodenoting 19352317843Sjmc.Qq raw device , 19417245242Ssteveskand the partition letter, can all be omitted. 19552317843SjmcFor example, the first IDE disk can be specified as either 19652317843Sjmc.Pa /dev/rwd0c , 19752317843Sjmc.Pa /dev/wd0c , 19852317843Sjmcor 19952317843Sjmc.Ar wd0 . 20052317843Sjmc.It Ar disktype 20152317843SjmcSpecify a 20252317843Sjmc.Ar disktype 20352317843Sjmcentry from the 20452317843Sjmc.Xr disktab 5 20552317843Sjmcdatabase. 20652317843Sjmc.It Ar packid 20752317843SjmcSpecify a pack identification string for the device 20852317843Sjmc.Pq see below . 20952317843Sjmc.It Ar protofile 21052317843SjmcUsed with the restore option 21152317843Sjmc.Pq Fl R 21252317843Sjmcto specify a file to read an ASCII label from. 21396d3359eSangelos.El 2146c3deb5aSmillert.Pp 21552317843SjmcThe first form of the command 21652317843Sjmc.Pq read 21752317843Sjmcis used to examine the label on the named disk drive. 218df930be7SderaadtIt will display all of the parameters associated with the drive 219df930be7Sderaadtand its partition layout. 220a0cc7d63SkrwThe kernel's in-core copy of the label is displayed; if 22196d3359eSangelosthe disk has no label, or the partition types on the disk are 22296d3359eSangelosincorrect, the kernel may have constructed or modified the label. 223df930be7Sderaadt.Pp 22452317843SjmcThe second form of the command 22552317843Sjmc.Pq write 22652317843Sjmcis used to write a standard label on the designated drive. 2279615e1d4SaaronThe drive parameters and partitions are taken from that file. 2289615e1d4SaaronIf different disks of the same physical type are 22996d3359eSangelosto have different partitions, it will be necessary to have separate 23096d3359eSangelosdisktab entries describing each, or to edit the label after 2319615e1d4Saaroninstallation as described below. 2329615e1d4SaaronThe optional argument is a pack 2339615e1d4Saaronidentification string, up to 16 characters long. 2349615e1d4SaaronThe pack ID must be quoted if it contains blanks. 235a0cc7d63SkrwThe existing label will be updated via the in-core 2362237a279Skrwcopy. 237df930be7Sderaadt.Pp 23852317843SjmcIn the third form of the command 23952317843Sjmc.Pq edit , 240a0cc7d63Skrwthe label is read from the in-core kernel copy 241a0cc7d63Skrwand then supplied to an editor for changes. 2429615e1d4SaaronIf no editor is specified in an 243df930be7Sderaadt.Ev EDITOR 244df930be7Sderaadtenvironment variable, 245df930be7Sderaadt.Xr vi 1 2469615e1d4Saaronis used. 2479615e1d4SaaronWhen the editor terminates, the formatted label is reread and 2489615e1d4Saaronused to rewrite the disk label. 249df930be7Sderaadt.Pp 250aa475002SkrwThe built-in label editor 25152317843Sjmc.Pq fourth form 252aa475002Skrwprovides a simple interactive label editor. 253cbfc0aa2SkrwThe editor prompt contains information about the state of the edit 254cbfc0aa2Skrwprocess. 255cbfc0aa2Skrw.Pp 256cbfc0aa2Skrw.Dl Ar disk Ns *> 257cbfc0aa2Skrw.Pp 258cbfc0aa2SkrwWhere 259cbfc0aa2Skrw.Ar disk 260cbfc0aa2Skrwis the name of the disk being edited, 261cbfc0aa2Skrw.Sq * 262cbfc0aa2Skrwmeans that the in-memory copy of the partition table has been modified but 263953cd4efSkrwnot yet written to disk. 264cbfc0aa2Skrw.Pp 2659615e1d4SaaronSome commands or prompts take an optional unit. 26696d3359eSangelosAvailable units are 267de517754Saaron.Sq b 26895675cd5Saaronfor bytes, 269de517754Saaron.Sq c 27095675cd5Saaronfor cylinders, 271de517754Saaron.Sq k 27295675cd5Saaronfor kilobytes, 273de517754Saaron.Sq m 27495675cd5Saaronfor megabytes, 275de517754Saaron.Sq g 2764d812bb6Slumfor gigabytes, 2774d812bb6Slumand 2784d812bb6Slum.Sq t 2794d812bb6Slumfor terabytes. 2804d812bb6SlumIf no unit is given, the default is to use sectors 2814d812bb6Slum(usually 512 bytes). 282e2053b82Sjmc.Pp 283e2053b82SjmcQuantities are rounded to the nearest 28452317843Sjmccylinder when units are specified for sizes 28552317843Sjmc.Pq or offsets . 286e2053b82SjmcAt prompts that request a size, 287e2053b82Sjmc.Ql * 288e2053b82Sjmcmay be entered to indicate the rest of the available space, 289e2053b82Sjmc.Sq % 290e2053b82Sjmcfor percentage of total, and 291e2053b82Sjmc.Sq & 292e2053b82Sjmcfor percentage free. 2939615e1d4SaaronCommands may be aborted by entering 294de517754Saaron.Ql ^D 29552317843Sjmc.Pq Control-D . 296de517754SaaronEntering 297de517754Saaron.Ql ^D 2988e0d3e87Skrwat the main prompt will exit the editor. 299e2053b82Sjmc.Pp 300562be226SmillertThe editor commands are as follows: 301562be226Smillert.Bl -tag -width "p [unit] " 3029dbd6965Sbentley.It Cm \&? | h 3039615e1d4SaaronDisplay help message with all available commands. 30452317843SjmcThere is also 30552317843Sjmc.Pq simple 30652317843Sjmccontext-sensitive help available at most prompts. 307557f712bSkrw.It Cm A 308557f712bSkrwAllocate all the disk space in the recommended manner. 30908e2816dSjmcSee 31008e2816dSjmc.Sx AUTOMATIC DISK ALLOCATION , 31108e2816dSjmcbelow. 31252317843Sjmc.It Cm a Op Ar part 31352317843SjmcAdd new partition. 3144d812bb6SlumThis option adds a new partition to the disk label. 31552317843SjmcIf no partition letter is specified 31652317843Sjmc.Pq a\-p , 31752317843Sjmcthe user will be prompted for one. 31852317843Sjmc.It Cm b 3190cfa78c6SmpechSet 3200cfa78c6Smpech.Ox 3210cfa78c6Smpechdisk boundaries. 3229615e1d4SaaronThis option tells 32358aefd4bSaaron.Nm 3249615e1d4Saaronwhich parts of the disk it is allowed to modify. 32552317843SjmcThis option is probably only useful for ports with 32652317843Sjmc.Xr fdisk 8 32752317843Sjmcpartition tables where the ending sector in the MBR is incorrect. 3289615e1d4SaaronThe user may enter 329de517754Saaron.Ql * 33095675cd5Saaronat the 33195675cd5Saaron.Dq Size 33252317843Sjmcprompt to indicate the entire size of the disk 33352317843Sjmc.Pq minus the starting sector . 3347d1853eaSlumThis is useful for disks where the 33552317843Sjmcfdisk partition table is incapable of storing the real size. 3364d812bb6SlumNote: data may become corrupted if boundaries are extended such 3374d812bb6Slumthat they overlap with other resident operating systems. 33852317843Sjmc.It Cm c Op Ar part 3399615e1d4SaaronChange the size of an existing partition. 3409615e1d4SaaronIf no partition is specified, the user will be prompted for one. 3419615e1d4SaaronThe new size may be 3420e1e2cf6Sderaadtin terms of the aforementioned units and may also be prefixed with 343de517754Saaron.Ql + 34495675cd5Saaronor 345de517754Saaron.Ql - 34695675cd5Saaronto change the size by a relative amount. 34752317843Sjmc.It Cm D 34852317843SjmcSets the disk label to the default values as reported by the kernel. 34952317843SjmcThis simulates the case where there is no disk label. 35052317843Sjmc.It Cm d Op Ar part 351945ae268SmillertDelete an existing partition (or 352de517754Saaron.Ql * 3539615e1d4Saaronto delete all partitions). 3549615e1d4SaaronIf no partition is specified, the user will be prompted for one. 35552317843Sjmc.It Cm e 3561cc333d2SkrwEdit label description, e.g. 'UMIS RPJTJ256MED'. 3570d63cfbaSjsing.It Cm i 35831f2f9dfSjmcChange the disklabel UID, specified as a 16-character hexadecimal string. 3590d63cfbaSjsingIf set to all zeros, a new UID will automatically be allocated when the 3600d63cfbaSjsingdisklabel is written to disk. 361aff3f969Sotto.It Cm l Op Ar unit 362aff3f969SottoPrint the disk label header. 36352317843Sjmc.It Cm M 36452317843SjmcDisplay this manual page. 3654d812bb6SlumThe manual page is piped through the pager specified by the 3664d812bb6Slum.Ev PAGER 3674d812bb6Slumenvironment variable or 'less' if 3684d812bb6Slum.Ev PAGER 3694d812bb6Slumis not set. 37052317843Sjmc.It Cm m Op Ar part 3719615e1d4SaaronModify parameters for an existing partition. 3729615e1d4SaaronIf no partition is specified, the user will be prompted for one. 3739615e1d4SaaronThis option allows 37452317843Sjmcthe user to change the filesystem type, starting offset, partition size, 37552317843Sjmcand mount point for the specified partition. 37652317843Sjmc.It Cm n Op Ar part 3779615e1d4SaaronName the mount point for an existing partition. 3789615e1d4SaaronIf no partition is specified, the user will be prompted for one. 3799615e1d4SaaronThis option is only valid if 380bd6726faSmillert.Nm 381bd6726faSmillertwas invoked with the 382d09f3941Smillert.Fl f 383bd6726faSmillertflag. 38452317843Sjmc.It Cm p Op Ar unit 385aff3f969SottoPrint the current partition list. 38652317843SjmcIf a 38752317843Sjmc.Em unit 38852317843Sjmcis given, the size and offsets are displayed in terms of the 38952317843Sjmcspecified unit. 390352d199bSkrwIf the unit is 39141ce3b17Snaddy.Sq * , 392352d199bSkrwit is automatically determined by the size of the smallest 393352d199bSkrwpartition. 39452317843Sjmc.It Cm q 3959615e1d4SaaronQuit the editor. 3969615e1d4SaaronIf any changes have been made, the user will be 397562be226Smillertasked whether or not to save the changes to the on-disk label. 3986aaa4aabSotto.It Cm R Op Ar part 399be4f92dfSjmcResize a partition in an automatically allocated label, 4006aaa4aabSottocompacting unused space between partitions with a higher offset. 4010ef5162eSjmcThe last partition will be shrunk if necessary. 402be4f92dfSjmcWorks only for automatically allocated labels with no spoofed partitions. 40352317843Sjmc.It Cm r 40452317843SjmcRecalculate free space. 40525f9c360SkrwThis command displays all the free areas on the disk and the total 40625f9c360Skrwnumber of free sectors. 40752317843Sjmc.It Cm s Op Ar path 40867336cefSbluhmSave the label to a file in ASCII format (suitable for loading via the 40952317843Sjmc.Fl R 41052317843Sjmcoption). 41152317843SjmcIf no path is specified, the user will be prompted for one. 412eca3b0cdSkrw.It Cm U 413eca3b0cdSkrwUndo all changes made since entering the editor. 41452317843Sjmc.It Cm u 41552317843SjmcUndo 41652317843Sjmc.Pq or redo 41752317843Sjmclast change. 41852317843SjmcEntering 41952317843Sjmc.Em u 42052317843Sjmconce will undo the last change. 42152317843SjmcEntering it again will restore the change. 42252317843Sjmc.It Cm w 42352317843SjmcWrite the label to disk. 42452317843SjmcThis option will commit any changes to the on-disk label. 42552317843Sjmc.It Cm x 4264d812bb6SlumExit the editor without saving any changes to the on-disk label. 42752317843Sjmc.It Cm z 4284d812bb6SlumZero out the existing partition table and mount point information, 4294d812bb6Slumleaving only the 'c' partition. 430ac1aa35bSmpechThe drive parameters are not changed. 431562be226Smillert.El 432562be226Smillert.Pp 43352317843SjmcIn the restore form of the command 43452317843Sjmc.Pq fifth form , 43552317843Sjmcthe prototype file used to create the label should be in the same format 43652317843Sjmcas that produced when reading or editing a label. 4379615e1d4SaaronComments are delimited by 43852317843Sjmc.Ar # 4399615e1d4Saaronand newline. 440bd6726faSmillert.Pp 441720a7a94SjmcNote that when a disk has no real 442720a7a94Sjmc.Bx 443720a7a94Sjmcdisklabel, the kernel creates a 4449477802aSmillertdefault label so that the disk can be used. 4459477802aSmillertThis default label will include other partitions found on the disk if 44696108973Sjmcthey are supported on your architecture. 4479477802aSmillertFor example, on systems that support 4489477802aSmillert.Xr fdisk 8 4499477802aSmillertpartitions the default label will also include DOS and Linux partitions. 4509477802aSmillertHowever, these entries are not dynamic, they are fixed at the time 4519477802aSmillert.Nm 4529477802aSmillertis run. 453720a7a94SjmcThat means that subsequent changes that affect 454720a7a94Sjmc.Pf non- Ox 45552317843Sjmcpartitions will not be present in the default label, 45652317843Sjmcthough they may be updated by hand. 4579477802aSmillertTo see the default label, run 4589477802aSmillert.Nm 4599477802aSmillertwith the 4609477802aSmillert.Fl d 4619477802aSmillertflag. 4629477802aSmillert.Nm 46352317843Sjmccan then be run with the 4649477802aSmillert.Fl e 46552317843Sjmcflag and any entries pasted as desired from the default label into the real one. 46608e2816dSjmc.Sh AUTOMATIC DISK ALLOCATION 46708e2816dSjmcThe 46808e2816dSjmc.Fl A 46908e2816dSjmcoption and the editor command 47008e2816dSjmc.Cm A 471c3eba65cSkrwcreate disklabels that distribute a disk's free space into a set of 472c3eba65cSkrwpartitions appropriate for an 47308e2816dSjmc.Ox 474c3eba65cSkrwinstallation. 475c3eba65cSkrwThe exact set of partitions created depends on available free space, 476c3eba65cSkrwhow fragmented the free space is 477c3eba65cSkrwand some machine dependent variables, but will be approximately: 478c3eba65cSkrw.Bl -column "/usr/X11R6" \ 479c3eba65cSkrw"999MB \(en 999MB" "999MB \(en 999MB" "999MB \(en 999MB" \ 480c3eba65cSkrw"< 700MB" 481c3eba65cSkrw.It \ 482c3eba65cSkrwTa Sy > 10GB Free Ta Sy > 2.5GB Ta Sy > 700MB Ta \ 483c3eba65cSkrwSy < 700MB 484c3eba65cSkrw.It Sy / \ 485c3eba65cSkrwTa 150MB \(en \0\01GB Ta 800MB \(en \0\02GB Ta 700MB \(en \0\04GB Ta \ 486c3eba65cSkrw1MB \(en 2GB 487c3eba65cSkrw.It Sy swap \ 488c3eba65cSkrwTa \080MB \(en 256MB Ta \080MB \(en 256MB Ta \0\01MB \(en 256MB Ta 489c3eba65cSkrw.It Sy /usr \ 490c3eba65cSkrwTa 1.5GB \(en \030GB Ta 1.5GB \(en \030GB Ta Ta 491c3eba65cSkrw.It Sy /home \ 492c3eba65cSkrwTa \0\01GB \(en 300GB Ta 256MB \(en \0\02GB Ta Ta 493c3eba65cSkrw.It Sy /tmp \ 494c3eba65cSkrwTa 120MB \(en \0\04GB Ta Ta Ta 495c3eba65cSkrw.It Sy /var \ 496c3eba65cSkrwTa \080MB \(en \0\04GB Ta Ta Ta 497c3eba65cSkrw.It Sy /usr/X11R6 \ 498c3eba65cSkrwTa 384MB \(en \0\01GB Ta Ta Ta 499c3eba65cSkrw.It Sy /usr/local \ 500c3eba65cSkrwTa \0\01GB \(en \020GB Ta Ta Ta 501c3eba65cSkrw.It Sy /usr/src \ 502*854d339cSjanTa \0\02GB \(en \0\05GB Ta Ta Ta 503c3eba65cSkrw.It Sy /usr/obj \ 504c3eba65cSkrwTa \0\05GB \(en \0\06GB Ta Ta Ta 505c3eba65cSkrw.El 50608e2816dSjmc.Pp 507c3eba65cSkrwThe 508c3eba65cSkrw.Fl A 509c3eba65cSkrwoption displays the partition set that would be created and 510c3eba65cSkrw.Fl wA 511c3eba65cSkrwwrites it to disk. 51208e2816dSjmc.Pp 5135057ec59SkrwThe default set can be overridden with 514c3eba65cSkrw.Fl T . 5155057ec59SkrwEach line of input uses three fields to describe a partition. 516c3eba65cSkrwThere must not be whitespace before the first field, 517c3eba65cSkrwfields are separated by whitespace and fields cannot contain whitespace. 51808e2816dSjmc.Pp 519c3eba65cSkrwThe first field is the partition's mount point or one of the 520c3eba65cSkrwspecial tokens 521c3eba65cSkrw.Sq RAID 522c3eba65cSkrwor 523c3eba65cSkrw.Sq SWAP . 52408e2816dSjmc.Pp 5255057ec59SkrwThe second field is the partition size. 5265057ec59SkrwThis can be 527c3eba65cSkrw.Sq * 528c3eba65cSkrwto make the partition as large as possible, 5295057ec59Skrwan exact size (e.g. 1G) or a size range 5305057ec59Skrw(e.g. 1M-10G or 1G-*). 53142d17403Skn.Pp 5325057ec59SkrwThe third field is the partition's share of any space left after all 5335057ec59Skrwminimum sizes are accounted for. 5345057ec59SkrwThis is expressed as a percentage from 0 (the default) to 100 5355057ec59Skrw(e.g. 37%). 5365057ec59SkrwThe last partition receives all remaining free space up to its 5375057ec59Skrwmaximum size no matter what percentage is specified. 5382b65e200Sjmc.Sh FILES 5397cc6a663Sjmc.Bl -tag -width "/etc/disktabXXX" 5402b65e200Sjmc.It Pa /etc/disktab 54152317843SjmcDisk description file. 5422b65e200Sjmc.El 543df930be7Sderaadt.Sh EXAMPLES 544c3eba65cSkrwDisplay, respectively, the current label, the default label and the 545c3eba65cSkrwdefault auto allocation for sd0: 546c3eba65cSkrw.Bd -literal -offset indent 547c3eba65cSkrw# disklabel sd0 548c3eba65cSkrw# disklabel -d sd0 549c3eba65cSkrw# disklabel -A sd0 550c3eba65cSkrw.Ed 551df930be7Sderaadt.Pp 552c3eba65cSkrwWrite the default auto allocation to sd0: 553df930be7Sderaadt.Pp 554c3eba65cSkrw.Dl # disklabel -wA sd0 555df930be7Sderaadt.Pp 556c3eba65cSkrwEdit the label for the disk with DUID 3eb7f9da875cb9ee: 557df930be7Sderaadt.Pp 558f23e08f8Sjmc.Dl # disklabel -E 3eb7f9da875cb9ee 559df930be7Sderaadt.Pp 560c3eba65cSkrwRestore the label for sd0 from information in 561a1852aedSjmc.Pa mylabel : 562df930be7Sderaadt.Pp 56352317843Sjmc.Dl # disklabel -R sd0 mylabel 564c3eba65cSkrw.Pp 565c3eba65cSkrwPut largest contiguous area of free space on sd0 into a single RAID partition: 566c3eba65cSkrw.Dl # echo 'RAID *' | disklabel -wAT- sd0 567c3eba65cSkrw.Pp 568c3eba65cSkrwWrite the auto allocation defined in 569c3eba65cSkrw.Pa /template 570c3eba65cSkrwto sd0: 571c3eba65cSkrw.Pp 572c3eba65cSkrw.Dl # disklabel -wAT/template sd0 573c3eba65cSkrw.Pp 574c3eba65cSkrwA template file that results in an auto allocation similar to the 575c3eba65cSkrwdefault one for a disk with 5GB of free space is: 576c3eba65cSkrw.Bl -column /home 1300MM256M 75% -offset indent 577c3eba65cSkrw.It / Ta \0800M\(en2G Ta \05% 578c3eba65cSkrw.It swap Ta \0\080M\(en256M Ta 10% 579c3eba65cSkrw.It /usr Ta 1300M\(en\)3G Ta 75% 580c3eba65cSkrw.It /home Ta \0256M\(en2G Ta 10% 581c3eba65cSkrw.El 582df930be7Sderaadt.Sh DIAGNOSTICS 583df930be7SderaadtThe kernel device drivers will not allow the size of a disk partition 584562be226Smillertto be decreased or the offset of a partition to be changed while 5859615e1d4Saaronit is open. 5869615e1d4SaaronSome device drivers create a label containing only a 587562be226Smillertsingle large partition if a disk is unlabeled; thus, the label must 58895675cd5Saaronbe written to the 589de517754Saaron.Sq a 59095675cd5Saaronpartition of the disk while it is open. 591df930be7SderaadtThis sometimes requires the desired label to be set in two steps, 592562be226Smillertthe first one creating at least one other partition, and the second 59395675cd5Saaronsetting the label on the new partition while shrinking the 594de517754Saaron.Sq a 595562be226Smillertpartition. 5962b65e200Sjmc.Sh SEE ALSO 59742d17403Skn.Xr softraid 4 , 5982b65e200Sjmc.Xr disklabel 5 , 5992b65e200Sjmc.Xr disktab 5 , 6002237a279Skrw.Xr installboot 8 , 6012b65e200Sjmc.Xr scan_ffs 8 602d321a433Sjsg.Sh HISTORY 603d321a433SjsgThe 604d321a433Sjsg.Nm 605d321a433Sjsgutility appeared in 606d321a433Sjsg.Bx 4.3 Tahoe . 60752317843Sjmc.Sh CAVEATS 6081af8dde3SottoThe maximum disk and partition size is 64PB. 609764e4f67Skrw.Pp 6109f9f2974SjmcOn some machines, such as Sparc64, partition tables 611518852d0Skrwmay not exhibit the full functionality described above. 612