xref: /freebsd/sbin/bsdlabel/bsdlabel.8 (revision bd92a261fe0cdc324f2d218d751e61d4b87b2b8a)
18fae3551SRodney W. Grimes.\" Copyright (c) 1987, 1988, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
58fae3551SRodney W. Grimes.\" Symmetric Computer Systems.
68fae3551SRodney W. Grimes.\"
78fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
88fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
98fae3551SRodney W. Grimes.\" are met:
108fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
118fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
128fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
138fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
148fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
158fae3551SRodney W. Grimes.\" 4. 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.\"
318fae3551SRodney W. Grimes.\"	@(#)disklabel.8	8.2 (Berkeley) 4/19/94
327f3dea24SPeter Wemm.\" $FreeBSD$
338fae3551SRodney W. Grimes.\"
344e9e907dSRuslan Ermilov.Dd September 17, 2005
352c60b668SPoul-Henning Kamp.Dt BSDLABEL 8
369fe48c6eSRuslan Ermilov.Os
378fae3551SRodney W. Grimes.Sh NAME
382c60b668SPoul-Henning Kamp.Nm bsdlabel
398fae3551SRodney W. Grimes.Nd read and write disk pack label
408fae3551SRodney W. Grimes.Sh SYNOPSIS
417c7fb079SRuslan Ermilov.Nm
4257dfbec5SPoul-Henning Kamp.Op Fl A
43d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file
447c7fb079SRuslan Ermilov.Nm
458fae3551SRodney W. Grimes.Fl w
46734ac3b5SRuslan Ermilov.Op Fl \&An
4757dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot
48bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
49d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file
5057dfbec5SPoul-Henning Kamp.Op Ar type
517c7fb079SRuslan Ermilov.Nm
528fae3551SRodney W. Grimes.Fl e
53734ac3b5SRuslan Ermilov.Op Fl \&An
5457dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot
55bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
56d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file
577c7fb079SRuslan Ermilov.Nm
588fae3551SRodney W. Grimes.Fl R
59734ac3b5SRuslan Ermilov.Op Fl \&An
6057dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot
61bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
627747c959SLuigi Rizzo.Op Fl f
63d04b5dfeSRuslan Ermilov.Ar disk | Fl f Ar file
64d04b5dfeSRuslan Ermilov.Ar protofile
658fae3551SRodney W. Grimes.Sh DESCRIPTION
66e1205e80SPhilippe CharnierThe
67e1205e80SPhilippe Charnier.Nm
68e1205e80SPhilippe Charnierutility
69734ac3b5SRuslan Ermilovinstalls, examines or modifies the
70734ac3b5SRuslan Ermilov.Bx
717747c959SLuigi Rizzolabel on a disk partition, or on a file containing a partition image.
729a9f19b1SRuslan ErmilovIn addition,
736bd343a9SPhilippe Charnier.Nm
744cbdc634SGreg Leheycan install bootstrap code.
759a9f19b1SRuslan Ermilov.Ss Disk Device Name
76d04b5dfeSRuslan ErmilovWhen specifying the device (i.e., when the
777747c959SLuigi Rizzo.Fl f
787747c959SLuigi Rizzooption is not used),
799a9f19b1SRuslan Ermilovthe
80ff7d5162SJordan K. Hubbard.Pa /dev/
819a9f19b1SRuslan Ermilovpath prefix may be omitted;
829a9f19b1SRuslan Ermilovthe
834cbdc634SGreg Lehey.Nm
84e1205e80SPhilippe Charnierutility will automatically prepend it.
85734ac3b5SRuslan Ermilov.Ss General Options
8657dfbec5SPoul-Henning KampThe
8757dfbec5SPoul-Henning Kamp.Fl A
88734ac3b5SRuslan Ermilovoption enables processing of the historical parts of the
89734ac3b5SRuslan Ermilov.Bx
90734ac3b5SRuslan Ermilovlabel.
9157dfbec5SPoul-Henning KampIf the option is not given, suitable values are set for these fields.
9257dfbec5SPoul-Henning Kamp.Pp
9357dfbec5SPoul-Henning KampThe
947747c959SLuigi Rizzo.Fl f
957747c959SLuigi Rizzooption tells
967747c959SLuigi Rizzo.Nm
977747c959SLuigi Rizzothat the program will operate on a file instead of a disk partition.
987747c959SLuigi Rizzo.Pp
997747c959SLuigi RizzoThe
10057dfbec5SPoul-Henning Kamp.Fl n
1017747c959SLuigi Rizzooption stops the
10257dfbec5SPoul-Henning Kamp.Nm
10357dfbec5SPoul-Henning Kampprogram right before the disk would have been modified, and displays
10457dfbec5SPoul-Henning Kampthe result instead of writing it.
10557dfbec5SPoul-Henning Kamp.Pp
10657dfbec5SPoul-Henning KampThe
10757dfbec5SPoul-Henning Kamp.Fl m Ar machine
1081c47852fSCraig Rodriguesargument forces
10957dfbec5SPoul-Henning Kamp.Nm
1101c47852fSCraig Rodriguesto use a layout suitable for a different architecture.
1111c47852fSCraig RodriguesCurrent valid values are
1124e9e907dSRuslan Ermilov.Cm i386 , amd64 , ia64 , pc98 ,
1131c47852fSCraig Rodriguesand
1144e9e907dSRuslan Ermilov.Cm alpha .
1151c47852fSCraig RodriguesIf this option is omitted,
1161c47852fSCraig Rodrigues.Nm
1171c47852fSCraig Rodrigueswill use a layout suitable for the current machine.
1189a9f19b1SRuslan Ermilov.Ss Reading the Disk Label
119e40fcc98SDima DorfmanTo examine the label on a disk drive, use
1204cbdc634SGreg Lehey.Nm
1214cbdc634SGreg Leheywithout options:
1224cbdc634SGreg Lehey.Pp
1237c7fb079SRuslan Ermilov.Nm
12457dfbec5SPoul-Henning Kamp.Op Fl A
12557dfbec5SPoul-Henning Kamp.Op Fl m Ar machine
1264cbdc634SGreg Lehey.Ar disk
1274cbdc634SGreg Lehey.Pp
1284cbdc634SGreg Lehey.Ar disk
12957dfbec5SPoul-Henning Kamprepresents the disk in question, and may be in the form
1304cbdc634SGreg Lehey.Pa da0
1314cbdc634SGreg Leheyor
13257dfbec5SPoul-Henning Kamp.Pa /dev/da0 .
13357dfbec5SPoul-Henning KampIt will display the partition layout.
1349a9f19b1SRuslan Ermilov.Ss Writing a Standard Label
1354cbdc634SGreg LeheyTo write a standard label, use the form
1364cbdc634SGreg Lehey.Pp
1377c7fb079SRuslan Ermilov.Nm
1388fae3551SRodney W. Grimes.Fl w
139734ac3b5SRuslan Ermilov.Op Fl \&An
140bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
141425bed3aSJoerg Wunsch.Ar disk
14257dfbec5SPoul-Henning Kamp.Op Ar type
143ff7d5162SJordan K. Hubbard.Pp
144734ac3b5SRuslan ErmilovIf the drive type is specified, the entry of that name in the
14557dfbec5SPoul-Henning Kamp.Xr disktab 5
146734ac3b5SRuslan Ermilovfile is used; otherwise a default layout is used.
1479a9f19b1SRuslan Ermilov.Ss Editing an Existing Disk Label
1484cbdc634SGreg LeheyTo edit an existing disk label, use the form
1494cbdc634SGreg Lehey.Pp
1507c7fb079SRuslan Ermilov.Nm
1518fae3551SRodney W. Grimes.Fl e
152734ac3b5SRuslan Ermilov.Op Fl \&An
153bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
1544cbdc634SGreg Lehey.Ar disk
1554cbdc634SGreg Lehey.Pp
156734ac3b5SRuslan ErmilovThis command opens the disk label in the default editor, and when the editor
157734ac3b5SRuslan Ermilovexits, the label is validated and if OK written to disk.
1589a9f19b1SRuslan Ermilov.Ss Restoring a Disk Label From a File
1594cbdc634SGreg LeheyTo restore a disk label from a file, use the form
1604cbdc634SGreg Lehey.Pp
1617c7fb079SRuslan Ermilov.Nm
1628fae3551SRodney W. Grimes.Fl R
163734ac3b5SRuslan Ermilov.Op Fl \&An
164bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
1659a9f19b1SRuslan Ermilov.Ar disk protofile
1668fae3551SRodney W. Grimes.Pp
1676bd343a9SPhilippe Charnier.Nm
1689a9f19b1SRuslan Ermilovis capable of restoring a disk label that was previously saved in a file in
1699a9f19b1SRuslan Ermilov.Tn ASCII
1709a9f19b1SRuslan Ermilovformat.
1714cbdc634SGreg LeheyThe prototype file used to create the label should be in the same format as that
1729a9f19b1SRuslan Ermilovproduced when reading or editing a label.
1739a9f19b1SRuslan ErmilovComments are delimited by
1749a9f19b1SRuslan Ermilov.Ql #
1759a9f19b1SRuslan Ermilovand newline.
1769a9f19b1SRuslan Ermilov.Ss Installing Bootstraps
17757dfbec5SPoul-Henning KampIf the
1788fae3551SRodney W. Grimes.Fl B
17957dfbec5SPoul-Henning Kampargument is specified, bootstrap code will be read from the file
180ef9ab0b3SRuslan Ermilov.Pa /boot/boot
18157dfbec5SPoul-Henning Kampand written to the disk.
18257dfbec5SPoul-Henning KampThe
18357dfbec5SPoul-Henning Kamp.Fl b Ar boot
18457dfbec5SPoul-Henning Kampargument allows a different file to be used.
1858fae3551SRodney W. Grimes.Sh FILES
186ef9ab0b3SRuslan Ermilov.Bl -tag -width ".Pa /etc/disktab" -compact
187ef9ab0b3SRuslan Ermilov.It Pa /boot/boot
188ef9ab0b3SRuslan ErmilovDefault boot image.
1898fae3551SRodney W. Grimes.It Pa /etc/disktab
190ef9ab0b3SRuslan ErmilovDisk description file.
1918fae3551SRodney W. Grimes.El
1924cbdc634SGreg Lehey.Sh SAVED FILE FORMAT
193e1205e80SPhilippe CharnierThe
1944cbdc634SGreg Lehey.Nm
195e1205e80SPhilippe Charnierutility
1969a9f19b1SRuslan Ermilovuses an
1979a9f19b1SRuslan Ermilov.Tn ASCII
1989a9f19b1SRuslan Ermilovversion of the label when examining, editing, or restoring a disk
1999a9f19b1SRuslan Ermilovlabel.
2009a9f19b1SRuslan ErmilovThe format is:
2014cbdc634SGreg Lehey.Bd -literal -offset 4n
20257dfbec5SPoul-Henning Kamp
20357dfbec5SPoul-Henning Kamp8 partitions:
20457dfbec5SPoul-Henning Kamp#        size   offset    fstype   [fsize bsize bps/cpg]
205bd92a261SPawel Jakub Dawidek  a:    81920       16    4.2BSD     1024  8192    16
206bd92a261SPawel Jakub Dawidek  b:   160000    81936      swap
20757dfbec5SPoul-Henning Kamp  c:  1173930        0    unused        0     0         # "raw" part, don't edit
20857dfbec5SPoul-Henning Kamp.Ed
20957dfbec5SPoul-Henning Kamp.Pp
21057dfbec5SPoul-Henning KampIf the
21157dfbec5SPoul-Henning Kamp.Fl A
21257dfbec5SPoul-Henning Kampoption is specified, the format is:
21357dfbec5SPoul-Henning Kamp.Bd -literal -offset 4n
21407b0cf9aSDavid E. O'Brien# /dev/da1c:
2154cbdc634SGreg Leheytype: SCSI
21607b0cf9aSDavid E. O'Briendisk: da0s1
2174cbdc634SGreg Leheylabel:
2184cbdc634SGreg Leheyflags:
2194cbdc634SGreg Leheybytes/sector: 512
2204cbdc634SGreg Leheysectors/track: 51
2214cbdc634SGreg Leheytracks/cylinder: 19
2224cbdc634SGreg Leheysectors/cylinder: 969
2234cbdc634SGreg Leheycylinders: 1211
2244cbdc634SGreg Leheysectors/unit: 1173930
2254cbdc634SGreg Leheyrpm: 3600
2264cbdc634SGreg Leheyinterleave: 1
2274cbdc634SGreg Leheytrackskew: 0
2284cbdc634SGreg Leheycylinderskew: 0
2294cbdc634SGreg Leheyheadswitch: 0           # milliseconds
2304cbdc634SGreg Leheytrack-to-track seek: 0  # milliseconds
2314cbdc634SGreg Leheydrivedata: 0
2324cbdc634SGreg Lehey
2334cbdc634SGreg Lehey8 partitions:
2344cbdc634SGreg Lehey#        size   offset    fstype   [fsize bsize bps/cpg]
235bd92a261SPawel Jakub Dawidek  a:    81920       16    4.2BSD     1024  8192    16
236bd92a261SPawel Jakub Dawidek  b:   160000    81936      swap
23757dfbec5SPoul-Henning Kamp  c:  1173930        0    unused        0     0         # "raw" part, don't edit
2384cbdc634SGreg Lehey.Ed
2394cbdc634SGreg Lehey.Pp
2409a9f19b1SRuslan ErmilovLines starting with a
2419a9f19b1SRuslan Ermilov.Ql #
2429a9f19b1SRuslan Ermilovmark are comments.
2434cbdc634SGreg Lehey.Pp
2449a9f19b1SRuslan ErmilovThe partition table can have up to 8 entries.
2459a9f19b1SRuslan ErmilovIt contains the following information:
2469a9f19b1SRuslan Ermilov.Bl -tag -width indent
2479a9f19b1SRuslan Ermilov.It Ar #
2484cbdc634SGreg LeheyThe partition identifier is a single letter in the range
2499a9f19b1SRuslan Ermilov.Ql a
2504cbdc634SGreg Leheyto
2519a9f19b1SRuslan Ermilov.Ql h .
2524cbdc634SGreg LeheyBy convention, partition
2539a9f19b1SRuslan Ermilov.Ql c
2544cbdc634SGreg Leheyis reserved to describe the entire disk.
2559a9f19b1SRuslan Ermilov.It Ar size
2569a9f19b1SRuslan ErmilovThe size of the partition in sectors,
2577733674eSRuslan Ermilov.Cm K
2583233afaeSJohn W. De Boskey(kilobytes - 1024),
2597733674eSRuslan Ermilov.Cm M
2603233afaeSJohn W. De Boskey(megabytes - 1024*1024),
2617733674eSRuslan Ermilov.Cm G
2623233afaeSJohn W. De Boskey(gigabytes - 1024*1024*1024),
2637733674eSRuslan Ermilov.Cm %
2649a9f19b1SRuslan Ermilov(percentage of free space
2659a9f19b1SRuslan Ermilov.Em after
2669a9f19b1SRuslan Ermilovremoving any fixed-size partitions other than partition
2679a9f19b1SRuslan Ermilov.Ql c ) ,
2687733674eSRuslan Ermilovor
2697733674eSRuslan Ermilov.Cm *
2709a9f19b1SRuslan Ermilov(all remaining free space
2719a9f19b1SRuslan Ermilov.Em after
2729a9f19b1SRuslan Ermilovfixed-size and percentage partitions).
2739a9f19b1SRuslan ErmilovFor partition
2749a9f19b1SRuslan Ermilov.Ql c ,
2757733674eSRuslan Ermilova size of
2767733674eSRuslan Ermilov.Cm *
2779a9f19b1SRuslan Ermilovindicates the entire disk.
2789a9f19b1SRuslan ErmilovLowercase versions of
2797733674eSRuslan Ermilov.Cm K , M ,
2807733674eSRuslan Ermilovand
2817733674eSRuslan Ermilov.Cm G
2823233afaeSJohn W. De Boskeyare allowed.
28386e0bd0dSBrooks DavisSize and type should be specified without any spaces between them.
2843233afaeSJohn W. De Boskey.Pp
2859a9f19b1SRuslan ErmilovExample: 2097152, 1G, 1024M and 1048576K are all the same size
2863233afaeSJohn W. De Boskey(assuming 512-byte sectors).
2879a9f19b1SRuslan Ermilov.It Ar offset
2889a9f19b1SRuslan ErmilovThe offset of the start of the partition from the beginning of the
2897733674eSRuslan Ermilovdrive in sectors, or
2907733674eSRuslan Ermilov.Cm *
2917733674eSRuslan Ermilovto have
2923233afaeSJohn W. De Boskey.Nm
2933233afaeSJohn W. De Boskeycalculate the correct offset to use (the end of the previous partition plus
2943233afaeSJohn W. De Boskeyone, ignoring partition
2959a9f19b1SRuslan Ermilov.Ql c .
2963233afaeSJohn W. De BoskeyFor partition
2979a9f19b1SRuslan Ermilov.Ql c ,
2987733674eSRuslan Ermilov.Cm *
2997733674eSRuslan Ermilovwill be interpreted as an offset of 0.
3009a9f19b1SRuslan Ermilov.It Ar fstype
3019a9f19b1SRuslan ErmilovDescribes the purpose of the partition.
3029a9f19b1SRuslan ErmilovThe example shows all currently used partition types.
3039a9f19b1SRuslan ErmilovFor
3049a9f19b1SRuslan Ermilov.Tn UFS
3059a9f19b1SRuslan Ermilovfile systems and
3069a9f19b1SRuslan Ermilov.Xr ccd 4
3079a9f19b1SRuslan Ermilovpartitions, use type
3087733674eSRuslan Ermilov.Cm 4.2BSD .
30970e48365SGreg LeheyFor Vinum drives, use type
31070e48365SGreg Lehey.Cm vinum .
3113233afaeSJohn W. De BoskeyOther common types are
3129a9f19b1SRuslan Ermilov.Cm swap
3133233afaeSJohn W. De Boskeyand
3149a9f19b1SRuslan Ermilov.Cm unused .
3152f1aba69SRuslan ErmilovBy convention, partition
3169a9f19b1SRuslan Ermilov.Ql c
3172f1aba69SRuslan Ermilovrepresents the entire slice and should be of type
31870e48365SGreg Lehey.Cm unused ,
31970e48365SGreg Leheythough
32070e48365SGreg Lehey.Nm
32170e48365SGreg Leheydoes not enforce this convention.
322e1205e80SPhilippe CharnierThe
32370e48365SGreg Lehey.Nm
324e1205e80SPhilippe Charnierutility
3259a9f19b1SRuslan Ermilovalso knows about a number of other partition types,
3269a9f19b1SRuslan Ermilovnone of which are in current use.
3279a9f19b1SRuslan Ermilov(See the definitions starting with
3282f1aba69SRuslan Ermilov.Dv FS_UNUSED
3292f1aba69SRuslan Ermilovin
330fe08efe6SRuslan Ermilov.In sys/disklabel.h
3319a9f19b1SRuslan Ermilovfor more details.)
3329a9f19b1SRuslan Ermilov.It Ar fsize
3333233afaeSJohn W. De BoskeyFor
3347733674eSRuslan Ermilov.Cm 4.2BSD
3359a9f19b1SRuslan Ermilovand
3369a9f19b1SRuslan Ermilov.Tn LFS
3379a9f19b1SRuslan Ermilovfile systems only, the fragment size.
3389a9f19b1SRuslan ErmilovDefaults to 1024 for partitions smaller than 1GB,
3399a9f19b1SRuslan Ermilov4096 for partitions 1GB or larger.
3409a9f19b1SRuslan Ermilov.It Ar bsize
3413233afaeSJohn W. De BoskeyFor
3427733674eSRuslan Ermilov.Cm 4.2BSD
3439a9f19b1SRuslan Ermilovand
3449a9f19b1SRuslan Ermilov.Tn LFS
3459a9f19b1SRuslan Ermilovfile systems only, the block size.
3469a9f19b1SRuslan ErmilovDefaults to 8192 for partitions smaller than 1GB,
3479a9f19b1SRuslan Ermilov16384 for partitions 1GB or larger.
3489a9f19b1SRuslan Ermilov.It Ar bps/cpg
3493233afaeSJohn W. De BoskeyFor
3507733674eSRuslan Ermilov.Cm 4.2BSD
3519a9f19b1SRuslan Ermilovfile systems, the number of cylinders in a cylinder group.
3529a9f19b1SRuslan ErmilovFor
3539a9f19b1SRuslan Ermilov.Tn LFS
3549a9f19b1SRuslan Ermilovfile systems, the segment shift value.
3559a9f19b1SRuslan ErmilovDefaults to 16 for partitions smaller than 1GB,
3569a9f19b1SRuslan Ermilov64 for partitions 1GB or larger.
3574cbdc634SGreg Lehey.El
3588fae3551SRodney W. Grimes.Sh EXAMPLES
3592c60b668SPoul-Henning Kamp.Dl "bsdlabel da0s1"
3608fae3551SRodney W. Grimes.Pp
36157dfbec5SPoul-Henning KampDisplay the label for the first slice of the
3629a9f19b1SRuslan Ermilov.Pa da0
3639a9f19b1SRuslan Ermilovdisk, as obtained via
364ff7d5162SJordan K. Hubbard.Pa /dev/da0s1 .
3658fae3551SRodney W. Grimes.Pp
3662c60b668SPoul-Henning Kamp.Dl "bsdlabel da0s1 > savedlabel"
3674cbdc634SGreg Lehey.Pp
3684cbdc634SGreg LeheySave the in-core label for
369ff7d5162SJordan K. Hubbard.Pa da0s1
3704cbdc634SGreg Leheyinto the file
3714cbdc634SGreg Lehey.Pa savedlabel .
3724cbdc634SGreg LeheyThis file can be used with the
3734cbdc634SGreg Lehey.Fl R
3749a9f19b1SRuslan Ermilovoption to restore the label at a later date.
3754cbdc634SGreg Lehey.Pp
37657dfbec5SPoul-Henning Kamp.Dl "bsdlabel -w /dev/da0s1"
3778fae3551SRodney W. Grimes.Pp
3784cbdc634SGreg LeheyCreate a label for
379734ac3b5SRuslan Ermilov.Pa da0s1 .
3808fae3551SRodney W. Grimes.Pp
38157dfbec5SPoul-Henning Kamp.Dl "bsdlabel -e da0s1"
3828fae3551SRodney W. Grimes.Pp
38357dfbec5SPoul-Henning KampRead the label for
384ff7d5162SJordan K. Hubbard.Pa da0s1 ,
38557dfbec5SPoul-Henning Kampedit it, and install the result.
3868fae3551SRodney W. Grimes.Pp
38757dfbec5SPoul-Henning Kamp.Dl "bsdlabel -e -n da0s1"
3883233afaeSJohn W. De Boskey.Pp
3893233afaeSJohn W. De BoskeyRead the on-disk label for
3903233afaeSJohn W. De Boskey.Pa da0s1 ,
3919a9f19b1SRuslan Ermilovedit it, and display what the new label would be (in sectors).
3929a9f19b1SRuslan ErmilovIt does
3939a9f19b1SRuslan Ermilov.Em not
3949a9f19b1SRuslan Ermilovinstall the new label either in-core or on-disk.
3953233afaeSJohn W. De Boskey.Pp
39657dfbec5SPoul-Henning Kamp.Dl "bsdlabel -w da0s1"
397425bed3aSJoerg Wunsch.Pp
39857dfbec5SPoul-Henning KampWrite a default label on
39957dfbec5SPoul-Henning Kamp.Pa da0s1 .
4009a9f19b1SRuslan ErmilovUse another
4019a9f19b1SRuslan Ermilov.Nm Fl e
4029a9f19b1SRuslan Ermilovcommand to edit the
403425bed3aSJoerg Wunschpartitioning and file system information.
404425bed3aSJoerg Wunsch.Pp
4052c60b668SPoul-Henning Kamp.Dl "bsdlabel -R da0s1 savedlabel"
4068fae3551SRodney W. Grimes.Pp
4074cbdc634SGreg LeheyRestore the on-disk and in-core label for
408ff7d5162SJordan K. Hubbard.Pa da0s1
4094cbdc634SGreg Leheyfrom information in
4104cbdc634SGreg Lehey.Pa savedlabel .
4118fae3551SRodney W. Grimes.Pp
4122c60b668SPoul-Henning Kamp.Dl "bsdlabel -R -n da0s1 label_layout"
4133233afaeSJohn W. De Boskey.Pp
4143233afaeSJohn W. De BoskeyDisplay what the label would be for
4153233afaeSJohn W. De Boskey.Pa da0s1
4163233afaeSJohn W. De Boskeyusing the partition layout in
4173233afaeSJohn W. De Boskey.Pa label_layout .
41886e0bd0dSBrooks DavisThis is useful for determining how much space would be allotted for various
41986e0bd0dSBrooks Davispartitions with a labeling scheme using
4207733674eSRuslan Ermilov.Cm % Ns -based
4217733674eSRuslan Ermilovor
4227733674eSRuslan Ermilov.Cm *
4237733674eSRuslan Ermilovpartition sizes.
4243233afaeSJohn W. De Boskey.Pp
4252c60b668SPoul-Henning Kamp.Dl "bsdlabel -B da0s1"
4268fae3551SRodney W. Grimes.Pp
4274cbdc634SGreg LeheyInstall a new bootstrap on
428ff7d5162SJordan K. Hubbard.Pa da0s1 .
4298fae3551SRodney W. GrimesThe boot code comes from
4308d48318bSPoul-Henning Kamp.Pa /boot/boot .
4318fae3551SRodney W. Grimes.Pp
43257dfbec5SPoul-Henning Kamp.Dl "bsdlabel -w -B -b newboot /dev/da0s1"
4338fae3551SRodney W. Grimes.Pp
4348fae3551SRodney W. GrimesInstall a new label and bootstrap.
4359a9f19b1SRuslan ErmilovThe bootstrap code comes from the file
4369a9f19b1SRuslan Ermilov.Pa newboot
4379a9f19b1SRuslan Ermilovin the current working directory.
4389a9f19b1SRuslan Ermilov.Bd -literal -offset indent
4399a9f19b1SRuslan Ermilovdd if=/dev/zero of=/dev/da0 bs=512 count=32
4409a9f19b1SRuslan Ermilovfdisk -BI da0
4419a9f19b1SRuslan Ermilovdd if=/dev/zero of=/dev/da0s1 bs=512 count=32
44257dfbec5SPoul-Henning Kampbsdlabel -w -B da0s1
4432c60b668SPoul-Henning Kampbsdlabel -e da0s1
4449a9f19b1SRuslan Ermilov.Ed
445ff7d5162SJordan K. Hubbard.Pp
446ff7d5162SJordan K. HubbardCompletely wipe any prior information on the disk, creating a new bootable
4479a9f19b1SRuslan Ermilovdisk with a
4489a9f19b1SRuslan Ermilov.Tn DOS
4499a9f19b1SRuslan Ermilovpartition table containing one slice, covering the whole disk.
4509a9f19b1SRuslan ErmilovInitialize the label on this slice,
4519a9f19b1SRuslan Ermilovthen edit it.
4529a9f19b1SRuslan ErmilovThe
4539a9f19b1SRuslan Ermilov.Xr dd 1
4549a9f19b1SRuslan Ermilovcommands are optional, but may be necessary for some
4559a9f19b1SRuslan Ermilov.Tn BIOS Ns es
4569a9f19b1SRuslan Ermilovto properly
457ff7d5162SJordan K. Hubbardrecognize the disk.
4583233afaeSJohn W. De Boskey.Pp
4593233afaeSJohn W. De BoskeyThis is an example disk label that uses some of the new partition size types
4607733674eSRuslan Ermilovsuch as
4617733674eSRuslan Ermilov.Cm % , M , G ,
4627733674eSRuslan Ermilovand
4637733674eSRuslan Ermilov.Cm * ,
4647733674eSRuslan Ermilovwhich could be used as a source file for
4652c60b668SPoul-Henning Kamp.Dq Li "bsdlabel -R ad0s1c new_label_file" :
4663233afaeSJohn W. De Boskey.Bd -literal -offset 4n
4673233afaeSJohn W. De Boskey# /dev/ad0s1c:
4683233afaeSJohn W. De Boskey
4693233afaeSJohn W. De Boskey8 partitions:
4703233afaeSJohn W. De Boskey#        size   offset    fstype   [fsize bsize bps/cpg]
471bd92a261SPawel Jakub Dawidek  a:   400M       16    4.2BSD     4096 16384    75 	# (Cyl.    0 - 812*)
4723233afaeSJohn W. De Boskey  b:     1G        *      swap
4733233afaeSJohn W. De Boskey  c:      *        *    unused
4743233afaeSJohn W. De Boskey  e: 204800        *    4.2BSD
4753233afaeSJohn W. De Boskey  f:     5g        *    4.2BSD
4763233afaeSJohn W. De Boskey  g:      *        *    4.2BSD
4773233afaeSJohn W. De Boskey.Ed
47886e0bd0dSBrooks Davis.Sh DIAGNOSTICS
47986e0bd0dSBrooks DavisThe kernel device drivers will not allow the size of a disk partition
48086e0bd0dSBrooks Davisto be decreased or the offset of a partition to be changed while it is open.
48186e0bd0dSBrooks Davis.Sh COMPATIBILITY
48286e0bd0dSBrooks DavisDue to the use of an
48386e0bd0dSBrooks Davis.Vt u_int32_t
48486e0bd0dSBrooks Davisto store the number of sectors,
48521414470SRuslan Ermilov.Bx
48621414470SRuslan Ermilovlabels are restricted to a maximum of 2^32-1 sectors.
48786e0bd0dSBrooks DavisThis usually means 2TB of disk space.
48886e0bd0dSBrooks DavisLarger disks should be partitioned using another method such as
48986e0bd0dSBrooks Davis.Xr gpt 8 .
49086e0bd0dSBrooks Davis.Pp
49121414470SRuslan ErmilovThe various
49221414470SRuslan Ermilov.Bx Ns s
49321414470SRuslan Ermilovall use slightly different versions of
49421414470SRuslan Ermilov.Bx
49521414470SRuslan Ermilovlabels and
49686e0bd0dSBrooks Davisare not generally compatible.
4978fae3551SRodney W. Grimes.Sh SEE ALSO
49870e48365SGreg Lehey.Xr ccd 4 ,
499734ac3b5SRuslan Ermilov.Xr geom 4 ,
5009a9f19b1SRuslan Ermilov.Xr md 4 ,
501734ac3b5SRuslan Ermilov.\" Xr bsdlabel 5 ,
5024cbdc634SGreg Lehey.Xr disktab 5 ,
503aa7c9adaSMike Pritchard.Xr boot0cfg 8 ,
50486e0bd0dSBrooks Davis.Xr fdisk 8 ,
50586e0bd0dSBrooks Davis.Xr gpt 8
506