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.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
1998-06-04 06:49:13 +00:00
|
|
|
.\" must display the following acknowledgment:
|
1994-05-26 06:35:07 +00:00
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" 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
|
|
|
.\"
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dd March 15, 2003
|
1994-05-26 06:35:07 +00:00
|
|
|
.Dt DISKLABEL 8
|
2001-07-10 11:04:34 +00:00
|
|
|
.Os
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm disklabel
|
|
|
|
.Nd read and write disk pack label
|
|
|
|
.Sh SYNOPSIS
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Op Fl r
|
|
|
|
.Ar disk
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl w
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl nr
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
|
|
|
.Ar disk type
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Ar packid
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl e
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl nr
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
1994-05-26 06:35:07 +00:00
|
|
|
.Ar disk
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl R
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl nr
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ar disk protofile
|
2000-11-10 17:46:15 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl B
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl b Ar boot
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
1994-05-26 06:35:07 +00:00
|
|
|
.Ar disk
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
.Fl w B
|
2001-02-25 16:47:44 +00:00
|
|
|
.Op Fl n
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl b Ar boot
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
|
|
|
.Ar disk type
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Ar packid
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
.Fl R B
|
2001-02-25 16:47:44 +00:00
|
|
|
.Op Fl n
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl b Ar boot
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ar disk protofile
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-07-06 19:34:18 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility
|
2003-03-15 22:00:45 +00:00
|
|
|
installs, examines or modifies the label on a disk drive or pack.
|
|
|
|
When writing
|
1999-07-31 08:11:58 +00:00
|
|
|
the label, it can be used to change the drive identification, the disk
|
2003-03-15 22:00:45 +00:00
|
|
|
partitions on the drive, or to replace a damaged label.
|
|
|
|
There are several forms
|
|
|
|
of the command that read (display), install, or edit the label on a disk.
|
|
|
|
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 Raw or In-Core Label
|
2002-04-15 22:24:34 +00:00
|
|
|
The disk label resides close to or at the beginning of each disk slice.
|
2003-03-15 22:00:45 +00:00
|
|
|
For faster access, the kernel maintains a copy in core at all times.
|
|
|
|
By default, most
|
1999-07-31 08:11:58 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
access the in-core copy of the label.
|
|
|
|
To access the raw (on-disk) copy, use the
|
1999-07-31 08:11:58 +00:00
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
option.
|
|
|
|
This option allows a label to be installed on a disk without kernel
|
1999-07-31 08:11:58 +00:00
|
|
|
support for a label, such as when labels are first installed on a system; it
|
2003-03-15 22:00:45 +00:00
|
|
|
must be used when first installing a label on a disk.
|
|
|
|
The specific effect of
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl r
|
|
|
|
is described under each command.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Disk Device Name
|
2001-07-15 07:53:42 +00:00
|
|
|
All
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1999-07-31 08:11:58 +00:00
|
|
|
forms require a disk device name, which should always be the raw
|
2003-03-15 22:00:45 +00:00
|
|
|
device name representing the disk or slice.
|
|
|
|
For example,
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0
|
2003-03-15 22:00:45 +00:00
|
|
|
represents the entire disk regardless of any
|
|
|
|
.Tn DOS
|
|
|
|
partitioning,
|
2000-10-31 07:07:39 +00:00
|
|
|
and
|
|
|
|
.Pa da0s1
|
2003-03-15 22:00:45 +00:00
|
|
|
represents a slice.
|
|
|
|
Some devices, most notably
|
|
|
|
.Xr ccd 4 ,
|
2000-10-31 07:07:39 +00:00
|
|
|
require that the
|
2000-11-10 17:46:15 +00:00
|
|
|
.Dq whole-disk
|
|
|
|
(or
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql c )
|
|
|
|
partition be specified.
|
|
|
|
For example,
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa ccd0c .
|
2003-03-15 22:00:45 +00:00
|
|
|
When specifying the device,
|
|
|
|
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-03-15 22:00:45 +00:00
|
|
|
.Ss Reading the Disk Label
|
2002-01-07 06:45:17 +00:00
|
|
|
To examine the label on a disk drive, use
|
2001-07-15 07:53:42 +00:00
|
|
|
.Nm
|
1999-07-31 08:11:58 +00:00
|
|
|
without options:
|
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1999-07-31 08:11:58 +00:00
|
|
|
.Op Fl r
|
|
|
|
.Ar disk
|
|
|
|
.Pp
|
|
|
|
.Ar disk
|
|
|
|
represents the raw disk in question, and may be in the form
|
|
|
|
.Pa da0
|
|
|
|
or
|
2000-04-26 11:24:44 +00:00
|
|
|
.Pa /dev/da0c .
|
1999-07-31 08:11:58 +00:00
|
|
|
It will display all of the parameters associated with the drive and its
|
2003-03-15 22:00:45 +00:00
|
|
|
partition layout.
|
|
|
|
Unless the
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
option is given,
|
1994-05-26 06:35:07 +00:00
|
|
|
the kernel's in-core copy of the label is displayed;
|
|
|
|
if the disk has no label, or the partition types on the disk are incorrect,
|
|
|
|
the kernel may have constructed or modified the label.
|
|
|
|
If the
|
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
option is given,
|
1999-07-31 08:11:58 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
reads the label from the raw disk and displays it.
|
|
|
|
Both versions are usually
|
2000-10-31 07:07:39 +00:00
|
|
|
identical except in the case where a label has not yet been initialized or
|
|
|
|
is corrupt.
|
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-03-15 22:00:45 +00:00
|
|
|
.Op Fl nr
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
|
|
|
.Ar disk type
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Ar packid
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pp
|
1994-05-26 06:35:07 +00:00
|
|
|
The required arguments to
|
1998-06-04 06:49:13 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
are the drive to be labeled, and the drive type as described in the
|
|
|
|
.Xr disktab 5
|
|
|
|
file.
|
|
|
|
The drive parameters and partitions are taken from that file.
|
|
|
|
If different disks of the same physical type are to have different partitions,
|
|
|
|
it will be necessary to have separate
|
2001-02-01 16:38:02 +00:00
|
|
|
.Xr disktab 5
|
2003-03-15 22:00:45 +00:00
|
|
|
entries describing each, or to edit
|
|
|
|
the label after installation as described below.
|
|
|
|
The optional argument is a
|
|
|
|
pack identification string, up to 16 characters long.
|
|
|
|
The
|
|
|
|
.Ar packid
|
|
|
|
must be quoted if it contains blanks.
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2003-03-16 00:11:49 +00:00
|
|
|
If the
|
|
|
|
.Fl m
|
|
|
|
option is given, then label will be written so that
|
|
|
|
it is understood by the target
|
|
|
|
.Ar machine ;
|
|
|
|
defaults to the current hardware architecture.
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
If
|
2001-02-25 16:47:44 +00:00
|
|
|
.Fl n
|
2003-03-15 22:00:45 +00:00
|
|
|
is used, no data will be written to the device, and instead the
|
|
|
|
disk label that would have been written will be printed to standard output.
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
|
|
|
If the
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
option is given, the disk sectors containing the label and bootstrap
|
1994-05-26 06:35:07 +00:00
|
|
|
will be written directly.
|
|
|
|
A side-effect of this is that any existing bootstrap code will be overwritten
|
2003-03-15 22:00:45 +00:00
|
|
|
and the disk rendered unbootable.
|
|
|
|
See the boot options below for a method of
|
2003-03-16 00:11:49 +00:00
|
|
|
writing the and the bootstrap at the same time.
|
1994-05-26 06:35:07 +00:00
|
|
|
If
|
|
|
|
.Fl r
|
|
|
|
is not specified,
|
2003-03-15 22:00:45 +00:00
|
|
|
the existing label will be updated via the in-core copy, and any bootstrap
|
1994-05-26 06:35:07 +00:00
|
|
|
code will be unaffected.
|
|
|
|
If the disk does not already have a label, the
|
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
option must be used.
|
1994-05-26 06:35:07 +00:00
|
|
|
In either case, the kernel's in-core label is replaced.
|
|
|
|
.Pp
|
1996-01-22 01:01:15 +00:00
|
|
|
For a virgin disk that is not known to
|
|
|
|
.Xr disktab 5 ,
|
2003-03-16 00:11:49 +00:00
|
|
|
.Ar type
|
1996-01-22 01:01:15 +00:00
|
|
|
can be specified as
|
2003-03-14 09:38:54 +00:00
|
|
|
.Cm auto .
|
1996-01-22 01:01:15 +00:00
|
|
|
In this case, the driver is requested to produce a virgin label for the
|
2003-03-15 22:00:45 +00:00
|
|
|
disk.
|
|
|
|
This might or might not be successful, depending on whether the
|
1996-01-22 01:01:15 +00:00
|
|
|
driver for the disk is able to get the required data without reading
|
2003-03-15 22:00:45 +00:00
|
|
|
anything from the disk at all.
|
|
|
|
It will likely succeed for all
|
|
|
|
.Tn SCSI
|
|
|
|
disks, most
|
|
|
|
.Tn IDE
|
|
|
|
disks, and
|
|
|
|
.Cm vnode
|
|
|
|
type memory disks
|
|
|
|
.Pq Xr md 4 .
|
|
|
|
Writing a label to the
|
1996-01-22 01:01:15 +00:00
|
|
|
disk is the only supported operation, and the
|
|
|
|
.Ar disk
|
2003-03-15 22:00:45 +00:00
|
|
|
itself must be provided as the canonical name, i.e., not as a full
|
1996-01-22 01:01:15 +00:00
|
|
|
path name.
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pp
|
2001-02-25 16:47:44 +00:00
|
|
|
For most harddisks, a label based on percentages for most partitions (and
|
2001-03-05 15:33:54 +00:00
|
|
|
one partition with a size of
|
|
|
|
.Ql * )
|
|
|
|
will produce a reasonable configuration.
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
PC-based systems have special requirements in order for the
|
|
|
|
.Tn BIOS
|
|
|
|
to properly recognize a
|
2000-11-14 11:20:58 +00:00
|
|
|
.Fx
|
2003-03-15 22:00:45 +00:00
|
|
|
disk label.
|
|
|
|
Older systems may require what is known as a
|
|
|
|
.Dq dangerously-dedicated
|
|
|
|
disk label, which creates a fake
|
|
|
|
.Tn DOS
|
|
|
|
partition to work around problems older
|
|
|
|
.Tn BIOS Ns es
|
|
|
|
have with modern disk geometries.
|
|
|
|
On newer systems, a normal
|
|
|
|
.Tn DOS
|
|
|
|
partition should generally be created using
|
|
|
|
.Xr fdisk 8 ,
|
|
|
|
and then a
|
2000-11-14 11:20:58 +00:00
|
|
|
.Fx
|
2003-03-15 22:00:45 +00:00
|
|
|
disk label within that slice.
|
|
|
|
This is described later on in this page.
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
Installing a new disk label does not in of itself allow the system to boot
|
|
|
|
a kernel using that label.
|
|
|
|
Boot blocks must also be installed, which is
|
2000-10-31 07:07:39 +00:00
|
|
|
described later on in this manual page.
|
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-03-15 22:00:45 +00:00
|
|
|
.Op Fl nr
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
1999-07-31 08:11:58 +00:00
|
|
|
.Ar disk
|
|
|
|
.Pp
|
|
|
|
This command reads the label from the in-core kernel copy, or directly from the
|
|
|
|
disk if the
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
option is also specified.
|
|
|
|
The label is written to a file in
|
|
|
|
.Tn ASCII
|
|
|
|
format, and then supplied to an editor for changes.
|
|
|
|
If no editor is specified in the
|
1994-05-26 06:35:07 +00:00
|
|
|
.Ev EDITOR
|
|
|
|
environment variable,
|
|
|
|
.Xr vi 1
|
2003-03-15 22:00:45 +00:00
|
|
|
is used.
|
|
|
|
When the editor terminates, the label file is used to rewrite the disk label.
|
|
|
|
Existing bootstrap code is unchanged regardless of whether
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
was specified.
|
2003-03-16 00:11:49 +00:00
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl m
|
|
|
|
option is given, then the label will be written so that
|
|
|
|
it is understood by the target
|
|
|
|
.Ar machine ;
|
|
|
|
defaults to the current hardware architecture.
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
If
|
2001-02-25 16:47:44 +00:00
|
|
|
.Fl n
|
2003-03-15 22:00:45 +00:00
|
|
|
is used, no data will be written to the device, and instead the
|
|
|
|
disk label that would have been written will be printed to standard output.
|
|
|
|
This is
|
2001-02-25 16:47:44 +00:00
|
|
|
useful to see how a partitioning scheme will work out for a specific 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-03-15 22:00:45 +00:00
|
|
|
.Op Fl nr
|
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
|
1998-06-04 06:49:13 +00:00
|
|
|
.Nm
|
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.
|
|
|
|
As when writing a new label, any existing bootstrap code will be
|
1999-07-31 08:11:58 +00:00
|
|
|
clobbered if
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
is specified, and will be unaffected otherwise.
|
|
|
|
See the boot options below for a
|
1999-07-31 08:11:58 +00:00
|
|
|
method of restoring the label and writing the bootstrap at the same time.
|
2003-03-16 00:11:49 +00:00
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl m
|
|
|
|
option is given, then the label will be written so that
|
|
|
|
it is understood by the target
|
|
|
|
.Ar machine ;
|
|
|
|
defaults to the current hardware architecture.
|
|
|
|
.Pp
|
2001-02-25 16:47:44 +00:00
|
|
|
If
|
|
|
|
.Fl n
|
|
|
|
is used, no data will be written to the device, and instead the
|
2003-03-15 22:00:45 +00:00
|
|
|
disk label that would have been written will be printed to standard output.
|
|
|
|
This is
|
2001-02-25 16:47:44 +00:00
|
|
|
useful to see how a partitioning scheme will work out for a specific disk.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Installing Bootstraps
|
1994-05-26 06:35:07 +00:00
|
|
|
The final three forms of
|
1998-06-04 06:49:13 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
are used to install bootstrap code.
|
|
|
|
If a
|
2000-11-10 17:46:15 +00:00
|
|
|
.Dq dangerously-dedicated
|
2003-03-15 22:00:45 +00:00
|
|
|
disk is created for compatibility with older PC systems,
|
|
|
|
the raw disk name such as
|
|
|
|
.Pa da0
|
|
|
|
should be specified.
|
|
|
|
If an existing slice should be labeled,
|
|
|
|
the slice name such as
|
|
|
|
.Pa da0s1
|
|
|
|
should be specified,
|
|
|
|
and to make it bootable,
|
|
|
|
.Tn MBR
|
|
|
|
on the base disk should probably be updated; see
|
|
|
|
.Xr fdisk 8 .
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl B
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl b Ar boot
|
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-03-15 22:00:45 +00:00
|
|
|
This form installs the bootstrap only.
|
|
|
|
It does not change the disk label.
|
|
|
|
Never use this command on a base disk, such as
|
|
|
|
.Pa da0 ,
|
|
|
|
unless the intent is to create a
|
2000-11-10 17:46:15 +00:00
|
|
|
.Dq dangerously-dedicated
|
2003-03-15 22:00:45 +00:00
|
|
|
disk.
|
2001-07-15 07:53:42 +00:00
|
|
|
This command is typically run on a slice such as
|
2003-03-15 22:00:45 +00:00
|
|
|
.Pa da0s1 .
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2003-03-16 00:11:49 +00:00
|
|
|
The
|
|
|
|
.Fl m
|
|
|
|
option should be specified if the label was
|
|
|
|
created for a different hardware architecture,
|
|
|
|
.Ar machine .
|
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
.Fl w B
|
2001-02-25 16:47:44 +00:00
|
|
|
.Op Fl n
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl b Ar boot
|
2003-03-16 00:11:49 +00:00
|
|
|
.Op Fl m Ar machine
|
|
|
|
.Ar disk type
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Ar packid
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2000-11-10 17:46:15 +00:00
|
|
|
This form corresponds to the
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dq "write label"
|
2001-07-15 07:53:42 +00:00
|
|
|
command described above.
|
1999-07-31 08:11:58 +00:00
|
|
|
In addition to writing a new volume label, it also installs the bootstrap.
|
2003-03-15 22:00:45 +00:00
|
|
|
If run on a base disk, this command will create a
|
2000-11-10 17:46:15 +00:00
|
|
|
.Dq dangerously-dedicated
|
2003-03-15 22:00:45 +00:00
|
|
|
label.
|
|
|
|
This command is normally run on a slice rather than a base disk.
|
2003-03-16 00:11:49 +00:00
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl m
|
|
|
|
option is given, then the label and bootstrap will be written so that
|
|
|
|
they are understood by the target
|
|
|
|
.Ar machine ;
|
|
|
|
defaults to the current hardware architecture.
|
|
|
|
.Pp
|
2001-02-25 16:47:44 +00:00
|
|
|
If
|
|
|
|
.Fl n
|
|
|
|
is used, no data will be written to the device, and instead the
|
2003-03-15 22:00:45 +00:00
|
|
|
disk label that would have been written will be printed to standard output.
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
.Fl R B
|
2001-02-25 16:47:44 +00:00
|
|
|
.Op Fl n
|
2003-03-15 22:00:45 +00:00
|
|
|
.Op Fl b Ar boot
|
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
|
2000-11-10 17:46:15 +00:00
|
|
|
This form corresponds to the
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dq "restore label"
|
2001-07-15 07:53:42 +00:00
|
|
|
command described above.
|
1999-07-31 08:11:58 +00:00
|
|
|
In addition to restoring the volume label, it also installs the bootstrap.
|
2003-03-15 22:00:45 +00:00
|
|
|
If run on a base disk, this command will create a
|
2000-11-10 17:46:15 +00:00
|
|
|
.Dq dangerously-dedicated
|
2003-03-15 22:00:45 +00:00
|
|
|
label.
|
|
|
|
This command is normally run on a slice rather than a base disk.
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
|
|
|
The bootstrap commands always access the disk directly, so it is not necessary
|
|
|
|
to specify the
|
|
|
|
.Fl r
|
2003-03-15 22:00:45 +00:00
|
|
|
option.
|
2003-03-16 00:11:49 +00:00
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl m
|
|
|
|
option is given, then the label and bootstrap will be written so that
|
|
|
|
they are understood by the target
|
|
|
|
.Ar machine ;
|
|
|
|
defaults to the current hardware architecture.
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
If
|
2001-02-25 16:47:44 +00:00
|
|
|
.Fl n
|
|
|
|
is used, no data will be written to the device, and instead the
|
2003-03-15 22:00:45 +00:00
|
|
|
disk label that would have been written will be printed to standard output.
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
The bootstrap code is comprised of two boot programs compiled into a single
|
2003-02-23 01:48:42 +00:00
|
|
|
.Pa /boot/boot
|
|
|
|
image.
|
|
|
|
An alternative boot image may be specified with the
|
1994-05-26 06:35:07 +00:00
|
|
|
.Fl b
|
2003-02-23 01:48:42 +00:00
|
|
|
option.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ss Initializing/Formatting a Bootable Disk From Scratch
|
|
|
|
To initialize a disk from scratch, the following sequence is recommended.
|
2000-10-31 07:07:39 +00:00
|
|
|
Please note that this will wipe everything that was previously on the disk,
|
2000-11-14 11:20:58 +00:00
|
|
|
including any
|
|
|
|
.No non- Ns Fx
|
|
|
|
slices.
|
2000-10-31 07:07:39 +00:00
|
|
|
.Bl -enum
|
|
|
|
.It
|
|
|
|
Use
|
2002-04-15 22:24:34 +00:00
|
|
|
.Xr fdisk 8
|
|
|
|
to initialize the hard disk, and create a slice table, referred to
|
2003-03-15 22:00:45 +00:00
|
|
|
as the
|
|
|
|
.Dq "partition table"
|
|
|
|
in
|
2003-03-29 02:09:02 +00:00
|
|
|
.Tn DOS .
|
2000-10-31 07:07:39 +00:00
|
|
|
.It
|
|
|
|
Use
|
2002-12-24 13:41:48 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
to define partitions on
|
|
|
|
.Fx
|
|
|
|
slices created in the previous step.
|
2000-10-31 07:07:39 +00:00
|
|
|
.It
|
2002-04-15 22:24:34 +00:00
|
|
|
Finally use
|
|
|
|
.Xr newfs 8
|
2003-03-15 22:00:45 +00:00
|
|
|
to create file systems on new partitions.
|
|
|
|
.El
|
|
|
|
.Pp
|
2002-04-15 22:24:34 +00:00
|
|
|
A typical partitioning scheme would be to have an
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql a
|
2001-07-15 07:53:42 +00:00
|
|
|
partition
|
2002-08-21 18:11:48 +00:00
|
|
|
of approximately 128MB to hold the root file system, a
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql b
|
2000-11-10 17:46:15 +00:00
|
|
|
partition for
|
|
|
|
swap, a
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql d
|
|
|
|
partition for
|
|
|
|
.Pa /var
|
|
|
|
(usually 128MB), an
|
|
|
|
.Ql e
|
2000-11-10 17:46:15 +00:00
|
|
|
partition
|
2003-03-15 22:00:45 +00:00
|
|
|
for
|
|
|
|
.Pa /var/tmp
|
|
|
|
(usually 128MB), an
|
|
|
|
.Ql f
|
|
|
|
partition for
|
|
|
|
.Pa /usr
|
|
|
|
(usually around 2GB),
|
2000-11-10 17:46:15 +00:00
|
|
|
and finally a
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql g
|
|
|
|
partition for
|
|
|
|
.Pa /home
|
|
|
|
(usually all remaining space).
|
2000-10-31 07:07:39 +00:00
|
|
|
Your mileage may vary.
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Nm fdisk Fl BI Pa da0
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2003-03-15 22:00:45 +00:00
|
|
|
.Fl w B
|
|
|
|
.Pa da0s1
|
2003-03-14 09:38:54 +00:00
|
|
|
.Cm auto
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pp
|
2000-11-20 16:52:27 +00:00
|
|
|
.Nm
|
2000-10-31 07:07:39 +00:00
|
|
|
.Fl e
|
2003-03-15 22:00:45 +00:00
|
|
|
.Pa da0s1
|
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
|
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]
|
|
|
|
a: 81920 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 84*)
|
|
|
|
b: 160000 81920 swap # (Cyl. 84* - 218*)
|
|
|
|
c: 1173930 0 unused 0 0 # (Cyl. 0 - 1211*)
|
|
|
|
h: 962010 211920 vinum # (Cyl. 218*- 1211*)
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
Lines starting with a
|
|
|
|
.Ql #
|
|
|
|
mark are comments.
|
|
|
|
Most of the other specifications are no longer used.
|
|
|
|
The ones which must still be set correctly are:
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Bl -inset
|
|
|
|
.It Ar label
|
1999-07-31 08:11:58 +00:00
|
|
|
is an optional label, set by the
|
|
|
|
.Ar packid
|
|
|
|
option when writing a label.
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar flags
|
|
|
|
may be
|
|
|
|
.Cm removable , ecc
|
1999-07-31 08:11:58 +00:00
|
|
|
or
|
2003-03-15 22:00:45 +00:00
|
|
|
.Cm badsect .
|
|
|
|
.Cm removable
|
2000-11-14 11:20:58 +00:00
|
|
|
is set for removable media drives, but no current
|
|
|
|
.Fx
|
|
|
|
driver evaluates this
|
1999-07-31 08:11:58 +00:00
|
|
|
flag.
|
2003-03-15 22:00:45 +00:00
|
|
|
.Cm ecc
|
2001-07-15 07:53:42 +00:00
|
|
|
is no longer supported;
|
2003-03-15 22:00:45 +00:00
|
|
|
.Cm badsect
|
1999-07-31 08:11:58 +00:00
|
|
|
specifies that the drive can perform bad sector remapping.
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar sectors/unit
|
|
|
|
describes the total size of the disk.
|
|
|
|
This value must be correct.
|
|
|
|
.It Ar "the partition table"
|
|
|
|
is the
|
2001-03-05 15:33:54 +00:00
|
|
|
.Ux
|
2003-03-15 22:00:45 +00:00
|
|
|
partition table, not the
|
|
|
|
.Tn DOS
|
|
|
|
partition table described in
|
1999-07-31 08:11:58 +00:00
|
|
|
.Xr fdisk 8 .
|
|
|
|
.El
|
|
|
|
.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.
|
|
|
|
Lowercase versions of
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm K , M ,
|
|
|
|
and
|
|
|
|
.Cm G
|
2001-02-25 16:47:44 +00:00
|
|
|
are allowed.
|
|
|
|
Size and type should be specifed without any spaces between them.
|
|
|
|
.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
|
2003-03-15 22:00:45 +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.
|
2003-03-15 22:00:45 +00:00
|
|
|
.It Ar fstype
|
|
|
|
Describes the purpose of the partition.
|
|
|
|
The example shows all currently used partition types.
|
|
|
|
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-03-15 22:00:45 +00:00
|
|
|
.Aq Pa sys/disklabel.h
|
|
|
|
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
|
2003-03-15 22:00:45 +00:00
|
|
|
and
|
|
|
|
.Tn LFS
|
|
|
|
file systems only, the fragment size.
|
|
|
|
Defaults to 1024 for partitions smaller than 1GB,
|
|
|
|
4096 for partitions 1GB or larger.
|
|
|
|
.It Ar bsize
|
2001-02-25 16:47:44 +00:00
|
|
|
For
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm 4.2BSD
|
2003-03-15 22:00:45 +00:00
|
|
|
and
|
|
|
|
.Tn LFS
|
|
|
|
file systems only, the block size.
|
|
|
|
Defaults to 8192 for partitions smaller than 1GB,
|
|
|
|
16384 for partitions 1GB or larger.
|
|
|
|
.It Ar bps/cpg
|
2001-02-25 16:47:44 +00:00
|
|
|
For
|
2001-03-05 15:33:54 +00:00
|
|
|
.Cm 4.2BSD
|
2003-03-15 22:00:45 +00:00
|
|
|
file systems, the number of cylinders in a cylinder group.
|
|
|
|
For
|
|
|
|
.Tn LFS
|
|
|
|
file systems, the segment shift value.
|
|
|
|
Defaults to 16 for partitions smaller than 1GB,
|
|
|
|
64 for partitions 1GB or larger.
|
1999-07-31 08:11:58 +00:00
|
|
|
.El
|
2000-11-28 20:38:20 +00:00
|
|
|
.Pp
|
1999-07-31 08:11:58 +00:00
|
|
|
The remainder of the line is a comment and shows the cylinder allocations based
|
|
|
|
on the obsolete (but possibly correct) geometry information about the drive.
|
2003-03-15 22:00:45 +00:00
|
|
|
The asterisk
|
|
|
|
.Pq Ql *
|
|
|
|
indicates that the partition does not begin or end exactly on a
|
1999-07-31 08:11:58 +00:00
|
|
|
cylinder boundary.
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh EXAMPLES
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel da0s1"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
Display the in-core label for the first slice of the
|
|
|
|
.Pa da0
|
|
|
|
disk, as obtained via
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa /dev/da0s1 .
|
2003-03-15 22:00:45 +00:00
|
|
|
(If the disk is
|
|
|
|
.Dq dangerously-dedicated ,
|
|
|
|
the base disk name should be specified, such as
|
|
|
|
.Pa da0 . )
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel da0s1 > savedlabel"
|
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
|
2003-03-15 22:00:45 +00:00
|
|
|
option to restore the label at a later date.
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -w -r /dev/da0s1 da2212 foo"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Create a label for
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0s1
|
1999-07-31 08:11:58 +00:00
|
|
|
based on information for
|
2000-11-10 17:46:15 +00:00
|
|
|
.Dq da2212
|
|
|
|
found in
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pa /etc/disktab .
|
2003-03-15 22:00:45 +00:00
|
|
|
Any existing bootstrap code will be clobbered
|
|
|
|
and the disk rendered unbootable.
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -e -r da0s1"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Read the on-disk label for
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0s1 ,
|
2003-03-15 22:00:45 +00:00
|
|
|
edit it, and reinstall in-core as well as on-disk.
|
|
|
|
Existing bootstrap code is unaffected.
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -e -r -n 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
|
|
|
|
install the new label either in-core or on-disk.
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -r -w da0s1 auto"
|
1996-01-22 01:01:15 +00:00
|
|
|
.Pp
|
2001-07-15 07:53:42 +00:00
|
|
|
Try to auto-detect the required information from
|
2000-10-31 07:07:39 +00:00
|
|
|
.Pa da0s1 ,
|
2003-03-15 22:00:45 +00:00
|
|
|
and write a new label to the disk.
|
|
|
|
Use another
|
|
|
|
.Nm Fl e
|
|
|
|
command to edit the
|
2002-08-21 18:11:48 +00:00
|
|
|
partitioning and file system information.
|
1996-01-22 01:01:15 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -R da0s1 savedlabel"
|
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
|
|
|
|
.Pa savedlabel .
|
1994-05-26 06:35:07 +00:00
|
|
|
Existing bootstrap code is unaffected.
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -R -n da0s1 label_layout"
|
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 .
|
|
|
|
This is useful for determining how much space would be alloted for various
|
2001-03-05 15:33:54 +00:00
|
|
|
partitions with a labelling scheme using
|
|
|
|
.Cm % Ns -based
|
|
|
|
or
|
|
|
|
.Cm *
|
|
|
|
partition sizes.
|
2001-02-25 16:47:44 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -B da0s1"
|
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
|
2003-01-26 14:35:53 +00:00
|
|
|
.Pa /boot/boot .
|
1994-05-26 06:35:07 +00:00
|
|
|
On-disk and in-core labels are unchanged.
|
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dl "disklabel -w -B /dev/da0s1 -b newboot da2212"
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
|
|
|
Install a new label and bootstrap.
|
2003-03-15 22:00:45 +00:00
|
|
|
The label is derived from
|
|
|
|
.Xr disktab 5
|
|
|
|
information for
|
|
|
|
.Dq da2212 ,
|
2000-11-10 17:46:15 +00:00
|
|
|
and installed both in-core and on-disk.
|
2003-03-15 22:00:45 +00:00
|
|
|
The bootstrap code comes from the file
|
|
|
|
.Pa newboot
|
|
|
|
in the current working directory.
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
dd if=/dev/zero of=/dev/da0 bs=512 count=32
|
|
|
|
fdisk -BI da0
|
|
|
|
dd if=/dev/zero of=/dev/da0s1 bs=512 count=32
|
|
|
|
disklabel -w -B da0s1 auto
|
|
|
|
disklabel -e da0s1
|
|
|
|
.Ed
|
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
|
2000-10-31 07:07:39 +00:00
|
|
|
recognize the disk.
|
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
|
2003-03-15 22:00:45 +00:00
|
|
|
.Dq Li "disklabel -R ad0s1c new_label_file" :
|
2001-02-25 16:47:44 +00:00
|
|
|
.Bd -literal -offset 4n
|
|
|
|
# /dev/ad0s1c:
|
|
|
|
type: ESDI
|
|
|
|
disk: ad0s1
|
2001-07-15 07:53:42 +00:00
|
|
|
label:
|
2001-02-25 16:47:44 +00:00
|
|
|
flags:
|
|
|
|
bytes/sector: 512
|
|
|
|
sectors/track: 63
|
|
|
|
tracks/cylinder: 16
|
|
|
|
sectors/cylinder: 1008
|
|
|
|
cylinders: 40633
|
|
|
|
sectors/unit: 40959009
|
|
|
|
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
|
2001-02-25 16:47:44 +00:00
|
|
|
|
|
|
|
8 partitions:
|
|
|
|
# size offset fstype [fsize bsize bps/cpg]
|
|
|
|
a: 400M 0 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
|
1994-05-26 06:35:07 +00:00
|
|
|
.Sh SEE ALSO
|
2001-05-14 23:26:40 +00:00
|
|
|
.Xr ccd 4 ,
|
2003-03-15 22:00:45 +00:00
|
|
|
.Xr md 4 ,
|
1997-01-13 00:25:51 +00:00
|
|
|
.Xr disklabel 5 ,
|
1999-07-31 08:11:58 +00:00
|
|
|
.Xr disktab 5 ,
|
1999-08-15 08:06:12 +00:00
|
|
|
.Xr boot0cfg 8 ,
|
2001-05-14 23:26:40 +00:00
|
|
|
.Xr fdisk 8 ,
|
|
|
|
.Xr vinum 8
|
1994-05-26 06:35:07 +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.
|
|
|
|
Some device drivers create a label containing only a single large partition
|
2001-07-15 07:53:42 +00:00
|
|
|
if a disk is unlabeled; thus, the label must be written to the
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql a
|
|
|
|
partition of the disk while it is open.
|
|
|
|
This sometimes requires the desired label to be set in two steps,
|
|
|
|
the first one creating at least one other partition,
|
|
|
|
and the second one setting the label on the new partition
|
|
|
|
while shrinking the
|
|
|
|
.Ql a
|
1999-07-31 08:11:58 +00:00
|
|
|
partition.
|
1994-05-26 06:35:07 +00:00
|
|
|
.Pp
|
2003-03-15 22:00:45 +00:00
|
|
|
On some machines, the bootstrap code may not fit entirely in the area
|
2002-08-21 18:11:48 +00:00
|
|
|
allocated for it by some file systems.
|
2003-03-15 22:00:45 +00:00
|
|
|
As a result,
|
|
|
|
it may not be possible to have file systems on some partitions of a
|
2000-11-10 17:46:15 +00:00
|
|
|
.Dq bootable
|
|
|
|
disk.
|
1994-05-26 06:35:07 +00:00
|
|
|
When installing bootstrap code,
|
1998-06-04 06:49:13 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
checks for these cases.
|
2003-03-15 22:00:45 +00:00
|
|
|
If the installed boot code would overlap a partition of type
|
|
|
|
.Dv FS_UNUSED ,
|
|
|
|
it is marked as type
|
|
|
|
.Dv FS_BOOT .
|
1994-05-26 06:35:07 +00:00
|
|
|
The
|
|
|
|
.Xr newfs 8
|
2003-03-15 22:00:45 +00:00
|
|
|
utility will disallow creation of file systems on
|
|
|
|
.Dv FS_BOOT
|
|
|
|
partitions.
|
|
|
|
Conversely, if a partition has a type other than
|
|
|
|
.Dv FS_UNUSED
|
|
|
|
or
|
|
|
|
.Dv FS_BOOT ,
|
1998-06-04 06:49:13 +00:00
|
|
|
.Nm
|
1994-05-26 06:35:07 +00:00
|
|
|
will not install bootstrap code that overlaps it.
|
|
|
|
.Sh BUGS
|
|
|
|
When a disk name is given without a full pathname,
|
2000-11-10 17:46:15 +00:00
|
|
|
the constructed device name uses the
|
2003-03-15 22:00:45 +00:00
|
|
|
.Ql c
|
2000-11-10 17:46:15 +00:00
|
|
|
partition.
|
1996-02-03 21:14:09 +00:00
|
|
|
.Pp
|
|
|
|
For the i386 architecture, the primary bootstrap sector contains
|
|
|
|
an embedded
|
|
|
|
.Em fdisk
|
|
|
|
table.
|
2002-07-06 19:34:18 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility takes care to not clobber it when installing a bootstrap only
|
1996-02-03 21:14:09 +00:00
|
|
|
.Pq Fl B ,
|
|
|
|
or when editing an existing label
|
|
|
|
.Pq Fl e ,
|
|
|
|
but it unconditionally writes the primary bootstrap program onto
|
|
|
|
the disk for
|
|
|
|
.Fl w
|
|
|
|
or
|
|
|
|
.Fl R ,
|
|
|
|
thus replacing the
|
|
|
|
.Em fdisk
|
2003-03-15 22:00:45 +00:00
|
|
|
table by the dummy one in the bootstrap program.
|
|
|
|
This is only of
|
2001-08-14 10:01:54 +00:00
|
|
|
concern if the disk is fully dedicated, so that the
|
2003-03-15 22:00:45 +00:00
|
|
|
.Fx
|
|
|
|
disk label
|
1996-02-03 21:14:09 +00:00
|
|
|
starts at absolute block 0 on the disk.
|
1999-07-31 08:11:58 +00:00
|
|
|
.Pp
|
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
|
|
|
does not perform all possible error checking.
|
|
|
|
Warning is given if partitions overlap,
|
|
|
|
if an absolute offset does not match the expected offset,
|
|
|
|
if the
|
|
|
|
.Ql c
|
|
|
|
partition does not start at 0 or does not cover the entire slice,
|
|
|
|
if a partition runs past the end of the device,
|
|
|
|
and a number of other errors,
|
|
|
|
but no warning is given if space remains unused.
|