1994-05-26 06:35:07 +00:00
|
|
|
.\" Copyright (c) 1987, 1988, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
|
|
.\" Symmetric Computer Systems.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2017-02-28 23:42:47 +00:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1994-05-26 06:35:07 +00:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1994-05-26 06:35:07 +00:00
|
|
|
.\"
|
2016-10-05 19:56:10 +00:00
|
|
|
.Dd October 5, 2016
|
2003-04-18 19:44:12 +00:00
|
|
|
.Dt BSDLABEL 8
|
2001-07-10 11:04:34 +00:00
|
|
|
.Os
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh NAME
|
2003-04-18 19:44:12 +00:00
|
|
|
.Nm bsdlabel
|
2006-10-12 20:29:20 +00:00
|
|
|
.Nd read and write BSD label
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2003-05-03 09:58:20 +00:00
|
|
|
.Op Fl A
|
2004-05-17 08:35:43 +00:00
|
|
|
.Ar disk | Fl f Ar file
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl w
|
2003-05-24 19:53:08 +00:00
|
|
|
.Op Fl \&An
|
2003-05-03 09:58:20 +00:00
|
|
|
.Op Fl B Op Fl b Ar boot
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
2004-05-17 08:35:43 +00:00
|
|
|
.Ar disk | Fl f Ar file
|
2003-05-03 09:58:20 +00:00
|
|
|
.Op Ar type
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl e
|
2003-05-24 19:53:08 +00:00
|
|
|
.Op Fl \&An
|
2003-05-03 09:58:20 +00:00
|
|
|
.Op Fl B Op Fl b Ar boot
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
2004-05-17 08:35:43 +00:00
|
|
|
.Ar disk | Fl f Ar file
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl R
|
2003-05-24 19:53:08 +00:00
|
|
|
.Op Fl \&An
|
2003-05-03 09:58:20 +00:00
|
|
|
.Op Fl B Op Fl b Ar boot
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
2004-03-30 23:15:03 +00:00
|
|
|
.Op Fl f
|
2004-05-17 08:35:43 +00:00
|
|
|
.Ar disk | Fl f Ar file
|
|
|
|
.Ar protofile
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-07-06 19:34:18 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility
|
2003-05-24 19:53:08 +00:00
|
|
|
installs, examines or modifies the
|
|
|
|
.Bx
|
2004-03-30 23:15:03 +00:00
|
|
|
label on a disk partition, or on a file containing a partition image.
|
2003-03-15 22:00:45 +00:00
|
|
|
In addition,
|
1998-06-04 06:49:13 +00:00
|
|
|
.Nm
|
1999-07-31 08:11:58 +00:00
|
|
|
can install bootstrap code.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Disk Device Name
|
2004-05-17 08:35:43 +00:00
|
|
|
When specifying the device (i.e., when the
|
2004-03-30 23:15:03 +00:00
|
|
|
.Fl f
|
2004-05-17 08:35:43 +00:00
|
|
|
option is not used),
|
2003-03-15 22:00:45 +00:00
|
|
|
the
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa /dev/
|
2003-03-15 22:00:45 +00:00
|
|
|
path prefix may be omitted;
|
|
|
|
the
|
1999-07-31 08:11:58 +00:00
|
|
|
.Nm
|
2002-07-06 19:34:18 +00:00
|
|
|
utility will automatically prepend it.
|
2003-05-24 19:53:08 +00:00
|
|
|
.Ss General Options
|
|
|
|
The
|
2003-05-03 09:58:20 +00:00
|
|
|
.Fl A
|
2003-05-24 19:53:08 +00:00
|
|
|
option enables processing of the historical parts of the
|
|
|
|
.Bx
|
|
|
|
label.
|
2003-05-03 09:58:20 +00:00
|
|
|
If the option is not given, suitable values are set for these fields.
|
|
|
|
.Pp
|
|
|
|
The
|
2004-03-30 23:15:03 +00:00
|
|
|
.Fl f
|
|
|
|
option tells
|
|
|
|
.Nm
|
|
|
|
that the program will operate on a file instead of a disk partition.
|
|
|
|
.Pp
|
|
|
|
The
|
2003-05-03 09:58:20 +00:00
|
|
|
.Fl n
|
2004-03-30 23:15:03 +00:00
|
|
|
option stops the
|
2003-05-03 09:58:20 +00:00
|
|
|
.Nm
|
|
|
|
program right before the disk would have been modified, and displays
|
|
|
|
the result instead of writing it.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fl m Ar machine
|
2005-09-17 15:10:39 +00:00
|
|
|
argument forces
|
2003-05-03 09:58:20 +00:00
|
|
|
.Nm
|
2005-09-17 15:10:39 +00:00
|
|
|
to use a layout suitable for a different architecture.
|
|
|
|
Current valid values are
|
2017-01-28 02:22:15 +00:00
|
|
|
.Cm i386
|
2005-09-17 15:10:39 +00:00
|
|
|
and
|
2017-01-28 02:22:15 +00:00
|
|
|
.Cm amd64 .
|
2005-09-17 15:10:39 +00:00
|
|
|
If this option is omitted,
|
|
|
|
.Nm
|
|
|
|
will use a layout suitable for the current machine.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Reading the Disk Label
|
2006-12-29 16:28:38 +00:00
|
|
|
To examine the label on a disk drive, use the form
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2003-05-03 09:58:20 +00:00
|
|
|
.Op Fl A
|
|
|
|
.Op Fl m Ar machine
|
1999-07-31 08:11:58 +00:00
|
|
|
.Ar disk
|
|
|
|
.Pp
|
|
|
|
.Ar disk
|
2003-05-03 09:58:20 +00:00
|
|
|
represents the disk in question, and may be in the form
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pa da0
|
|
|
|
or
|
2003-05-03 09:58:20 +00:00
|
|
|
.Pa /dev/da0 .
|
|
|
|
It will display the partition layout.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Writing a Standard Label
|
1999-07-31 08:11:58 +00:00
|
|
|
To write a standard label, use the form
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl w
|
2003-05-24 19:53:08 +00:00
|
|
|
.Op Fl \&An
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
2003-05-03 09:58:20 +00:00
|
|
|
.Ar disk
|
|
|
|
.Op Ar type
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
If the drive
|
|
|
|
.Ar type
|
|
|
|
is specified, the entry of that name in the
|
2001-02-01 16:38:02 +00:00
|
|
|
.Xr disktab 5
|
2007-12-08 23:41:13 +00:00
|
|
|
file is used; otherwise, or if the type is specified as 'auto', a default
|
2007-12-08 19:57:22 +00:00
|
|
|
layout is used.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Editing an Existing Disk Label
|
1999-07-31 08:11:58 +00:00
|
|
|
To edit an existing disk label, use the form
|
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl e
|
2003-05-24 19:53:08 +00:00
|
|
|
.Op Fl \&An
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
1999-07-31 08:11:58 +00:00
|
|
|
.Ar disk
|
|
|
|
.Pp
|
2003-05-24 19:53:08 +00:00
|
|
|
This command opens the disk label in the default editor, and when the editor
|
|
|
|
exits, the label is validated and if OK written to disk.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Restoring a Disk Label From a File
|
1999-07-31 08:11:58 +00:00
|
|
|
To restore a disk label from a file, use the form
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl R
|
2003-05-24 19:53:08 +00:00
|
|
|
.Op Fl \&An
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ar disk protofile
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
The
|
1998-06-04 06:49:13 +00:00
|
|
|
.Nm
|
2006-12-29 16:28:38 +00:00
|
|
|
utility
|
2003-03-15 22:00:45 +00:00
|
|
|
is capable of restoring a disk label that was previously saved in a file in
|
|
|
|
.Tn ASCII
|
|
|
|
format.
|
1999-07-31 08:11:58 +00:00
|
|
|
The prototype file used to create the label should be in the same format as that
|
2003-03-15 22:00:45 +00:00
|
|
|
produced when reading or editing a label.
|
|
|
|
Comments are delimited by
|
|
|
|
.Ql #
|
|
|
|
and newline.
|
|
|
|
.Ss Installing Bootstraps
|
2003-03-16 00:11:49 +00:00
|
|
|
If the
|
2003-05-03 09:58:20 +00:00
|
|
|
.Fl B
|
2006-12-29 16:28:38 +00:00
|
|
|
option is specified, bootstrap code will be read from the file
|
2003-02-23 01:48:42 +00:00
|
|
|
.Pa /boot/boot
|
2003-05-03 09:58:20 +00:00
|
|
|
and written to the disk.
|
|
|
|
The
|
|
|
|
.Fl b Ar boot
|
2006-12-29 16:28:38 +00:00
|
|
|
option allows a different file to be used.
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh FILES
|
2003-02-23 01:48:42 +00:00
|
|
|
.Bl -tag -width ".Pa /etc/disktab" -compact
|
|
|
|
.It Pa /boot/boot
|
|
|
|
Default boot image.
|
1994-05-26 06:35:07 +00:00
|
|
|
.It Pa /etc/disktab
|
2003-02-23 01:48:42 +00:00
|
|
|
Disk description file.
|
1994-05-26 06:35:07 +00:00
|
|
|
.El
|
1999-07-31 08:11:58 +00:00
|
|
|
.Sh SAVED FILE FORMAT
|
2002-07-06 19:34:18 +00:00
|
|
|
The
|
1999-07-31 08:11:58 +00:00
|
|
|
.Nm
|
2002-07-06 19:34:18 +00:00
|
|
|
utility
|
2003-03-15 22:00:45 +00:00
|
|
|
uses an
|
|
|
|
.Tn ASCII
|
|
|
|
version of the label when examining, editing, or restoring a disk
|
|
|
|
label.
|
|
|
|
The format is:
|
1999-07-31 08:11:58 +00:00
|
|
|
.Bd -literal -offset 4n
|
2003-05-03 09:58:20 +00:00
|
|
|
|
|
|
|
8 partitions:
|
|
|
|
# size offset fstype [fsize bsize bps/cpg]
|
2006-10-13 15:44:29 +00:00
|
|
|
a: 81920 16 4.2BSD 2048 16384 5128
|
|
|
|
b: 1091994 81936 swap
|
2003-05-03 09:58:20 +00:00
|
|
|
c: 1173930 0 unused 0 0 # "raw" part, don't edit
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl A
|
|
|
|
option is specified, the format is:
|
|
|
|
.Bd -literal -offset 4n
|
2000-04-26 11:24:44 +00:00
|
|
|
# /dev/da1c:
|
1999-07-31 08:11:58 +00:00
|
|
|
type: SCSI
|
2000-04-26 11:24:44 +00:00
|
|
|
disk: da0s1
|
2001-07-15 07:53:42 +00:00
|
|
|
label:
|
1999-07-31 08:11:58 +00:00
|
|
|
flags:
|
|
|
|
bytes/sector: 512
|
|
|
|
sectors/track: 51
|
|
|
|
tracks/cylinder: 19
|
|
|
|
sectors/cylinder: 969
|
|
|
|
cylinders: 1211
|
|
|
|
sectors/unit: 1173930
|
|
|
|
rpm: 3600
|
|
|
|
interleave: 1
|
|
|
|
trackskew: 0
|
|
|
|
cylinderskew: 0
|
|
|
|
headswitch: 0 # milliseconds
|
|
|
|
track-to-track seek: 0 # milliseconds
|
2001-07-15 07:53:42 +00:00
|
|
|
drivedata: 0
|
1999-07-31 08:11:58 +00:00
|
|
|
|
|
|
|
8 partitions:
|
|
|
|
# size offset fstype [fsize bsize bps/cpg]
|
2006-03-04 12:09:50 +00:00
|
|
|
a: 81920 16 4.2BSD 1024 8192 16
|
|
|
|
b: 160000 81936 swap
|
2003-05-03 09:58:20 +00:00
|
|
|
c: 1173930 0 unused 0 0 # "raw" part, don't edit
|
1999-07-31 08:11:58 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
Lines starting with a
|
|
|
|
.Ql #
|
|
|
|
mark are comments.
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
The partition table can have up to 8 entries.
|
|
|
|
It contains the following information:
|
|
|
|
.Bl -tag -width indent
|
|
|
|
.It Ar #
|
1999-07-31 08:11:58 +00:00
|
|
|
The partition identifier is a single letter in the range
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql a
|
1999-07-31 08:11:58 +00:00
|
|
|
to
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql h .
|
1999-07-31 08:11:58 +00:00
|
|
|
By convention, partition
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql c
|
1999-07-31 08:11:58 +00:00
|
|
|
is reserved to describe the entire disk.
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar size
|
|
|
|
The size of the partition in sectors,
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm K
|
2001-02-25 16:47:44 +00:00
|
|
|
(kilobytes - 1024),
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm M
|
2001-02-25 16:47:44 +00:00
|
|
|
(megabytes - 1024*1024),
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm G
|
2001-02-25 16:47:44 +00:00
|
|
|
(gigabytes - 1024*1024*1024),
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm %
|
2003-03-15 22:00:45 +00:00
|
|
|
(percentage of free space
|
|
|
|
.Em after
|
|
|
|
removing any fixed-size partitions other than partition
|
|
|
|
.Ql c ) ,
|
2001-03-05 15:33:54 +00:00
|
|
|
or
|
|
|
|
.Cm *
|
2003-03-15 22:00:45 +00:00
|
|
|
(all remaining free space
|
|
|
|
.Em after
|
|
|
|
fixed-size and percentage partitions).
|
|
|
|
For partition
|
|
|
|
.Ql c ,
|
2001-03-05 15:33:54 +00:00
|
|
|
a size of
|
|
|
|
.Cm *
|
2003-03-15 22:00:45 +00:00
|
|
|
indicates the entire disk.
|
2006-12-29 16:28:38 +00:00
|
|
|
Lowercase versions of suffixes
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm K , M ,
|
|
|
|
and
|
|
|
|
.Cm G
|
2001-02-25 16:47:44 +00:00
|
|
|
are allowed.
|
2006-12-29 16:28:38 +00:00
|
|
|
Size and suffix should be specified without any spaces between them.
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
Example: 2097152, 1G, 1024M and 1048576K are all the same size
|
2001-02-25 16:47:44 +00:00
|
|
|
(assuming 512-byte sectors).
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar offset
|
|
|
|
The offset of the start of the partition from the beginning of the
|
2001-03-05 15:33:54 +00:00
|
|
|
drive in sectors, or
|
|
|
|
.Cm *
|
|
|
|
to have
|
2001-02-25 16:47:44 +00:00
|
|
|
.Nm
|
|
|
|
calculate the correct offset to use (the end of the previous partition plus
|
|
|
|
one, ignoring partition
|
2006-12-29 16:28:38 +00:00
|
|
|
.Ql c ) .
|
2001-02-25 16:47:44 +00:00
|
|
|
For partition
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql c ,
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm *
|
|
|
|
will be interpreted as an offset of 0.
|
2006-03-08 14:17:26 +00:00
|
|
|
The first partition should start at offset 16, because the first 16 sectors are
|
|
|
|
reserved for metadata.
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar fstype
|
|
|
|
Describes the purpose of the partition.
|
2006-12-29 16:28:38 +00:00
|
|
|
The above example shows all currently used partition types.
|
2003-03-15 22:00:45 +00:00
|
|
|
For
|
|
|
|
.Tn UFS
|
|
|
|
file systems and
|
|
|
|
.Xr ccd 4
|
|
|
|
partitions, use type
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm 4.2BSD .
|
2001-05-14 23:26:40 +00:00
|
|
|
For Vinum drives, use type
|
|
|
|
.Cm vinum .
|
2001-02-25 16:47:44 +00:00
|
|
|
Other common types are
|
2003-03-15 22:00:45 +00:00
|
|
|
.Cm swap
|
2001-02-25 16:47:44 +00:00
|
|
|
and
|
2003-03-15 22:00:45 +00:00
|
|
|
.Cm unused .
|
2001-05-15 16:03:59 +00:00
|
|
|
By convention, partition
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql c
|
2001-05-15 16:03:59 +00:00
|
|
|
represents the entire slice and should be of type
|
2001-05-14 23:26:40 +00:00
|
|
|
.Cm unused ,
|
|
|
|
though
|
|
|
|
.Nm
|
|
|
|
does not enforce this convention.
|
2002-07-06 19:34:18 +00:00
|
|
|
The
|
2001-05-14 23:26:40 +00:00
|
|
|
.Nm
|
2002-07-06 19:34:18 +00:00
|
|
|
utility
|
2003-03-15 22:00:45 +00:00
|
|
|
also knows about a number of other partition types,
|
|
|
|
none of which are in current use.
|
|
|
|
(See the definitions starting with
|
2001-05-15 16:03:59 +00:00
|
|
|
.Dv FS_UNUSED
|
|
|
|
in
|
2003-09-08 19:57:22 +00:00
|
|
|
.In sys/disklabel.h
|
2003-03-15 22:00:45 +00:00
|
|
|
for more details.)
|
|
|
|
.It Ar fsize
|
2001-02-25 16:47:44 +00:00
|
|
|
For
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm 4.2BSD
|
2006-10-13 15:44:29 +00:00
|
|
|
file systems only, the fragment size; see
|
|
|
|
.Xr newfs 8 .
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar bsize
|
2001-02-25 16:47:44 +00:00
|
|
|
For
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm 4.2BSD
|
2006-10-13 15:44:29 +00:00
|
|
|
file systems only, the block size; see
|
|
|
|
.Xr newfs 8 .
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar bps/cpg
|
2001-02-25 16:47:44 +00:00
|
|
|
For
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm 4.2BSD
|
2006-10-13 15:44:29 +00:00
|
|
|
file systems, the number of cylinders in a cylinder group; see
|
|
|
|
.Xr newfs 8 .
|
1999-07-31 08:11:58 +00:00
|
|
|
.El
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh EXAMPLES
|
2003-05-03 09:58:20 +00:00
|
|
|
Display the label for the first slice of the
|
2003-03-15 22:00:45 +00:00
|
|
|
.Pa da0
|
|
|
|
disk, as obtained via
|
2006-12-29 16:28:38 +00:00
|
|
|
.Pa /dev/da0s1 :
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel da0s1"
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Save the in-core label for
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0s1
|
1999-07-31 08:11:58 +00:00
|
|
|
into the file
|
|
|
|
.Pa savedlabel .
|
|
|
|
This file can be used with the
|
|
|
|
.Fl R
|
2006-12-29 16:28:38 +00:00
|
|
|
option to restore the label at a later date:
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel da0s1 > savedlabel"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Create a label for
|
2006-12-29 16:28:38 +00:00
|
|
|
.Pa da0s1 :
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel -w /dev/da0s1"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2003-05-03 09:58:20 +00:00
|
|
|
Read the label for
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0s1 ,
|
2006-12-29 16:28:38 +00:00
|
|
|
edit it, and install the result:
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel -e da0s1"
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Read the on-disk label for
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pa da0s1 ,
|
2003-03-15 22:00:45 +00:00
|
|
|
edit it, and display what the new label would be (in sectors).
|
|
|
|
It does
|
|
|
|
.Em not
|
2006-12-29 16:28:38 +00:00
|
|
|
install the new label either in-core or on-disk:
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel -e -n da0s1"
|
1996-01-22 01:01:15 +00:00
|
|
|
.Pp
|
2003-05-03 09:58:20 +00:00
|
|
|
Write a default label on
|
|
|
|
.Pa da0s1 .
|
2003-03-15 22:00:45 +00:00
|
|
|
Use another
|
|
|
|
.Nm Fl e
|
|
|
|
command to edit the
|
2006-12-29 16:28:38 +00:00
|
|
|
partitioning and file system information:
|
1996-01-22 01:01:15 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel -w da0s1"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Restore the on-disk and in-core label for
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0s1
|
1999-07-31 08:11:58 +00:00
|
|
|
from information in
|
2006-12-29 16:28:38 +00:00
|
|
|
.Pa savedlabel :
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel -R da0s1 savedlabel"
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Display what the label would be for
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pa da0s1
|
|
|
|
using the partition layout in
|
|
|
|
.Pa label_layout .
|
2004-09-09 07:46:53 +00:00
|
|
|
This is useful for determining how much space would be allotted for various
|
|
|
|
partitions with a labeling scheme using
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm % Ns -based
|
|
|
|
or
|
|
|
|
.Cm *
|
2006-12-29 16:28:38 +00:00
|
|
|
partition sizes:
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel -R -n da0s1 label_layout"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Install a new bootstrap on
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0s1 .
|
1994-05-26 06:35:07 +00:00
|
|
|
The boot code comes from
|
2006-12-29 16:28:38 +00:00
|
|
|
.Pa /boot/boot :
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2006-12-29 16:28:38 +00:00
|
|
|
.Dl "bsdlabel -B da0s1"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
|
|
|
Install a new label and bootstrap.
|
2003-03-15 22:00:45 +00:00
|
|
|
The bootstrap code comes from the file
|
|
|
|
.Pa newboot
|
2006-12-29 16:28:38 +00:00
|
|
|
in the current working directory:
|
|
|
|
.Pp
|
|
|
|
.Dl "bsdlabel -w -B -b newboot /dev/da0s1"
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pp
|
|
|
|
Completely wipe any prior information on the disk, creating a new bootable
|
2003-03-15 22:00:45 +00:00
|
|
|
disk with a
|
|
|
|
.Tn DOS
|
|
|
|
partition table containing one slice, covering the whole disk.
|
|
|
|
Initialize the label on this slice,
|
|
|
|
then edit it.
|
|
|
|
The
|
|
|
|
.Xr dd 1
|
|
|
|
commands are optional, but may be necessary for some
|
|
|
|
.Tn BIOS Ns es
|
|
|
|
to properly
|
2006-12-29 16:28:38 +00:00
|
|
|
recognize the disk:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
dd if=/dev/zero of=/dev/da0 bs=512 count=32
|
2015-09-02 14:08:43 +00:00
|
|
|
gpart create -s MBR da0
|
|
|
|
gpart add -t freebsd da0
|
|
|
|
gpart set -a active -i 1 da0
|
|
|
|
gpart bootcode -b /boot/mbr da0
|
2006-12-29 16:28:38 +00:00
|
|
|
dd if=/dev/zero of=/dev/da0s1 bs=512 count=32
|
|
|
|
bsdlabel -w -B da0s1
|
|
|
|
bsdlabel -e da0s1
|
|
|
|
.Ed
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
This is an example disk label that uses some of the new partition size types
|
2001-03-05 15:33:54 +00:00
|
|
|
such as
|
|
|
|
.Cm % , M , G ,
|
|
|
|
and
|
|
|
|
.Cm * ,
|
|
|
|
which could be used as a source file for
|
2013-10-01 18:41:53 +00:00
|
|
|
.Dq Li "bsdlabel -R ada0s1 new_label_file" :
|
2001-02-25 16:47:44 +00:00
|
|
|
.Bd -literal -offset 4n
|
2013-10-01 18:41:53 +00:00
|
|
|
# /dev/ada0s1:
|
2001-02-25 16:47:44 +00:00
|
|
|
|
|
|
|
8 partitions:
|
|
|
|
# size offset fstype [fsize bsize bps/cpg]
|
2016-10-05 19:56:10 +00:00
|
|
|
a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*)
|
2001-07-15 07:53:42 +00:00
|
|
|
b: 1G * swap
|
|
|
|
c: * * unused
|
|
|
|
e: 204800 * 4.2BSD
|
|
|
|
f: 5g * 4.2BSD
|
|
|
|
g: * * 4.2BSD
|
2001-02-25 16:47:44 +00:00
|
|
|
.Ed
|
2004-09-09 07:46:53 +00:00
|
|
|
.Sh DIAGNOSTICS
|
|
|
|
The kernel device drivers will not allow the size of a disk partition
|
|
|
|
to be decreased or the offset of a partition to be changed while it is open.
|
|
|
|
.Sh COMPATIBILITY
|
|
|
|
Due to the use of an
|
2012-02-12 18:29:56 +00:00
|
|
|
.Vt uint32_t
|
2004-09-09 07:46:53 +00:00
|
|
|
to store the number of sectors,
|
2005-01-10 16:17:34 +00:00
|
|
|
.Bx
|
|
|
|
labels are restricted to a maximum of 2^32-1 sectors.
|
2004-09-09 07:46:53 +00:00
|
|
|
This usually means 2TB of disk space.
|
|
|
|
Larger disks should be partitioned using another method such as
|
2008-11-05 09:28:30 +00:00
|
|
|
.Xr gpart 8 .
|
2004-09-09 07:46:53 +00:00
|
|
|
.Pp
|
2005-01-10 16:17:34 +00:00
|
|
|
The various
|
|
|
|
.Bx Ns s
|
|
|
|
all use slightly different versions of
|
|
|
|
.Bx
|
|
|
|
labels and
|
2004-09-09 07:46:53 +00:00
|
|
|
are not generally compatible.
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh SEE ALSO
|
2001-05-14 23:26:40 +00:00
|
|
|
.Xr ccd 4 ,
|
2003-05-24 19:53:08 +00:00
|
|
|
.Xr geom 4 ,
|
2003-03-15 22:00:45 +00:00
|
|
|
.Xr md 4 ,
|
1999-07-31 08:11:58 +00:00
|
|
|
.Xr disktab 5 ,
|
1999-08-15 08:06:12 +00:00
|
|
|
.Xr boot0cfg 8 ,
|
2008-11-05 09:27:13 +00:00
|
|
|
.Xr gpart 8 ,
|
2006-10-13 15:44:29 +00:00
|
|
|
.Xr newfs 8
|
2016-10-05 19:56:10 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm disklabel
|
|
|
|
utility appeared in
|
|
|
|
.Bx 4.3 Tahoe .
|