BSD 4_4_Lite2 development
[unix-history] / usr / share / man / cat8 / disklabel.0
DISKLABEL(8) BSD System Manager's Manual DISKLABEL(8)
N\bNA\bAM\bME\bE
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl - read and write disk pack label
S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl [-\b-r\br] _\bd_\bi_\bs_\bk
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl -\b-w\bw [-\b-r\br] _\bd_\bi_\bs_\bk _\bd_\bi_\bs_\bk_\bt_\by_\bp_\be [_\bp_\ba_\bc_\bk_\bi_\bd]
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl -\b-e\be [-\b-r\br] _\bd_\bi_\bs_\bk
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl -\b-R\bR [-\b-r\br] _\bd_\bi_\bs_\bk _\bp_\br_\bo_\bt_\bo_\bf_\bi_\bl_\be
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl [-\b-N\bNW\bW] _\bd_\bi_\bs_\bk
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl -\b-B\bB [-\b-b\bb _\bb_\bo_\bo_\bt_\b1 [-\b-s\bs _\bb_\bo_\bo_\bt_\b2]] _\bd_\bi_\bs_\bk [_\bd_\bi_\bs_\bk_\bt_\by_\bp_\be]
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl -\b-w\bw -\b-B\bB [-\b-b\bb _\bb_\bo_\bo_\bt_\b1 [-\b-s\bs _\bb_\bo_\bo_\bt_\b2]] _\bd_\bi_\bs_\bk _\bd_\bi_\bs_\bk_\bt_\by_\bp_\be [_\bp_\ba_\bc_\bk_\bi_\bd]
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl -\b-R\bR -\b-B\bB [-\b-b\bb _\bb_\bo_\bo_\bt_\b1 [-\b-s\bs _\bb_\bo_\bo_\bt_\b2]] _\bd_\bi_\bs_\bk _\bp_\br_\bo_\bt_\bo_\bf_\bi_\bl_\be [_\bd_\bi_\bs_\bk_\bt_\by_\bp_\be]
D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
D\bDi\bis\bsk\bkl\bla\bab\bbe\bel\bl can be used to install, examine or modify the label on a disk
drive or pack. When writing the label, it can be used to change the
drive identification, the disk partitions on the drive, or to replace a
damaged label. On some systems, d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl can be used to install boot-
strap code as well. There are several forms of the command that read
(display), install or edit the label on a disk. Each form has an addi-
tional option, -\b-r\br, which causes the label to be read from or written to
the disk directly, rather than going through the system's in-core copy of
the label. This option may allow a label to be installed on a disk with-
out kernel support for a label, such as when labels are first installed
on a system; it must be used when first installing a label on a disk.
The specific effect of -\b-r\br is described under each command. The read and
install forms also support the -\b-B\bB option to install bootstrap code.
These variants are described later.
The first form of the command (read) is used to examine the label on the
named disk drive (e.g. sd0 or /dev/rsd0c). It will display all of the
parameters associated with the drive and its partition layout. Unless
the -\b-r\br flag is given, the kernel's in-core copy of the label is dis-
played; 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
-\b-r\br flag is given, the label from the raw disk will be displayed rather
than the in-core label.
The second form of the command, with the -\b-w\bw flag, is used to write a
standard label on the designated drive. The required arguments to
d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl are the drive to be labelled (e.g. sd0), and the drive type as
described in the 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
disktab 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 pack id must be quoted if it con-
tains blanks. If the -\b-r\br flag is given, the disk sectors containing the
label and bootstrap will be written directly. A side-effect of this is
that any existing bootstrap code will be overwritten and the disk ren-
dered unbootable. If -\b-r\br is not specified, the existing label will be up-
dated via the in-core copy and any bootstrap code will be unaffected. If
the disk does not already have a label, the -\b-r\br flag must be used. In ei-
ther case, the kernel's in-core label is replaced.
An existing disk label may be edited by using the -\b-e\be flag. The label is
read from the in-core kernel copy, or directly from the disk if the -\b-r\br
flag is also given. The label is formatted and then supplied to an edi-
tor for changes. If no editor is specified in an EDITOR environment
variable, vi(1) is used. When the editor terminates, the formatted label
is reread and used to rewrite the disk label. Existing bootstrap code is
unchanged regardless of whether -\b-r\br was specified.
With the -\b-R\bR flag, d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl is capable of restoring a disk label that was
formatted in a prior operation and saved in an ascii file. The prototype
file used to create the label should be in the same format as that pro-
duced when reading or editing a label. Comments are delimited by _\b# and
newline. As with -\b-w\bw, any existing bootstrap code will be clobbered if -\b-r\br
is specified and will be unaffected otherwise.
The -\b-N\bNW\bW flags for d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl explicitly disallow and allow, respectively,
writing of the pack label area on the selected disk.
The final three forms of d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl are used to install boostrap code on
machines where the bootstrap is part of the label. The bootstrap code is
comprised of one or two boot programs depending on the machine. The -\b-B\bB
option is used to denote that bootstrap code is to be installed. The -\b-r\br
flag is implied by -\b-B\bB and never needs to be specified. The name of the
boot program(s) to be installed can be selected in a variety of ways.
First, the names can be specified explicitly via the -\b-b\bb and -\b-s\bs flags. On
machines with only a single level of boot program, -\b-b\bb is the name of that
program. For machines with a two-level bootstrap, -\b-b\bb indicates the pri-
mary boot program and -\b-s\bs the secondary boot program. If the names are
not explicitly given, standard boot programs will be used. The boot pro-
grams are located in _\b/_\bu_\bs_\br_\b/_\bm_\bd_\be_\bc. The names of the programs are taken from
the ``b0'' and ``b1'' parameters of the disktab(5) entry for the disk if
_\bd_\bi_\bs_\bk_\bt_\by_\bp_\be was given and its disktab entry exists and includes those param-
eters. Otherwise, boot program names are derived from the name of the
disk. These names are of the form _\bb_\ba_\bs_\be_\bn_\ba_\bm_\beboot for the primary (or only)
bootstrap, and boot_\bb_\ba_\bs_\be_\bn_\ba_\bm_\be for the secondary bootstrap; for example,
_\b/_\bu_\bs_\br_\b/_\bm_\bd_\be_\bc_\b/_\bs_\bd_\bb_\bo_\bo_\bt and _\b/_\bu_\bs_\br_\b/_\bm_\bd_\be_\bc_\b/_\bb_\bo_\bo_\bt_\bs_\bd if the disk device is _\bs_\bd_\b0.
The first of the three boot-installation forms is used to install boot-
strap code without changing the existing label. It is essentially a read
command with respect to the disk label itself and all options are related
to the specification of the boot program as described previously. The
final two forms are analogous to the basic write and restore versions ex-
cept that they will install bootstrap code in addition to a new label.
F\bFI\bIL\bLE\bES\bS
/etc/disktab
/usr/mdec/_\bx_\bxboot
/usr/mdec/boot_\bx_\bx
E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
disklabel sd0
Display the in-core label for sd0 as obtained via _\b/_\bd_\be_\bv_\b/_\br_\bs_\bd_\b0_\bc.
disklabel -w -r /dev/rsd0c sd2212 foo
Create a label for sd0 based on information for ``sd2212'' found in
_\b/_\be_\bt_\bc_\b/_\bd_\bi_\bs_\bk_\bt_\ba_\bb. Any existing bootstrap code will be clobbered.
disklabel -e -r sd0
Read the on-disk label for sd0, edit it and reinstall in-core as well as
on-disk. Existing bootstrap code is unaffected.
disklabel -R sd0 mylabel
Restore the on-disk and in-core label for sd0 from information in
_\bm_\by_\bl_\ba_\bb_\be_\bl. Existing bootstrap code is unaffected.
disklabel -B sd0
Install a new bootstrap on sd0. The boot code comes from
_\b/_\bu_\bs_\br_\b/_\bm_\bd_\be_\bc_\b/_\bs_\bd_\bb_\bo_\bo_\bt and possibly _\b/_\bu_\bs_\br_\b/_\bm_\bd_\be_\bc_\b/_\bb_\bo_\bo_\bt_\bs_\bd. On-disk and in-core la-
bels are unchanged.
disklabel -w -B /dev/rsd0c -b newboot sd2212
Install a new label and bootstrap. The label is derived from disktab in-
formation for ``sd2212'' and installed both in-core and on-disk. The
bootstrap code comes from the file _\b/_\bu_\bs_\br_\b/_\bm_\bd_\be_\bc_\b/_\bn_\be_\bw_\bb_\bo_\bo_\bt.
S\bSE\bEE\bE A\bAL\bLS\bSO\bO
disktab(5), disklabel(5)
D\bDI\bIA\bAG\bGN\bNO\bOS\bST\bTI\bIC\bCS\bS
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 parti-
tion if a disk is unlabeled; thus, the label must be written to the ``a''
partition of the disk while it is open. This sometimes requires the de-
sired label to be set in two steps, the first one creating at least one
other partition, and the second setting the label on the new partition
while shrinking the ``a'' partition.
On some machines the bootstrap code may not fit entirely in the area al-
located for it by some filesystems. As a result, it may not be possible
to have filesystems on some partitions of a ``bootable'' disk. When in-
stalling bootstrap code, d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl checks for these cases. If the in-
stalled boot code would overlap a partition of type FS_UNUSED it is
marked as type FS_BOOT. The newfs(8) utility will disallow creation of
filesystems on FS_BOOT partitions. Conversely, if a partition has a type
other than FS_UNUSED or FS_BOOT, d\bdi\bis\bsk\bkl\bla\bab\bbe\bel\bl will not install bootstrap
code that overlaps it.
B\bBU\bUG\bGS\bS
When a disk name is given without a full pathname, the constructed device
name uses the ``a'' partition on the tahoe, the ``c'' partition on all
others.
4.2 Berkeley Distribution April 19, 1994 3