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. 15fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 168fae3551SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 178fae3551SRodney W. Grimes.\" without specific prior written permission. 188fae3551SRodney W. Grimes.\" 198fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 208fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 218fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 228fae3551SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 238fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 248fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 258fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 268fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 278fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 288fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 298fae3551SRodney W. Grimes.\" SUCH DAMAGE. 308fae3551SRodney W. Grimes.\" 31*63d7fcf2SJohn Baldwin.Dd January 23, 2025 322c60b668SPoul-Henning Kamp.Dt BSDLABEL 8 339fe48c6eSRuslan Ermilov.Os 348fae3551SRodney W. Grimes.Sh NAME 352c60b668SPoul-Henning Kamp.Nm bsdlabel 366b0db4abSRuslan Ermilov.Nd read and write BSD label 378fae3551SRodney W. Grimes.Sh SYNOPSIS 387c7fb079SRuslan Ermilov.Nm 3957dfbec5SPoul-Henning Kamp.Op Fl A 40d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file 417c7fb079SRuslan Ermilov.Nm 428fae3551SRodney W. Grimes.Fl w 43734ac3b5SRuslan Ermilov.Op Fl \&An 4457dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot 45bc33ea1aSRuslan Ermilov.Op Fl m Ar machine 46d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file 4757dfbec5SPoul-Henning Kamp.Op Ar type 487c7fb079SRuslan Ermilov.Nm 498fae3551SRodney W. Grimes.Fl e 50734ac3b5SRuslan Ermilov.Op Fl \&An 5157dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot 52bc33ea1aSRuslan Ermilov.Op Fl m Ar machine 53d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file 547c7fb079SRuslan Ermilov.Nm 558fae3551SRodney W. Grimes.Fl R 56734ac3b5SRuslan Ermilov.Op Fl \&An 5757dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot 58bc33ea1aSRuslan Ermilov.Op Fl m Ar machine 597747c959SLuigi Rizzo.Op Fl f 60d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file 61d04b5dfeSRuslan Ermilov.Ar protofile 62b6f3ccedSEd Maste.Sh DEPRECATION NOTICE 63b6f3ccedSEd Maste.Nm 64b6f3ccedSEd Masteis deprecated and is not available in 65b6f3ccedSEd Maste.Fx 15.0 66b6f3ccedSEd Masteor later. 67b6f3ccedSEd MasteUse 68b6f3ccedSEd Maste.Xr gpart 8 69b6f3ccedSEd Masteinstead 70b6f3ccedSEd Maste.Po 71b6f3ccedSEd Mastewith the 72b6f3ccedSEd Maste.Cm BSD 73b6f3ccedSEd Mastepartitioning scheme 74b6f3ccedSEd Maste.Pc , 75b6f3ccedSEd Masteor install the 76b6f3ccedSEd Maste.Pa freebsd-bsdlabel 77b6f3ccedSEd Masteport or package. 788fae3551SRodney W. Grimes.Sh DESCRIPTION 79e1205e80SPhilippe CharnierThe 80e1205e80SPhilippe Charnier.Nm 81e1205e80SPhilippe Charnierutility 82734ac3b5SRuslan Ermilovinstalls, examines or modifies the 83734ac3b5SRuslan Ermilov.Bx 847747c959SLuigi Rizzolabel on a disk partition, or on a file containing a partition image. 859a9f19b1SRuslan ErmilovIn addition, 866bd343a9SPhilippe Charnier.Nm 874cbdc634SGreg Leheycan install bootstrap code. 889a9f19b1SRuslan Ermilov.Ss Disk Device Name 89d04b5dfeSRuslan ErmilovWhen specifying the device (i.e., when the 907747c959SLuigi Rizzo.Fl f 917747c959SLuigi Rizzooption is not used), 929a9f19b1SRuslan Ermilovthe 93ff7d5162SJordan K. Hubbard.Pa /dev/ 949a9f19b1SRuslan Ermilovpath prefix may be omitted; 959a9f19b1SRuslan Ermilovthe 964cbdc634SGreg Lehey.Nm 97e1205e80SPhilippe Charnierutility will automatically prepend it. 98734ac3b5SRuslan Ermilov.Ss General Options 9957dfbec5SPoul-Henning KampThe 10057dfbec5SPoul-Henning Kamp.Fl A 101734ac3b5SRuslan Ermilovoption enables processing of the historical parts of the 102734ac3b5SRuslan Ermilov.Bx 103734ac3b5SRuslan Ermilovlabel. 10457dfbec5SPoul-Henning KampIf the option is not given, suitable values are set for these fields. 10557dfbec5SPoul-Henning Kamp.Pp 10657dfbec5SPoul-Henning KampThe 1077747c959SLuigi Rizzo.Fl f 1087747c959SLuigi Rizzooption tells 1097747c959SLuigi Rizzo.Nm 1107747c959SLuigi Rizzothat the program will operate on a file instead of a disk partition. 1117747c959SLuigi Rizzo.Pp 1127747c959SLuigi RizzoThe 11357dfbec5SPoul-Henning Kamp.Fl n 1147747c959SLuigi Rizzooption stops the 11557dfbec5SPoul-Henning Kamp.Nm 11657dfbec5SPoul-Henning Kampprogram right before the disk would have been modified, and displays 11757dfbec5SPoul-Henning Kampthe result instead of writing it. 11857dfbec5SPoul-Henning Kamp.Pp 11957dfbec5SPoul-Henning KampThe 12057dfbec5SPoul-Henning Kamp.Fl m Ar machine 1211c47852fSCraig Rodriguesargument forces 12257dfbec5SPoul-Henning Kamp.Nm 1231c47852fSCraig Rodriguesto use a layout suitable for a different architecture. 1241c47852fSCraig RodriguesCurrent valid values are 1252b375b4eSYoshihiro Takahashi.Cm i386 1261c47852fSCraig Rodriguesand 1272b375b4eSYoshihiro Takahashi.Cm amd64 . 1281c47852fSCraig RodriguesIf this option is omitted, 1291c47852fSCraig Rodrigues.Nm 1301c47852fSCraig Rodrigueswill use a layout suitable for the current machine. 1319a9f19b1SRuslan Ermilov.Ss Reading the Disk Label 132f9530cf0SRuslan ErmilovTo examine the label on a disk drive, use the form 1334cbdc634SGreg Lehey.Pp 1347c7fb079SRuslan Ermilov.Nm 13557dfbec5SPoul-Henning Kamp.Op Fl A 13657dfbec5SPoul-Henning Kamp.Op Fl m Ar machine 1374cbdc634SGreg Lehey.Ar disk 1384cbdc634SGreg Lehey.Pp 1394cbdc634SGreg Lehey.Ar disk 14057dfbec5SPoul-Henning Kamprepresents the disk in question, and may be in the form 1414cbdc634SGreg Lehey.Pa da0 1424cbdc634SGreg Leheyor 14357dfbec5SPoul-Henning Kamp.Pa /dev/da0 . 14457dfbec5SPoul-Henning KampIt will display the partition layout. 1459a9f19b1SRuslan Ermilov.Ss Writing a Standard Label 1464cbdc634SGreg LeheyTo write a standard label, use the form 1474cbdc634SGreg Lehey.Pp 1487c7fb079SRuslan Ermilov.Nm 1498fae3551SRodney W. Grimes.Fl w 150734ac3b5SRuslan Ermilov.Op Fl \&An 151bc33ea1aSRuslan Ermilov.Op Fl m Ar machine 152425bed3aSJoerg Wunsch.Ar disk 15357dfbec5SPoul-Henning Kamp.Op Ar type 154ff7d5162SJordan K. Hubbard.Pp 155f9530cf0SRuslan ErmilovIf the drive 156f9530cf0SRuslan Ermilov.Ar type 157f9530cf0SRuslan Ermilovis specified, the entry of that name in the 15857dfbec5SPoul-Henning Kamp.Xr disktab 5 159eff1c096SRemko Lodderfile is used; otherwise, or if the type is specified as 'auto', a default 160eff1c096SRemko Lodderlayout is used. 1619a9f19b1SRuslan Ermilov.Ss Editing an Existing Disk Label 1624cbdc634SGreg LeheyTo edit an existing disk label, use the form 1634cbdc634SGreg Lehey.Pp 1647c7fb079SRuslan Ermilov.Nm 1658fae3551SRodney W. Grimes.Fl e 166734ac3b5SRuslan Ermilov.Op Fl \&An 167bc33ea1aSRuslan Ermilov.Op Fl m Ar machine 1684cbdc634SGreg Lehey.Ar disk 1694cbdc634SGreg Lehey.Pp 170734ac3b5SRuslan ErmilovThis command opens the disk label in the default editor, and when the editor 171734ac3b5SRuslan Ermilovexits, the label is validated and if OK written to disk. 1729a9f19b1SRuslan Ermilov.Ss Restoring a Disk Label From a File 1734cbdc634SGreg LeheyTo restore a disk label from a file, use the form 1744cbdc634SGreg Lehey.Pp 1757c7fb079SRuslan Ermilov.Nm 1768fae3551SRodney W. Grimes.Fl R 177734ac3b5SRuslan Ermilov.Op Fl \&An 178bc33ea1aSRuslan Ermilov.Op Fl m Ar machine 1799a9f19b1SRuslan Ermilov.Ar disk protofile 1808fae3551SRodney W. Grimes.Pp 181f9530cf0SRuslan ErmilovThe 1826bd343a9SPhilippe Charnier.Nm 183f9530cf0SRuslan Ermilovutility 1849a9f19b1SRuslan Ermilovis capable of restoring a disk label that was previously saved in a file in 1859a9f19b1SRuslan Ermilov.Tn ASCII 1869a9f19b1SRuslan Ermilovformat. 1874cbdc634SGreg LeheyThe prototype file used to create the label should be in the same format as that 1889a9f19b1SRuslan Ermilovproduced when reading or editing a label. 1899a9f19b1SRuslan ErmilovComments are delimited by 1909a9f19b1SRuslan Ermilov.Ql # 1919a9f19b1SRuslan Ermilovand newline. 1929a9f19b1SRuslan Ermilov.Ss Installing Bootstraps 19357dfbec5SPoul-Henning KampIf the 1948fae3551SRodney W. Grimes.Fl B 195f9530cf0SRuslan Ermilovoption is specified, bootstrap code will be read from the file 196ef9ab0b3SRuslan Ermilov.Pa /boot/boot 19757dfbec5SPoul-Henning Kampand written to the disk. 19857dfbec5SPoul-Henning KampThe 19957dfbec5SPoul-Henning Kamp.Fl b Ar boot 200f9530cf0SRuslan Ermilovoption allows a different file to be used. 2018fae3551SRodney W. Grimes.Sh FILES 202ef9ab0b3SRuslan Ermilov.Bl -tag -width ".Pa /etc/disktab" -compact 203ef9ab0b3SRuslan Ermilov.It Pa /boot/boot 204ef9ab0b3SRuslan ErmilovDefault boot image. 2058fae3551SRodney W. Grimes.It Pa /etc/disktab 206ef9ab0b3SRuslan ErmilovDisk description file. 2078fae3551SRodney W. Grimes.El 2084cbdc634SGreg Lehey.Sh SAVED FILE FORMAT 209e1205e80SPhilippe CharnierThe 2104cbdc634SGreg Lehey.Nm 211e1205e80SPhilippe Charnierutility 2129a9f19b1SRuslan Ermilovuses an 2139a9f19b1SRuslan Ermilov.Tn ASCII 2149a9f19b1SRuslan Ermilovversion of the label when examining, editing, or restoring a disk 2159a9f19b1SRuslan Ermilovlabel. 2169a9f19b1SRuslan ErmilovThe format is: 2174cbdc634SGreg Lehey.Bd -literal -offset 4n 21857dfbec5SPoul-Henning Kamp 21957dfbec5SPoul-Henning Kamp8 partitions: 22057dfbec5SPoul-Henning Kamp# size offset fstype [fsize bsize bps/cpg] 221476bfbd7SRuslan Ermilov a: 81920 16 4.2BSD 2048 16384 5128 222476bfbd7SRuslan Ermilov b: 1091994 81936 swap 22357dfbec5SPoul-Henning Kamp c: 1173930 0 unused 0 0 # "raw" part, don't edit 22457dfbec5SPoul-Henning Kamp.Ed 22557dfbec5SPoul-Henning Kamp.Pp 22657dfbec5SPoul-Henning KampIf the 22757dfbec5SPoul-Henning Kamp.Fl A 22857dfbec5SPoul-Henning Kampoption is specified, the format is: 22957dfbec5SPoul-Henning Kamp.Bd -literal -offset 4n 23007b0cf9aSDavid E. O'Brien# /dev/da1c: 2314cbdc634SGreg Leheytype: SCSI 23207b0cf9aSDavid E. O'Briendisk: da0s1 2334cbdc634SGreg Leheylabel: 2344cbdc634SGreg Leheyflags: 2354cbdc634SGreg Leheybytes/sector: 512 2364cbdc634SGreg Leheysectors/track: 51 2374cbdc634SGreg Leheytracks/cylinder: 19 2384cbdc634SGreg Leheysectors/cylinder: 969 2394cbdc634SGreg Leheycylinders: 1211 2404cbdc634SGreg Leheysectors/unit: 1173930 2414cbdc634SGreg Leheyrpm: 3600 2424cbdc634SGreg Leheyinterleave: 1 2434cbdc634SGreg Leheytrackskew: 0 2444cbdc634SGreg Leheycylinderskew: 0 2454cbdc634SGreg Leheyheadswitch: 0 # milliseconds 2464cbdc634SGreg Leheytrack-to-track seek: 0 # milliseconds 2474cbdc634SGreg Leheydrivedata: 0 2484cbdc634SGreg Lehey 2494cbdc634SGreg Lehey8 partitions: 2504cbdc634SGreg Lehey# size offset fstype [fsize bsize bps/cpg] 251bd92a261SPawel Jakub Dawidek a: 81920 16 4.2BSD 1024 8192 16 252bd92a261SPawel Jakub Dawidek b: 160000 81936 swap 25357dfbec5SPoul-Henning Kamp c: 1173930 0 unused 0 0 # "raw" part, don't edit 2544cbdc634SGreg Lehey.Ed 2554cbdc634SGreg Lehey.Pp 2569a9f19b1SRuslan ErmilovLines starting with a 2579a9f19b1SRuslan Ermilov.Ql # 2589a9f19b1SRuslan Ermilovmark are comments. 2594cbdc634SGreg Lehey.Pp 2609a9f19b1SRuslan ErmilovThe partition table can have up to 8 entries. 2619a9f19b1SRuslan ErmilovIt contains the following information: 2629a9f19b1SRuslan Ermilov.Bl -tag -width indent 2639a9f19b1SRuslan Ermilov.It Ar # 2644cbdc634SGreg LeheyThe partition identifier is a single letter in the range 2659a9f19b1SRuslan Ermilov.Ql a 2664cbdc634SGreg Leheyto 2679a9f19b1SRuslan Ermilov.Ql h . 2684cbdc634SGreg LeheyBy convention, partition 2699a9f19b1SRuslan Ermilov.Ql c 2704cbdc634SGreg Leheyis reserved to describe the entire disk. 2719a9f19b1SRuslan Ermilov.It Ar size 2729a9f19b1SRuslan ErmilovThe size of the partition in sectors, 2737733674eSRuslan Ermilov.Cm K 2743233afaeSJohn W. De Boskey(kilobytes - 1024), 2757733674eSRuslan Ermilov.Cm M 2763233afaeSJohn W. De Boskey(megabytes - 1024*1024), 2777733674eSRuslan Ermilov.Cm G 2783233afaeSJohn W. De Boskey(gigabytes - 1024*1024*1024), 2797733674eSRuslan Ermilov.Cm % 2809a9f19b1SRuslan Ermilov(percentage of free space 2819a9f19b1SRuslan Ermilov.Em after 2829a9f19b1SRuslan Ermilovremoving any fixed-size partitions other than partition 2839a9f19b1SRuslan Ermilov.Ql c ) , 2847733674eSRuslan Ermilovor 2857733674eSRuslan Ermilov.Cm * 2869a9f19b1SRuslan Ermilov(all remaining free space 2879a9f19b1SRuslan Ermilov.Em after 2889a9f19b1SRuslan Ermilovfixed-size and percentage partitions). 2899a9f19b1SRuslan ErmilovFor partition 2909a9f19b1SRuslan Ermilov.Ql c , 2917733674eSRuslan Ermilova size of 2927733674eSRuslan Ermilov.Cm * 2939a9f19b1SRuslan Ermilovindicates the entire disk. 294f9530cf0SRuslan ErmilovLowercase versions of suffixes 2957733674eSRuslan Ermilov.Cm K , M , 2967733674eSRuslan Ermilovand 2977733674eSRuslan Ermilov.Cm G 2983233afaeSJohn W. De Boskeyare allowed. 299f9530cf0SRuslan ErmilovSize and suffix should be specified without any spaces between them. 3003233afaeSJohn W. De Boskey.Pp 3019a9f19b1SRuslan ErmilovExample: 2097152, 1G, 1024M and 1048576K are all the same size 3023233afaeSJohn W. De Boskey(assuming 512-byte sectors). 3039a9f19b1SRuslan Ermilov.It Ar offset 3049a9f19b1SRuslan ErmilovThe offset of the start of the partition from the beginning of the 3057733674eSRuslan Ermilovdrive in sectors, or 3067733674eSRuslan Ermilov.Cm * 3077733674eSRuslan Ermilovto have 3083233afaeSJohn W. De Boskey.Nm 3093233afaeSJohn W. De Boskeycalculate the correct offset to use (the end of the previous partition plus 3103233afaeSJohn W. De Boskeyone, ignoring partition 311f9530cf0SRuslan Ermilov.Ql c ) . 3123233afaeSJohn W. De BoskeyFor partition 3139a9f19b1SRuslan Ermilov.Ql c , 3147733674eSRuslan Ermilov.Cm * 3157733674eSRuslan Ermilovwill be interpreted as an offset of 0. 316689686bfSPawel Jakub DawidekThe first partition should start at offset 16, because the first 16 sectors are 317689686bfSPawel Jakub Dawidekreserved for metadata. 3189a9f19b1SRuslan Ermilov.It Ar fstype 3199a9f19b1SRuslan ErmilovDescribes the purpose of the partition. 320f9530cf0SRuslan ErmilovThe above example shows all currently used partition types. 3219a9f19b1SRuslan ErmilovFor 3229a9f19b1SRuslan Ermilov.Tn UFS 3239a9f19b1SRuslan Ermilovfile systems and 3249a9f19b1SRuslan Ermilov.Xr ccd 4 3259a9f19b1SRuslan Ermilovpartitions, use type 3267733674eSRuslan Ermilov.Cm 4.2BSD . 3273233afaeSJohn W. De BoskeyOther common types are 3289a9f19b1SRuslan Ermilov.Cm swap 3293233afaeSJohn W. De Boskeyand 3309a9f19b1SRuslan Ermilov.Cm unused . 3312f1aba69SRuslan ErmilovBy convention, partition 3329a9f19b1SRuslan Ermilov.Ql c 3332f1aba69SRuslan Ermilovrepresents the entire slice and should be of type 33470e48365SGreg Lehey.Cm unused , 33570e48365SGreg Leheythough 33670e48365SGreg Lehey.Nm 33770e48365SGreg Leheydoes not enforce this convention. 338e1205e80SPhilippe CharnierThe 33970e48365SGreg Lehey.Nm 340e1205e80SPhilippe Charnierutility 3419a9f19b1SRuslan Ermilovalso knows about a number of other partition types, 3429a9f19b1SRuslan Ermilovnone of which are in current use. 3439a9f19b1SRuslan Ermilov(See the definitions starting with 3442f1aba69SRuslan Ermilov.Dv FS_UNUSED 3452f1aba69SRuslan Ermilovin 346fe08efe6SRuslan Ermilov.In sys/disklabel.h 3479a9f19b1SRuslan Ermilovfor more details.) 3489a9f19b1SRuslan Ermilov.It Ar fsize 3493233afaeSJohn W. De BoskeyFor 3507733674eSRuslan Ermilov.Cm 4.2BSD 351476bfbd7SRuslan Ermilovfile systems only, the fragment size; see 352476bfbd7SRuslan Ermilov.Xr newfs 8 . 3539a9f19b1SRuslan Ermilov.It Ar bsize 3543233afaeSJohn W. De BoskeyFor 3557733674eSRuslan Ermilov.Cm 4.2BSD 356476bfbd7SRuslan Ermilovfile systems only, the block size; see 357476bfbd7SRuslan Ermilov.Xr newfs 8 . 3589a9f19b1SRuslan Ermilov.It Ar bps/cpg 3593233afaeSJohn W. De BoskeyFor 3607733674eSRuslan Ermilov.Cm 4.2BSD 361476bfbd7SRuslan Ermilovfile systems, the number of cylinders in a cylinder group; see 362476bfbd7SRuslan Ermilov.Xr newfs 8 . 3634cbdc634SGreg Lehey.El 3648fae3551SRodney W. Grimes.Sh EXAMPLES 36557dfbec5SPoul-Henning KampDisplay the label for the first slice of the 3669a9f19b1SRuslan Ermilov.Pa da0 3679a9f19b1SRuslan Ermilovdisk, as obtained via 368f9530cf0SRuslan Ermilov.Pa /dev/da0s1 : 3698fae3551SRodney W. Grimes.Pp 370f9530cf0SRuslan Ermilov.Dl "bsdlabel da0s1" 3714cbdc634SGreg Lehey.Pp 3724cbdc634SGreg LeheySave the in-core label for 373ff7d5162SJordan K. Hubbard.Pa da0s1 3744cbdc634SGreg Leheyinto the file 3754cbdc634SGreg Lehey.Pa savedlabel . 3764cbdc634SGreg LeheyThis file can be used with the 3774cbdc634SGreg Lehey.Fl R 378f9530cf0SRuslan Ermilovoption to restore the label at a later date: 379f9530cf0SRuslan Ermilov.Pp 380f9530cf0SRuslan Ermilov.Dl "bsdlabel da0s1 > savedlabel" 381f9530cf0SRuslan Ermilov.Pp 382f9530cf0SRuslan ErmilovCreate a label for 383f9530cf0SRuslan Ermilov.Pa da0s1 : 3844cbdc634SGreg Lehey.Pp 38557dfbec5SPoul-Henning Kamp.Dl "bsdlabel -w /dev/da0s1" 3868fae3551SRodney W. Grimes.Pp 38757dfbec5SPoul-Henning KampRead the label for 388ff7d5162SJordan K. Hubbard.Pa da0s1 , 389f9530cf0SRuslan Ermilovedit it, and install the result: 3908fae3551SRodney W. Grimes.Pp 391f9530cf0SRuslan Ermilov.Dl "bsdlabel -e da0s1" 3923233afaeSJohn W. De Boskey.Pp 3933233afaeSJohn W. De BoskeyRead the on-disk label for 3943233afaeSJohn W. De Boskey.Pa da0s1 , 3959a9f19b1SRuslan Ermilovedit it, and display what the new label would be (in sectors). 3969a9f19b1SRuslan ErmilovIt does 3979a9f19b1SRuslan Ermilov.Em not 398f9530cf0SRuslan Ermilovinstall the new label either in-core or on-disk: 3993233afaeSJohn W. De Boskey.Pp 400f9530cf0SRuslan Ermilov.Dl "bsdlabel -e -n da0s1" 401425bed3aSJoerg Wunsch.Pp 40257dfbec5SPoul-Henning KampWrite a default label on 40357dfbec5SPoul-Henning Kamp.Pa da0s1 . 4049a9f19b1SRuslan ErmilovUse another 4059a9f19b1SRuslan Ermilov.Nm Fl e 4069a9f19b1SRuslan Ermilovcommand to edit the 407f9530cf0SRuslan Ermilovpartitioning and file system information: 408425bed3aSJoerg Wunsch.Pp 409f9530cf0SRuslan Ermilov.Dl "bsdlabel -w da0s1" 4108fae3551SRodney W. Grimes.Pp 4114cbdc634SGreg LeheyRestore the on-disk and in-core label for 412ff7d5162SJordan K. Hubbard.Pa da0s1 4134cbdc634SGreg Leheyfrom information in 414f9530cf0SRuslan Ermilov.Pa savedlabel : 4158fae3551SRodney W. Grimes.Pp 416f9530cf0SRuslan Ermilov.Dl "bsdlabel -R da0s1 savedlabel" 4173233afaeSJohn W. De Boskey.Pp 4183233afaeSJohn W. De BoskeyDisplay what the label would be for 4193233afaeSJohn W. De Boskey.Pa da0s1 4203233afaeSJohn W. De Boskeyusing the partition layout in 4213233afaeSJohn W. De Boskey.Pa label_layout . 42286e0bd0dSBrooks DavisThis is useful for determining how much space would be allotted for various 42386e0bd0dSBrooks Davispartitions with a labeling scheme using 4247733674eSRuslan Ermilov.Cm % Ns -based 4257733674eSRuslan Ermilovor 4267733674eSRuslan Ermilov.Cm * 427f9530cf0SRuslan Ermilovpartition sizes: 4283233afaeSJohn W. De Boskey.Pp 429f9530cf0SRuslan Ermilov.Dl "bsdlabel -R -n da0s1 label_layout" 4308fae3551SRodney W. Grimes.Pp 4314cbdc634SGreg LeheyInstall a new bootstrap on 432ff7d5162SJordan K. Hubbard.Pa da0s1 . 4338fae3551SRodney W. GrimesThe boot code comes from 434f9530cf0SRuslan Ermilov.Pa /boot/boot : 4358fae3551SRodney W. Grimes.Pp 436f9530cf0SRuslan Ermilov.Dl "bsdlabel -B da0s1" 4378fae3551SRodney W. Grimes.Pp 4388fae3551SRodney W. GrimesInstall a new label and bootstrap. 4399a9f19b1SRuslan ErmilovThe bootstrap code comes from the file 4409a9f19b1SRuslan Ermilov.Pa newboot 441f9530cf0SRuslan Ermilovin the current working directory: 442f9530cf0SRuslan Ermilov.Pp 443f9530cf0SRuslan Ermilov.Dl "bsdlabel -w -B -b newboot /dev/da0s1" 444ff7d5162SJordan K. Hubbard.Pp 445ff7d5162SJordan K. HubbardCompletely wipe any prior information on the disk, creating a new bootable 4469a9f19b1SRuslan Ermilovdisk with a 4479a9f19b1SRuslan Ermilov.Tn DOS 4489a9f19b1SRuslan Ermilovpartition table containing one slice, covering the whole disk. 4499a9f19b1SRuslan ErmilovInitialize the label on this slice, 4509a9f19b1SRuslan Ermilovthen edit it. 4519a9f19b1SRuslan ErmilovThe 4529a9f19b1SRuslan Ermilov.Xr dd 1 4539a9f19b1SRuslan Ermilovcommands are optional, but may be necessary for some 4549a9f19b1SRuslan Ermilov.Tn BIOS Ns es 4559a9f19b1SRuslan Ermilovto properly 456f9530cf0SRuslan Ermilovrecognize the disk: 457f9530cf0SRuslan Ermilov.Bd -literal -offset indent 458f9530cf0SRuslan Ermilovdd if=/dev/zero of=/dev/da0 bs=512 count=32 459b8c19fd7SEdward Tomasz Napieralagpart create -s MBR da0 460b8c19fd7SEdward Tomasz Napieralagpart add -t freebsd da0 461b8c19fd7SEdward Tomasz Napieralagpart set -a active -i 1 da0 462b8c19fd7SEdward Tomasz Napieralagpart bootcode -b /boot/mbr da0 463f9530cf0SRuslan Ermilovdd if=/dev/zero of=/dev/da0s1 bs=512 count=32 464f9530cf0SRuslan Ermilovbsdlabel -w -B da0s1 465f9530cf0SRuslan Ermilovbsdlabel -e da0s1 466f9530cf0SRuslan Ermilov.Ed 4673233afaeSJohn W. De Boskey.Pp 4683233afaeSJohn W. De BoskeyThis is an example disk label that uses some of the new partition size types 4697733674eSRuslan Ermilovsuch as 4707733674eSRuslan Ermilov.Cm % , M , G , 4717733674eSRuslan Ermilovand 4727733674eSRuslan Ermilov.Cm * , 4737733674eSRuslan Ermilovwhich could be used as a source file for 47405d98029SSergey Kandaurov.Dq Li "bsdlabel -R ada0s1 new_label_file" : 4753233afaeSJohn W. De Boskey.Bd -literal -offset 4n 47605d98029SSergey Kandaurov# /dev/ada0s1: 4773233afaeSJohn W. De Boskey 4783233afaeSJohn W. De Boskey8 partitions: 4793233afaeSJohn W. De Boskey# size offset fstype [fsize bsize bps/cpg] 480bd92a261SPawel Jakub Dawidek a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) 4813233afaeSJohn W. De Boskey b: 1G * swap 4823233afaeSJohn W. De Boskey c: * * unused 4833233afaeSJohn W. De Boskey e: 204800 * 4.2BSD 4843233afaeSJohn W. De Boskey f: 5g * 4.2BSD 4853233afaeSJohn W. De Boskey g: * * 4.2BSD 4863233afaeSJohn W. De Boskey.Ed 48786e0bd0dSBrooks Davis.Sh DIAGNOSTICS 48886e0bd0dSBrooks DavisThe kernel device drivers will not allow the size of a disk partition 48986e0bd0dSBrooks Davisto be decreased or the offset of a partition to be changed while it is open. 49086e0bd0dSBrooks Davis.Sh COMPATIBILITY 49186e0bd0dSBrooks DavisDue to the use of an 4926b99842aSEd Schouten.Vt uint32_t 49386e0bd0dSBrooks Davisto store the number of sectors, 49421414470SRuslan Ermilov.Bx 49521414470SRuslan Ermilovlabels are restricted to a maximum of 2^32-1 sectors. 49686e0bd0dSBrooks DavisThis usually means 2TB of disk space. 49786e0bd0dSBrooks DavisLarger disks should be partitioned using another method such as 49869573e86SMaxim Konovalov.Xr gpart 8 . 49986e0bd0dSBrooks Davis.Pp 50021414470SRuslan ErmilovThe various 50121414470SRuslan Ermilov.Bx Ns s 50221414470SRuslan Ermilovall use slightly different versions of 50321414470SRuslan Ermilov.Bx 50421414470SRuslan Ermilovlabels and 50586e0bd0dSBrooks Davisare not generally compatible. 5068fae3551SRodney W. Grimes.Sh SEE ALSO 50770e48365SGreg Lehey.Xr ccd 4 , 508734ac3b5SRuslan Ermilov.Xr geom 4 , 5099a9f19b1SRuslan Ermilov.Xr md 4 , 5104cbdc634SGreg Lehey.Xr disktab 5 , 511aa7c9adaSMike Pritchard.Xr boot0cfg 8 , 5127922d6f9SMaxim Konovalov.Xr gpart 8 , 513476bfbd7SRuslan Ermilov.Xr newfs 8 514620e4a8cSSevan Janiyan.Sh HISTORY 515620e4a8cSSevan JaniyanThe 516620e4a8cSSevan Janiyan.Nm disklabel 517620e4a8cSSevan Janiyanutility appeared in 518620e4a8cSSevan Janiyan.Bx 4.3 Tahoe . 5197dc5c6c4SEd Maste.Sh BUGS 5207dc5c6c4SEd Maste.\" PR276517 5217dc5c6c4SEd MasteThe disklabel scheme supports up to 20 partitions, but 5227dc5c6c4SEd Maste.Nm 5237dc5c6c4SEd Mastesupports only 8 partitions. 524