⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 disklabel.8

📁 早期freebsd实现
💻 8
字号:
.\" 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.\"    must display the following acknowledgement:.\"	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.\".Dd "April 19, 1994".Dt DISKLABEL 8.Os BSD 4.2.Sh NAME.Nm disklabel.Nd read and write disk pack label.Sh SYNOPSIS.Nm disklabel.Op Fl r.Ar disk.Nm disklabel.Fl w.Op Fl r.Ar disk Ar disktype.Oo Ar packid Oc.Nm disklabel.Fl e.Op Fl r.Ar disk.Nm disklabel.Fl R.Op Fl r.Ar disk Ar protofile.Nm disklabel.Op Fl NW.Ar disk.sp.Nm disklabel.Fl B.Oo.Fl b Ar boot1.Op Fl s Ar boot2.Oc.Ar disk.Oo Ar disktype Oc.Nm disklabel.Fl w.Fl B.Oo.Fl b Ar boot1.Op Fl s Ar boot2.Oc.Ar disk Ar disktype.Oo Ar packid Oc.Nm disklabel.Fl R.Fl B.Oo.Fl b Ar boot1.Op Fl s Ar boot2.Oc.Ar disk Ar protofile.Oo Ar disktype Oc.Sh DESCRIPTION.Nm Disklabelcan be used to install, examine or modify the label on a disk drive or pack.When writing the label, it can be usedto change the drive identification,the disk partitions on the drive,or to replace a damaged label.On some systems,.Nm disklabelcan be used to install bootstrap code as well.There are several forms of the command that read (display), install or editthe label on a disk.Each form has an additional option,.Fl 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 diskwithout kernel support for a label, such as when labels are first installedon a system; it must be used when first installing a label on a disk.The specific effect of.Fl ris described under each command.The read and install forms also support the.Fl Boption to install bootstrap code.These variants are described later..PpThe first form of the command (read) is used to examine the label on the nameddisk drive (e.g. sd0 or /dev/rsd0c).It will display all of the parameters associated with the driveand its partition layout.Unless the.Fl rflag is given,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 rflag is given, the label from the raw disk will be displayed ratherthan the in-core label..PpThe second form of the command, with the.Fl wflag, is used to write a standard label on the designated drive.The required arguments to.Nm disklabelare the drive to be labelled (e.g. sd0), andthe drive type as described in the.Xr disktab 5file.The drive parameters and partitions are taken from that file.If different disks of the same physical type are to have differentpartitions, it will be necessary to have separate disktab entriesdescribing 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 contains blanks.If the.Fl rflag is given, the disk sectors containing the label and bootstrapwill be written directly.A side-effect of this is that any existing bootstrap code will be overwrittenand the disk rendered unbootable.If.Fl ris not specified,the existing label will be updated via the in-core copy and any bootstrapcode will be unaffected.If the disk does not already have a label, the.Fl rflag must be used.In either case, the kernel's in-core label is replaced..PpAn existing disk label may be edited by using the.Fl eflag.The label is read from the in-core kernel copy,or directly from the disk if the.Fl rflag is also given.The label is formatted and then supplied to an editor for changes.If no editor is specified in an.Ev EDITORenvironment variable,.Xr vi 1is used.When the editor terminates, the formatted label is rereadand used to rewrite the disk label.Existing bootstrap code is unchanged regardless of whether.Fl rwas specified..PpWith the.Fl Rflag,.Nm disklabelis capable of restoring a disk label that was formattedin a prior operation and saved in an ascii file.The prototype file used to create the label should be in the same formatas that produced when reading or editing a label.Comments are delimited by.Ar \&#and newline.As with.Fl w ,any existing bootstrap code will be clobbered if.Fl ris specified and will be unaffected otherwise..PpThe.Fl NWflags for.Nm disklabelexplicitly disallow andallow, respectively, writing of the pack label area on the selected disk..PpThe final three forms of.Nm disklabelare used to install boostrap code on machines where the bootstrap is partof the label.The bootstrap code is comprised of one or two boot programs depending onthe machine.The.Fl Boption is used to denote that bootstrap code is to be installed.The.Fl rflag is implied by.Fl Band never needs to be specified.The name of the boot program(s) to be installed can be selected in avariety of ways.First, the names can be specified explicitly via the.Fl band.Fl sflags.On machines with only a single level of boot program,.Fl bis the name of that program.For machines with a two-level bootstrap,.Fl bindicates the primary boot program and.Fl sthe secondary boot program.If the names are not explicitly given, standard boot programs will be used.The boot programs are located in.Pa /usr/mdec .The names of the programs are taken from the ``b0'' and ``b1'' parametersof the.Xr disktab 5entry for the disk if.Ar disktypewas given and its disktab entry exists and includes those parameters.Otherwise, boot program names are derived from the name of the disk.These names are of the form.Pa basename Ns bootfor the primary (or only) bootstrap, and.Pf boot Pa basenamefor the secondary bootstrap;for example,.Pa /usr/mdec/sdbootand.Pa /usr/mdec/bootsdif the disk device is.Em sd0 ..PpThe first of the three boot-installation forms is used to installbootstrap code without changing the existing label.It is essentially a read command with respect to the disk labelitself and all options are related to the specification of the bootprogram as described previously.The final two forms are analogous to the basic write and restore versionsexcept that they will install bootstrap code in addition to a new label..Sh FILES.Bl -tag -width Pa -compact.It Pa /etc/disktab.It Pa /usr/mdec/ Ns Em xx Ns boot.It Pa /usr/mdec/boot Ns Em xx.El.Sh EXAMPLES.Dl disklabel sd0.PpDisplay the in-core label for sd0 as obtained via.Pa /dev/rsd0c ..Pp.Dl disklabel -w -r /dev/rsd0c sd2212 foo.PpCreate a label for sd0 based on information for ``sd2212'' found in.Pa /etc/disktab .Any existing bootstrap code will be clobbered..Pp.Dl disklabel -e -r sd0.PpRead the on-disk label for sd0, edit it and reinstall in-core as wellas on-disk.Existing bootstrap code is unaffected..Pp.Dl disklabel -R sd0 mylabel.PpRestore the on-disk and in-core label for sd0 from information in.Pa mylabel .Existing bootstrap code is unaffected..Pp.Dl disklabel -B sd0.PpInstall a new bootstrap on sd0.The boot code comes from.Pa /usr/mdec/sdbootand possibly.Pa /usr/mdec/bootsd .On-disk and in-core labels are unchanged..Pp.Dl disklabel -w -B /dev/rsd0c -b newboot sd2212.PpInstall a new label and bootstrap.The label is derived from disktab information for ``sd2212'' andinstalled both in-core and on-disk.The bootstrap code comes from the file.Pa /usr/mdec/newboot ..Sh SEE ALSO.Xr disktab 5 ,.Xr disklabel 5.Sh DIAGNOSTICSThe kernel device drivers will not allow the size of a disk partitionto 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 partitionif 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 desired 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 partitionwhile shrinking the ``a'' partition..PpOn some machines the bootstrap code may not fit entirely in the areaallocated for it by some filesystems.As a result, it may not be possible to have filesystems on some partitionsof a ``bootable'' disk.When installing bootstrap code,.Nm disklabelchecks for these cases.If the installed boot code would overlap a partition of type FS_UNUSEDit is marked as type FS_BOOT.The.Xr newfs 8utility will disallow creation of filesystems on FS_BOOT partitions.Conversely, if a partition has a type other than FS_UNUSED or FS_BOOT,.Nm disklabelwill not install bootstrap code that overlaps it..Sh BUGSWhen 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.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -