xref: /freebsd/sbin/bsdlabel/bsdlabel.8 (revision 734ac3b54318ce3afa6b8ced253b7e78317a9987)
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.\" 3. All advertising materials mentioning features or use of this software
166bd343a9SPhilippe Charnier.\"    must display the following acknowledgment:
178fae3551SRodney W. Grimes.\"	This product includes software developed by the University of
188fae3551SRodney W. Grimes.\"	California, Berkeley and its contributors.
198fae3551SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
208fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
218fae3551SRodney W. Grimes.\"    without specific prior written permission.
228fae3551SRodney W. Grimes.\"
238fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
248fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
258fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
268fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
278fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
288fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
298fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
308fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
318fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
328fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
338fae3551SRodney W. Grimes.\" SUCH DAMAGE.
348fae3551SRodney W. Grimes.\"
358fae3551SRodney W. Grimes.\"	@(#)disklabel.8	8.2 (Berkeley) 4/19/94
367f3dea24SPeter Wemm.\" $FreeBSD$
378fae3551SRodney W. Grimes.\"
389a9f19b1SRuslan Ermilov.Dd March 15, 2003
392c60b668SPoul-Henning Kamp.Dt BSDLABEL 8
409fe48c6eSRuslan Ermilov.Os
418fae3551SRodney W. Grimes.Sh NAME
422c60b668SPoul-Henning Kamp.Nm bsdlabel
438fae3551SRodney W. Grimes.Nd read and write disk pack label
448fae3551SRodney W. Grimes.Sh SYNOPSIS
457c7fb079SRuslan Ermilov.Nm
4657dfbec5SPoul-Henning Kamp.Op Fl A
478fae3551SRodney W. Grimes.Ar disk
487c7fb079SRuslan Ermilov.Nm
498fae3551SRodney W. Grimes.Fl w
50734ac3b5SRuslan Ermilov.Op Fl \&An
5157dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot
52bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
5357dfbec5SPoul-Henning Kamp.Ar disk
5457dfbec5SPoul-Henning Kamp.Op Ar type
557c7fb079SRuslan Ermilov.Nm
568fae3551SRodney W. Grimes.Fl e
57734ac3b5SRuslan Ermilov.Op Fl \&An
5857dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot
59bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
608fae3551SRodney W. Grimes.Ar disk
617c7fb079SRuslan Ermilov.Nm
628fae3551SRodney W. Grimes.Fl R
63734ac3b5SRuslan Ermilov.Op Fl \&An
6457dfbec5SPoul-Henning Kamp.Op Fl B Op Fl b Ar boot
65bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
669a9f19b1SRuslan Ermilov.Ar disk protofile
678fae3551SRodney W. Grimes.Sh DESCRIPTION
68e1205e80SPhilippe CharnierThe
69e1205e80SPhilippe Charnier.Nm
70e1205e80SPhilippe Charnierutility
71734ac3b5SRuslan Ermilovinstalls, examines or modifies the
72734ac3b5SRuslan Ermilov.Bx
73734ac3b5SRuslan Ermilovlabel on a disk partition.
749a9f19b1SRuslan ErmilovIn addition,
756bd343a9SPhilippe Charnier.Nm
764cbdc634SGreg Leheycan install bootstrap code.
779a9f19b1SRuslan Ermilov.Ss Disk Device Name
789a9f19b1SRuslan ErmilovWhen specifying the device,
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
9457dfbec5SPoul-Henning Kamp.Fl n
9557dfbec5SPoul-Henning Kampstops the
9657dfbec5SPoul-Henning Kamp.Nm
9757dfbec5SPoul-Henning Kampprogram right before the disk would have been modified, and displays
9857dfbec5SPoul-Henning Kampthe result instead of writing it.
9957dfbec5SPoul-Henning Kamp.Pp
10057dfbec5SPoul-Henning KampThe
10157dfbec5SPoul-Henning Kamp.Fl m Ar machine
10257dfbec5SPoul-Henning Kampargument instructs
10357dfbec5SPoul-Henning Kamp.Nm
10457dfbec5SPoul-Henning Kampto use the layout suitable for the specified machine.
1059a9f19b1SRuslan Ermilov.Ss Reading the Disk Label
106e40fcc98SDima DorfmanTo examine the label on a disk drive, use
1074cbdc634SGreg Lehey.Nm
1084cbdc634SGreg Leheywithout options:
1094cbdc634SGreg Lehey.Pp
1107c7fb079SRuslan Ermilov.Nm
11157dfbec5SPoul-Henning Kamp.Op Fl A
11257dfbec5SPoul-Henning Kamp.Op Fl m Ar machine
1134cbdc634SGreg Lehey.Ar disk
1144cbdc634SGreg Lehey.Pp
1154cbdc634SGreg Lehey.Ar disk
11657dfbec5SPoul-Henning Kamprepresents the disk in question, and may be in the form
1174cbdc634SGreg Lehey.Pa da0
1184cbdc634SGreg Leheyor
11957dfbec5SPoul-Henning Kamp.Pa /dev/da0 .
12057dfbec5SPoul-Henning KampIt will display the partition layout.
1219a9f19b1SRuslan Ermilov.Ss Writing a Standard Label
1224cbdc634SGreg LeheyTo write a standard label, use the form
1234cbdc634SGreg Lehey.Pp
1247c7fb079SRuslan Ermilov.Nm
1258fae3551SRodney W. Grimes.Fl w
126734ac3b5SRuslan Ermilov.Op Fl \&An
127bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
128425bed3aSJoerg Wunsch.Ar disk
12957dfbec5SPoul-Henning Kamp.Op Ar type
130ff7d5162SJordan K. Hubbard.Pp
131734ac3b5SRuslan ErmilovIf the drive type is specified, the entry of that name in the
13257dfbec5SPoul-Henning Kamp.Xr disktab 5
133734ac3b5SRuslan Ermilovfile is used; otherwise a default layout is used.
1349a9f19b1SRuslan Ermilov.Ss Editing an Existing Disk Label
1354cbdc634SGreg LeheyTo edit an existing disk label, use the form
1364cbdc634SGreg Lehey.Pp
1377c7fb079SRuslan Ermilov.Nm
1388fae3551SRodney W. Grimes.Fl e
139734ac3b5SRuslan Ermilov.Op Fl \&An
140bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
1414cbdc634SGreg Lehey.Ar disk
1424cbdc634SGreg Lehey.Pp
143734ac3b5SRuslan ErmilovThis command opens the disk label in the default editor, and when the editor
144734ac3b5SRuslan Ermilovexits, the label is validated and if OK written to disk.
1459a9f19b1SRuslan Ermilov.Ss Restoring a Disk Label From a File
1464cbdc634SGreg LeheyTo restore a disk label from a file, use the form
1474cbdc634SGreg Lehey.Pp
1487c7fb079SRuslan Ermilov.Nm
1498fae3551SRodney W. Grimes.Fl R
150734ac3b5SRuslan Ermilov.Op Fl \&An
151bc33ea1aSRuslan Ermilov.Op Fl m Ar machine
1529a9f19b1SRuslan Ermilov.Ar disk protofile
1538fae3551SRodney W. Grimes.Pp
1546bd343a9SPhilippe Charnier.Nm
1559a9f19b1SRuslan Ermilovis capable of restoring a disk label that was previously saved in a file in
1569a9f19b1SRuslan Ermilov.Tn ASCII
1579a9f19b1SRuslan Ermilovformat.
1584cbdc634SGreg LeheyThe prototype file used to create the label should be in the same format as that
1599a9f19b1SRuslan Ermilovproduced when reading or editing a label.
1609a9f19b1SRuslan ErmilovComments are delimited by
1619a9f19b1SRuslan Ermilov.Ql #
1629a9f19b1SRuslan Ermilovand newline.
1639a9f19b1SRuslan Ermilov.Ss Installing Bootstraps
16457dfbec5SPoul-Henning KampIf the
1658fae3551SRodney W. Grimes.Fl B
16657dfbec5SPoul-Henning Kampargument is specified, bootstrap code will be read from the file
167ef9ab0b3SRuslan Ermilov.Pa /boot/boot
16857dfbec5SPoul-Henning Kampand written to the disk.
16957dfbec5SPoul-Henning KampThe
17057dfbec5SPoul-Henning Kamp.Fl b Ar boot
17157dfbec5SPoul-Henning Kampargument allows a different file to be used.
1728fae3551SRodney W. Grimes.Sh FILES
173ef9ab0b3SRuslan Ermilov.Bl -tag -width ".Pa /etc/disktab" -compact
174ef9ab0b3SRuslan Ermilov.It Pa /boot/boot
175ef9ab0b3SRuslan ErmilovDefault boot image.
1768fae3551SRodney W. Grimes.It Pa /etc/disktab
177ef9ab0b3SRuslan ErmilovDisk description file.
1788fae3551SRodney W. Grimes.El
1794cbdc634SGreg Lehey.Sh SAVED FILE FORMAT
180e1205e80SPhilippe CharnierThe
1814cbdc634SGreg Lehey.Nm
182e1205e80SPhilippe Charnierutility
1839a9f19b1SRuslan Ermilovuses an
1849a9f19b1SRuslan Ermilov.Tn ASCII
1859a9f19b1SRuslan Ermilovversion of the label when examining, editing, or restoring a disk
1869a9f19b1SRuslan Ermilovlabel.
1879a9f19b1SRuslan ErmilovThe format is:
1884cbdc634SGreg Lehey.Bd -literal -offset 4n
18957dfbec5SPoul-Henning Kamp
19057dfbec5SPoul-Henning Kamp8 partitions:
19157dfbec5SPoul-Henning Kamp#        size   offset    fstype   [fsize bsize bps/cpg]
19257dfbec5SPoul-Henning Kamp  a:    81920        0    4.2BSD     1024  8192    16
19357dfbec5SPoul-Henning Kamp  b:   160000    81920      swap
19457dfbec5SPoul-Henning Kamp  c:  1173930        0    unused        0     0         # "raw" part, don't edit
19557dfbec5SPoul-Henning Kamp.Ed
19657dfbec5SPoul-Henning Kamp.Pp
19757dfbec5SPoul-Henning KampIf the
19857dfbec5SPoul-Henning Kamp.Fl A
19957dfbec5SPoul-Henning Kampoption is specified, the format is:
20057dfbec5SPoul-Henning Kamp.Bd -literal -offset 4n
20107b0cf9aSDavid E. O'Brien# /dev/da1c:
2024cbdc634SGreg Leheytype: SCSI
20307b0cf9aSDavid E. O'Briendisk: da0s1
2044cbdc634SGreg Leheylabel:
2054cbdc634SGreg Leheyflags:
2064cbdc634SGreg Leheybytes/sector: 512
2074cbdc634SGreg Leheysectors/track: 51
2084cbdc634SGreg Leheytracks/cylinder: 19
2094cbdc634SGreg Leheysectors/cylinder: 969
2104cbdc634SGreg Leheycylinders: 1211
2114cbdc634SGreg Leheysectors/unit: 1173930
2124cbdc634SGreg Leheyrpm: 3600
2134cbdc634SGreg Leheyinterleave: 1
2144cbdc634SGreg Leheytrackskew: 0
2154cbdc634SGreg Leheycylinderskew: 0
2164cbdc634SGreg Leheyheadswitch: 0           # milliseconds
2174cbdc634SGreg Leheytrack-to-track seek: 0  # milliseconds
2184cbdc634SGreg Leheydrivedata: 0
2194cbdc634SGreg Lehey
2204cbdc634SGreg Lehey8 partitions:
2214cbdc634SGreg Lehey#        size   offset    fstype   [fsize bsize bps/cpg]
22257dfbec5SPoul-Henning Kamp  a:    81920        0    4.2BSD     1024  8192    16
22357dfbec5SPoul-Henning Kamp  b:   160000    81920      swap
22457dfbec5SPoul-Henning Kamp  c:  1173930        0    unused        0     0         # "raw" part, don't edit
2254cbdc634SGreg Lehey.Ed
2264cbdc634SGreg Lehey.Pp
2279a9f19b1SRuslan ErmilovLines starting with a
2289a9f19b1SRuslan Ermilov.Ql #
2299a9f19b1SRuslan Ermilovmark are comments.
2304cbdc634SGreg Lehey.Pp
2319a9f19b1SRuslan ErmilovThe partition table can have up to 8 entries.
2329a9f19b1SRuslan ErmilovIt contains the following information:
2339a9f19b1SRuslan Ermilov.Bl -tag -width indent
2349a9f19b1SRuslan Ermilov.It Ar #
2354cbdc634SGreg LeheyThe partition identifier is a single letter in the range
2369a9f19b1SRuslan Ermilov.Ql a
2374cbdc634SGreg Leheyto
2389a9f19b1SRuslan Ermilov.Ql h .
2394cbdc634SGreg LeheyBy convention, partition
2409a9f19b1SRuslan Ermilov.Ql c
2414cbdc634SGreg Leheyis reserved to describe the entire disk.
2429a9f19b1SRuslan Ermilov.It Ar size
2439a9f19b1SRuslan ErmilovThe size of the partition in sectors,
2447733674eSRuslan Ermilov.Cm K
2453233afaeSJohn W. De Boskey(kilobytes - 1024),
2467733674eSRuslan Ermilov.Cm M
2473233afaeSJohn W. De Boskey(megabytes - 1024*1024),
2487733674eSRuslan Ermilov.Cm G
2493233afaeSJohn W. De Boskey(gigabytes - 1024*1024*1024),
2507733674eSRuslan Ermilov.Cm %
2519a9f19b1SRuslan Ermilov(percentage of free space
2529a9f19b1SRuslan Ermilov.Em after
2539a9f19b1SRuslan Ermilovremoving any fixed-size partitions other than partition
2549a9f19b1SRuslan Ermilov.Ql c ) ,
2557733674eSRuslan Ermilovor
2567733674eSRuslan Ermilov.Cm *
2579a9f19b1SRuslan Ermilov(all remaining free space
2589a9f19b1SRuslan Ermilov.Em after
2599a9f19b1SRuslan Ermilovfixed-size and percentage partitions).
2609a9f19b1SRuslan ErmilovFor partition
2619a9f19b1SRuslan Ermilov.Ql c ,
2627733674eSRuslan Ermilova size of
2637733674eSRuslan Ermilov.Cm *
2649a9f19b1SRuslan Ermilovindicates the entire disk.
2659a9f19b1SRuslan ErmilovLowercase versions of
2667733674eSRuslan Ermilov.Cm K , M ,
2677733674eSRuslan Ermilovand
2687733674eSRuslan Ermilov.Cm G
2693233afaeSJohn W. De Boskeyare allowed.
2703233afaeSJohn W. De BoskeySize and type should be specifed without any spaces between them.
2713233afaeSJohn W. De Boskey.Pp
2729a9f19b1SRuslan ErmilovExample: 2097152, 1G, 1024M and 1048576K are all the same size
2733233afaeSJohn W. De Boskey(assuming 512-byte sectors).
2749a9f19b1SRuslan Ermilov.It Ar offset
2759a9f19b1SRuslan ErmilovThe offset of the start of the partition from the beginning of the
2767733674eSRuslan Ermilovdrive in sectors, or
2777733674eSRuslan Ermilov.Cm *
2787733674eSRuslan Ermilovto have
2793233afaeSJohn W. De Boskey.Nm
2803233afaeSJohn W. De Boskeycalculate the correct offset to use (the end of the previous partition plus
2813233afaeSJohn W. De Boskeyone, ignoring partition
2829a9f19b1SRuslan Ermilov.Ql c .
2833233afaeSJohn W. De BoskeyFor partition
2849a9f19b1SRuslan Ermilov.Ql c ,
2857733674eSRuslan Ermilov.Cm *
2867733674eSRuslan Ermilovwill be interpreted as an offset of 0.
2879a9f19b1SRuslan Ermilov.It Ar fstype
2889a9f19b1SRuslan ErmilovDescribes the purpose of the partition.
2899a9f19b1SRuslan ErmilovThe example shows all currently used partition types.
2909a9f19b1SRuslan ErmilovFor
2919a9f19b1SRuslan Ermilov.Tn UFS
2929a9f19b1SRuslan Ermilovfile systems and
2939a9f19b1SRuslan Ermilov.Xr ccd 4
2949a9f19b1SRuslan Ermilovpartitions, use type
2957733674eSRuslan Ermilov.Cm 4.2BSD .
29670e48365SGreg LeheyFor Vinum drives, use type
29770e48365SGreg Lehey.Cm vinum .
2983233afaeSJohn W. De BoskeyOther common types are
2999a9f19b1SRuslan Ermilov.Cm swap
3003233afaeSJohn W. De Boskeyand
3019a9f19b1SRuslan Ermilov.Cm unused .
3022f1aba69SRuslan ErmilovBy convention, partition
3039a9f19b1SRuslan Ermilov.Ql c
3042f1aba69SRuslan Ermilovrepresents the entire slice and should be of type
30570e48365SGreg Lehey.Cm unused ,
30670e48365SGreg Leheythough
30770e48365SGreg Lehey.Nm
30870e48365SGreg Leheydoes not enforce this convention.
309e1205e80SPhilippe CharnierThe
31070e48365SGreg Lehey.Nm
311e1205e80SPhilippe Charnierutility
3129a9f19b1SRuslan Ermilovalso knows about a number of other partition types,
3139a9f19b1SRuslan Ermilovnone of which are in current use.
3149a9f19b1SRuslan Ermilov(See the definitions starting with
3152f1aba69SRuslan Ermilov.Dv FS_UNUSED
3162f1aba69SRuslan Ermilovin
3179a9f19b1SRuslan Ermilov.Aq Pa sys/disklabel.h
3189a9f19b1SRuslan Ermilovfor more details.)
3199a9f19b1SRuslan Ermilov.It Ar fsize
3203233afaeSJohn W. De BoskeyFor
3217733674eSRuslan Ermilov.Cm 4.2BSD
3229a9f19b1SRuslan Ermilovand
3239a9f19b1SRuslan Ermilov.Tn LFS
3249a9f19b1SRuslan Ermilovfile systems only, the fragment size.
3259a9f19b1SRuslan ErmilovDefaults to 1024 for partitions smaller than 1GB,
3269a9f19b1SRuslan Ermilov4096 for partitions 1GB or larger.
3279a9f19b1SRuslan Ermilov.It Ar bsize
3283233afaeSJohn W. De BoskeyFor
3297733674eSRuslan Ermilov.Cm 4.2BSD
3309a9f19b1SRuslan Ermilovand
3319a9f19b1SRuslan Ermilov.Tn LFS
3329a9f19b1SRuslan Ermilovfile systems only, the block size.
3339a9f19b1SRuslan ErmilovDefaults to 8192 for partitions smaller than 1GB,
3349a9f19b1SRuslan Ermilov16384 for partitions 1GB or larger.
3359a9f19b1SRuslan Ermilov.It Ar bps/cpg
3363233afaeSJohn W. De BoskeyFor
3377733674eSRuslan Ermilov.Cm 4.2BSD
3389a9f19b1SRuslan Ermilovfile systems, the number of cylinders in a cylinder group.
3399a9f19b1SRuslan ErmilovFor
3409a9f19b1SRuslan Ermilov.Tn LFS
3419a9f19b1SRuslan Ermilovfile systems, the segment shift value.
3429a9f19b1SRuslan ErmilovDefaults to 16 for partitions smaller than 1GB,
3439a9f19b1SRuslan Ermilov64 for partitions 1GB or larger.
3444cbdc634SGreg Lehey.El
3458fae3551SRodney W. Grimes.Sh EXAMPLES
3462c60b668SPoul-Henning Kamp.Dl "bsdlabel da0s1"
3478fae3551SRodney W. Grimes.Pp
34857dfbec5SPoul-Henning KampDisplay the label for the first slice of the
3499a9f19b1SRuslan Ermilov.Pa da0
3509a9f19b1SRuslan Ermilovdisk, as obtained via
351ff7d5162SJordan K. Hubbard.Pa /dev/da0s1 .
3528fae3551SRodney W. Grimes.Pp
3532c60b668SPoul-Henning Kamp.Dl "bsdlabel da0s1 > savedlabel"
3544cbdc634SGreg Lehey.Pp
3554cbdc634SGreg LeheySave the in-core label for
356ff7d5162SJordan K. Hubbard.Pa da0s1
3574cbdc634SGreg Leheyinto the file
3584cbdc634SGreg Lehey.Pa savedlabel .
3594cbdc634SGreg LeheyThis file can be used with the
3604cbdc634SGreg Lehey.Fl R
3619a9f19b1SRuslan Ermilovoption to restore the label at a later date.
3624cbdc634SGreg Lehey.Pp
36357dfbec5SPoul-Henning Kamp.Dl "bsdlabel -w /dev/da0s1"
3648fae3551SRodney W. Grimes.Pp
3654cbdc634SGreg LeheyCreate a label for
366734ac3b5SRuslan Ermilov.Pa da0s1 .
3678fae3551SRodney W. Grimes.Pp
36857dfbec5SPoul-Henning Kamp.Dl "bsdlabel -e da0s1"
3698fae3551SRodney W. Grimes.Pp
37057dfbec5SPoul-Henning KampRead the label for
371ff7d5162SJordan K. Hubbard.Pa da0s1 ,
37257dfbec5SPoul-Henning Kampedit it, and install the result.
3738fae3551SRodney W. Grimes.Pp
37457dfbec5SPoul-Henning Kamp.Dl "bsdlabel -e -n da0s1"
3753233afaeSJohn W. De Boskey.Pp
3763233afaeSJohn W. De BoskeyRead the on-disk label for
3773233afaeSJohn W. De Boskey.Pa da0s1 ,
3789a9f19b1SRuslan Ermilovedit it, and display what the new label would be (in sectors).
3799a9f19b1SRuslan ErmilovIt does
3809a9f19b1SRuslan Ermilov.Em not
3819a9f19b1SRuslan Ermilovinstall the new label either in-core or on-disk.
3823233afaeSJohn W. De Boskey.Pp
38357dfbec5SPoul-Henning Kamp.Dl "bsdlabel -w da0s1"
384425bed3aSJoerg Wunsch.Pp
38557dfbec5SPoul-Henning KampWrite a default label on
38657dfbec5SPoul-Henning Kamp.Pa da0s1 .
3879a9f19b1SRuslan ErmilovUse another
3889a9f19b1SRuslan Ermilov.Nm Fl e
3899a9f19b1SRuslan Ermilovcommand to edit the
390425bed3aSJoerg Wunschpartitioning and file system information.
391425bed3aSJoerg Wunsch.Pp
3922c60b668SPoul-Henning Kamp.Dl "bsdlabel -R da0s1 savedlabel"
3938fae3551SRodney W. Grimes.Pp
3944cbdc634SGreg LeheyRestore the on-disk and in-core label for
395ff7d5162SJordan K. Hubbard.Pa da0s1
3964cbdc634SGreg Leheyfrom information in
3974cbdc634SGreg Lehey.Pa savedlabel .
3988fae3551SRodney W. Grimes.Pp
3992c60b668SPoul-Henning Kamp.Dl "bsdlabel -R -n da0s1 label_layout"
4003233afaeSJohn W. De Boskey.Pp
4013233afaeSJohn W. De BoskeyDisplay what the label would be for
4023233afaeSJohn W. De Boskey.Pa da0s1
4033233afaeSJohn W. De Boskeyusing the partition layout in
4043233afaeSJohn W. De Boskey.Pa label_layout .
4053233afaeSJohn W. De BoskeyThis is useful for determining how much space would be alloted for various
4067733674eSRuslan Ermilovpartitions with a labelling scheme using
4077733674eSRuslan Ermilov.Cm % Ns -based
4087733674eSRuslan Ermilovor
4097733674eSRuslan Ermilov.Cm *
4107733674eSRuslan Ermilovpartition sizes.
4113233afaeSJohn W. De Boskey.Pp
4122c60b668SPoul-Henning Kamp.Dl "bsdlabel -B da0s1"
4138fae3551SRodney W. Grimes.Pp
4144cbdc634SGreg LeheyInstall a new bootstrap on
415ff7d5162SJordan K. Hubbard.Pa da0s1 .
4168fae3551SRodney W. GrimesThe boot code comes from
4178d48318bSPoul-Henning Kamp.Pa /boot/boot .
4188fae3551SRodney W. Grimes.Pp
41957dfbec5SPoul-Henning Kamp.Dl "bsdlabel -w -B -b newboot /dev/da0s1"
4208fae3551SRodney W. Grimes.Pp
4218fae3551SRodney W. GrimesInstall a new label and bootstrap.
4229a9f19b1SRuslan ErmilovThe bootstrap code comes from the file
4239a9f19b1SRuslan Ermilov.Pa newboot
4249a9f19b1SRuslan Ermilovin the current working directory.
4259a9f19b1SRuslan Ermilov.Bd -literal -offset indent
4269a9f19b1SRuslan Ermilovdd if=/dev/zero of=/dev/da0 bs=512 count=32
4279a9f19b1SRuslan Ermilovfdisk -BI da0
4289a9f19b1SRuslan Ermilovdd if=/dev/zero of=/dev/da0s1 bs=512 count=32
42957dfbec5SPoul-Henning Kampbsdlabel -w -B da0s1
4302c60b668SPoul-Henning Kampbsdlabel -e da0s1
4319a9f19b1SRuslan Ermilov.Ed
432ff7d5162SJordan K. Hubbard.Pp
433ff7d5162SJordan K. HubbardCompletely wipe any prior information on the disk, creating a new bootable
4349a9f19b1SRuslan Ermilovdisk with a
4359a9f19b1SRuslan Ermilov.Tn DOS
4369a9f19b1SRuslan Ermilovpartition table containing one slice, covering the whole disk.
4379a9f19b1SRuslan ErmilovInitialize the label on this slice,
4389a9f19b1SRuslan Ermilovthen edit it.
4399a9f19b1SRuslan ErmilovThe
4409a9f19b1SRuslan Ermilov.Xr dd 1
4419a9f19b1SRuslan Ermilovcommands are optional, but may be necessary for some
4429a9f19b1SRuslan Ermilov.Tn BIOS Ns es
4439a9f19b1SRuslan Ermilovto properly
444ff7d5162SJordan K. Hubbardrecognize the disk.
4453233afaeSJohn W. De Boskey.Pp
4463233afaeSJohn W. De BoskeyThis is an example disk label that uses some of the new partition size types
4477733674eSRuslan Ermilovsuch as
4487733674eSRuslan Ermilov.Cm % , M , G ,
4497733674eSRuslan Ermilovand
4507733674eSRuslan Ermilov.Cm * ,
4517733674eSRuslan Ermilovwhich could be used as a source file for
4522c60b668SPoul-Henning Kamp.Dq Li "bsdlabel -R ad0s1c new_label_file" :
4533233afaeSJohn W. De Boskey.Bd -literal -offset 4n
4543233afaeSJohn W. De Boskey# /dev/ad0s1c:
4553233afaeSJohn W. De Boskey
4563233afaeSJohn W. De Boskey8 partitions:
4573233afaeSJohn W. De Boskey#        size   offset    fstype   [fsize bsize bps/cpg]
4583233afaeSJohn W. De Boskey  a:   400M        0    4.2BSD     4096 16384    75 	# (Cyl.    0 - 812*)
4593233afaeSJohn W. De Boskey  b:     1G        *      swap
4603233afaeSJohn W. De Boskey  c:      *        *    unused
4613233afaeSJohn W. De Boskey  e: 204800        *    4.2BSD
4623233afaeSJohn W. De Boskey  f:     5g        *    4.2BSD
4633233afaeSJohn W. De Boskey  g:      *        *    4.2BSD
4643233afaeSJohn W. De Boskey.Ed
4658fae3551SRodney W. Grimes.Sh SEE ALSO
46670e48365SGreg Lehey.Xr ccd 4 ,
467734ac3b5SRuslan Ermilov.Xr geom 4 ,
4689a9f19b1SRuslan Ermilov.Xr md 4 ,
469734ac3b5SRuslan Ermilov.\" Xr bsdlabel 5 ,
4704cbdc634SGreg Lehey.Xr disktab 5 ,
471aa7c9adaSMike Pritchard.Xr boot0cfg 8 ,
47257dfbec5SPoul-Henning Kamp.Xr fdisk 8
4738fae3551SRodney W. Grimes.Sh DIAGNOSTICS
4748fae3551SRodney W. GrimesThe kernel device drivers will not allow the size of a disk partition
4758fae3551SRodney W. Grimesto be decreased or the offset of a partition to be changed while it is open.
476