Home
Search all pages
Subjects
By activity
Professions, Sciences, Humanities, Business, ...
User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...
Text Strings
Conversions, tests, processing, manipulation,...
Math
Integer, Floating point, Matrix, Statistics, Boolean, ...
Processing
Algorithms, Memory, Process control, Debugging, ...
Stored Data
Data storage, Integrity, Encryption, Compression, ...
Communications
Networks, protocols, Interprocess, Remote, Client Server, ...
Hard World Timing, Calendar and Clock, Audio, Video, Printer, Controls...
File System
Management, Filtering, File & Directory access, Viewers, ...
|
|
|
RocketLink!--> Man page versions:
OpenBSD
FreeBSD
NetBSD
Others
DISKLABEL(8) OpenBSD System Manager's Manual DISKLABEL(8)
NAME
disklabel - read and write disk pack label
SYNOPSIS
disklabel [-r] [-n] [-t] disk
disklabel -w [-r] [-n] disk disktype [packid]
disklabel -e [-r] [-n] disk
disklabel -E [-r] [-n] disk
disklabel -R [-r] [-n] disk protofile
disklabel [-NW] [-n] disk
disklabel -B [-n] [-b boot1 [-s boot2]] disk [disktype]
disklabel -w -B [-n] [-b boot1 [-s boot2]] disk disktype [packid]
disklabel -R -B [-n] [-b boot1 [-s boot2]] disk protofile [disktype]
DESCRIPTION
Disklabel 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, disklabel 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, -r, 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 -r is described under each command. The read and
install forms also support the -B option to install bootstrap code.
These variants are described later.
In all cases you can specify -n to operate in no change mode to avoid
committing any permanent changes.
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 -r 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
-r flag is given, the label from the raw disk will be displayed rather
than the in-core label. If the -t flag is given, then the label will be
formatted as a disktab(5) entry.
The second form of the command, with the -w flag, is used to write a
standard label on the designated drive. The required arguments to
disklabel 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 -r 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 -r 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 -r 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 -e flag. The label is
read from the in-core kernel copy, or directly from the disk if the -r
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 -r was specified.
With the -R flag, disklabel 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 # and
newline. As with -w, any existing bootstrap code will be clobbered if -r
is specified and will be unaffected otherwise.
The -NW flags for disklabel explicitly disallow and allow, respectively,
writing of the pack label area on the selected disk.
The -E flag to disklabel will drop you into a simple initial label edi-
tor. This mode is only intended for new disks as it will move partitions
around as necessary to maintain a contiguous pool of free blocks. Some
command or prompts take an optional unit. Available units are 'b' for
bytes, 'c' for cylinders, 'k' for kilobytes, 'm' for megabytes, 'g' for
gigabytes. Quantities will be rounded to the nearest cylinder when units
are specified for sizes (or offsets). Commands may be aborted by enter-
ing ^D (Control-D). Entering ^D at the main '<' prompt will exit the ed-
itor. At prompts that request a size, '*' may be entered to indicate the
rest of the available space. The editor commands are as follows:
? Display help message with all available commands. There is
(simple) context-sensitive help available at most prompts.
M Display this manual page.
u Undo (or redo) last change. Undo will reset the disklabel to
the state before the last command that modified it.
p [unit] Print the current disk label. If a unit is given, the size
and offsets are displayed in terms of the specified unit.
e Edit drive parameters. This option is used to set the follow-
ing parameters: bytes/sector, sectors/track, tracks/cylinder,
sectors/cylinder, number of cylinders, total sectors on the
disk, rpm, disk type, and a descriptive label string.
b Set OpenBSD disk boundaries. This option tells disklabel
which parts of the disk it is allow to modify. This option is
probably only useful for ports with fdisk partition tables
where the ending sector in the MBR is incorrect. The user may
enter '*' at the ``Size'' prompt to indicate the entire size
of the disk (minus the starting sector). This is useful for
large disks where the fdisk partition table is incapable if
storing the real size.
r Recalculate free space. This option should really not be nec-
essary under normal circumstances.
a [part] Add new partition. This option adds a new BSD partition. If
no partion letter is specified (a-p), the user will be prompt-
ed for one.
c [part] Change the size of an existing partition. If no parition is
specified, the user will be prompted for one. The new size
may be in terms of the aforementioned units and may also be
prefixed with '+' or '-' to change the size by a relative
amount.
d [part] Delete an existing partition. If no parition is specified,
the user will be prompted for one.
m [part] Modify parameters for an existing partition. If no parition
is specified, the user will be prompted for one. This option
allows the user to change the filesystem type, starting off-
set, parition size, block fragment size, block size, and
cylinders per group for the specified partition (not all pa-
rameters are configurable for non-BSD partitions).
s [path] Save the label to a file in ascii format (suitable for loading
via the [-R] option). If no path is specified, the user will
be prompted for one.
w Write the label to disk. This option will commit any changes
to the on-disk label.
q Quit the editor. If any changes have been made the user will
be asked whether or not to save the changes to the on-disk la-
bel.
x Exit the editor without saving any changes to the label.
The final three forms of disklabel 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
option is used to denote that bootstrap code is to be installed. The -r
flag is implied by -B 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 and -s flags. On
machines with only a single level of boot program, -b is the name of that
program. For machines with a two-level bootstrap, -b indicates the pri-
mary boot program and -s the secondary boot program. If the names are
not explicitly given, standard boot programs will be used. The boot pro-
grams are located in /usr/mdec. The names of the programs are taken from
the ``b0'' and ``b1'' parameters of the disktab(5) entry for the disk if
disktype 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 basenameboot for the primary (or only)
bootstrap, and bootbasename for the secondary bootstrap; for example,
/usr/mdec/sdboot and /usr/mdec/bootsd if the disk device is sd0.
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.
FILES
/etc/disktab
/usr/mdec/xxboot
/usr/mdec/bootxx
EXAMPLES
disklabel sd0
Display the in-core label for sd0 as obtained via /dev/rsd0c.
disklabel -w -r /dev/rsd0c sd2212 foo
Create a label for sd0 based on information for ``sd2212'' found in
/etc/disktab. Any existing bootstrap code will be clobbered. (Normally
you do not want to use the -r flag though.)
disklabel -e -r sd0
Read the on-disk label for sd0, edit it and reinstall in-core as well as
on-disk. (Normally you do not want to use the -r flag though.) Existing
bootstrap code is unaffected.
disklabel -R sd0 mylabel
Restore the on-disk and in-core label for sd0 from information in
mylabel. Existing bootstrap code is unaffected.
disklabel -B sd0
Install a new bootstrap on sd0. The boot code comes from
/usr/mdec/sdboot and possibly /usr/mdec/bootsd. On-disk and in-core la-
bels are unchanged, but on some systems other information may be de-
stroyed. Use with care.
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 /usr/mdec/newboot.
SEE ALSO
disktab(5), disklabel(5)
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 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, disklabel 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, disklabel will not install bootstrap
code that overlaps it.
NOTES
On i386 machines, installboot(8) is normally used to install boot code.
The -B option to disklabel can still be used to install old style boot
code, but this usage is deprecated.
BUGS
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. In -E mode, disklabel is far too quick to shuffle partitions
around; it should keep a free block list and only move partitions around
with the user's permission. Also in -E mode, partitions outside the
OpenBSD portion of the disk should be changable.
4.2 Berkeley Distribution October 27, 1997 4
Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts Institute of Technology, Free Software Foundation, FreeBSD Inc., and others. |
(Corrections, notes, and links courtesy of RocketAware.com)
FreeBSD Sources for disklabel(8) OpenBSD sources for disklabel(8)
Up to: File System Operations - Operations for entire file-systems (quotas, configuration, consistency, mount, unmount, et al)
RocketLink!--> Man page versions:
OpenBSD
FreeBSD
NetBSD
Others
Rapid-Links:
Search | About | Comments | Submit Path: RocketAware > man pages >
disklabel.8/
RocketAware.com is a service of Mib Software Copyright 1999, Forrest J. Cavalier III. All Rights Reserved. We welcome submissions and comments
|