diff options
Diffstat (limited to 'sbin/disklabel/disklabel.8')
-rw-r--r-- | sbin/disklabel/disklabel.8 | 445 |
1 files changed, 243 insertions, 202 deletions
diff --git a/sbin/disklabel/disklabel.8 b/sbin/disklabel/disklabel.8 index de36425ba71..505bc1c2b51 100644 --- a/sbin/disklabel/disklabel.8 +++ b/sbin/disklabel/disklabel.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: disklabel.8,v 1.54 2003/09/02 18:30:27 jmc Exp $ +.\" $OpenBSD: disklabel.8,v 1.55 2003/12/20 09:29:27 jmc Exp $ .\" $NetBSD: disklabel.8,v 1.9 1995/03/18 14:54:38 cgd Exp $ .\" .\" Copyright (c) 1987, 1988, 1991, 1993 @@ -41,103 +41,70 @@ .Nd read and write disk pack label .Sh SYNOPSIS .Nm disklabel -.Op Fl n -.Op Fl cd Li \&| Fl r -.Op Fl p Ar unit -.Op Fl t +.Op Fl c | d | r | t .Op Fl v +.Op Fl p Ar unit .Ar disk .Nm disklabel .Fl w -.Op Fl n -.Op Fl cd Li \&| Fl r -.Op Fl v +.Op Fl c | d | r +.Op Fl nv .Ar disk Ar disktype .Oo Ar packid Oc .Nm disklabel .Fl e -.Op Fl n -.Op Fl cd Li \&| Fl r -.Op Fl v +.Op Fl c | d | r +.Op Fl nv .Ar disk .Nm disklabel .Fl E +.Op Fl c | d | r +.Op Fl nv .Op Fl f Ar tempfile -.Op Fl n -.Op Fl cd Li \&| Fl r -.Op Fl v .Ar disk .Nm disklabel .Fl R -.Op Fl r -.Op Fl n -.Op Fl v +.Op Fl nrv .Ar disk Ar protofile .Nm disklabel -.Op Fl NW -.Op Fl n -.Op Fl v +.Fl N | W +.Op Fl nv .Ar disk .Pp .Nm disklabel -.Fl B -.Op Fl n -.Op Fl v -.Oo -.Fl b Ar boot1 +.Fl B\ \& +.Op Fl nv +.Op Fl b Ar boot1 .Op Fl s Ar boot2 -.Oc .Ar disk .Oo Ar disktype Oc .Nm disklabel -.Fl w -.Fl B -.Op Fl n -.Op Fl v -.Oo -.Fl b Ar boot1 +.Fl Bw +.Op Fl nv +.Op Fl b Ar boot1 .Op Fl s Ar boot2 -.Oc .Ar disk Ar disktype -.Oo Ar packid Oc +.Op Ar packid .Nm disklabel -.Fl R -.Fl B -.Op Fl n -.Op Fl v -.Oo -.Fl b Ar boot1 +.Fl BR +.Op Fl nv +.Op Fl b Ar boot1 .Op Fl s Ar boot2 -.Oc .Ar disk Ar protofile -.Oo Ar disktype Oc +.Op Ar disktype .Sh DESCRIPTION The .Nm utility can be used to install, examine, or modify the label on a disk drive or pack. -The disk label contains information about disk characteristics (size, -type, etc.) and the partition layout, stored on the disk -itself. +The disk label contains information about disk characteristics +.Pq size, type, etc. +and the partition layout, stored on the disk itself. It is used by the operating system to optimize disk I/O and locate the filesystems resident on the disk. .Pp The options are as follows: .Bl -tag -width Ds -.It Fl n -Make no permanent changes to the disklabel (useful for debugging -purposes). -.It Fl v -Print additional information during operation (verbose mode). -.It Fl r -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 without kernel -support for a label, such as when labels are first installed on a -system. -This flag does not work on a number of architectures, thus it is -not considered the right way to put a new label on a disk. -Its use is discouraged. .It Fl B Install bootstrap code. The @@ -147,10 +114,14 @@ flag is implied by and never needs to be specified. .It Fl b Specify the single level boot program, or the primary boot program, -depending on the system boot architecture (single or two-level). -.It Fl s -On machines with a two-level bootstrap (such as i386-based systems), -specify the secondary boot program. +depending on the system boot architecture +.Pq single or two-level . +.It Fl c +Clear the system's in-core copy of the label and update it based on +the on-disk label. +May not be used in conjunction with the +.Fl r +flag. .It Fl d Use the .Em default @@ -163,12 +134,15 @@ that are capable of reporting their geometry, such as SCSI, IDE, and ESDI. May not be used in conjunction with the .Fl r flag. -.It Fl c -Clear the system's in-core copy of the label and update it based on -the on-disk label. -May not be used in conjunction with the -.Fl r -flag. +.It Fl E +Use a simple initial label editor, using the command-driven built-in +editor described below. +.It Fl e +Edit an existing disk label using the editor specified in the +.Ev EDITOR +environment variable, or +.Xr vi 1 +if none is specified. .It Fl f Ar tempfile Write entries to .Ar tempfile @@ -184,41 +158,78 @@ flag. If .Ar tempfile already exists, it will be overwritten. +.It Fl N +Disallow writing of the pack label area on the selected disk. +.It Fl n +Make no permanent changes to the disklabel +.Pq useful for debugging purposes . .It Fl p Ar unit Print partition sizes and offsets in .Ar unit instead of sectors. -Valid units are b(ytes), c(ylinders), k(ilobytes), m(egabytes) and -g(igabytes). -.It Fl t -Format the label as a -.Xr disktab 5 -entry. -.It Fl w -Write a standard label on the designated drive. -.It Fl e -Edit an existing disk label using the editor specified in the -.Ev EDITOR -environment variable, or -.Xr vi 1 -if none is specified. -.It Fl E -Use a simple initial label editor, using the command-driven built-in -editor described below. +Valid units are b(ytes), c(ylinders), k(ilobytes), m(egabytes) and g(igabytes). .It Fl R Restore a disk label that was formatted in a prior operation and saved in an .Tn ASCII file. -.It Fl N -Disallow writing of the pack label area on the selected disk. +.It Fl r +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 without kernel +support for a label, such as when labels are first installed on a +system. +This flag does not work on a number of architectures, thus it is +not considered the right way to put a new label on a disk. +Its use is discouraged. +.It Fl s +On machines with a two-level bootstrap +.Pq such as i386-based systems , +specify the secondary boot program. +.It Fl t +Format the label as a +.Xr disktab 5 +entry. +.It Fl v +Print additional information during operation +.Pq verbose mode . .It Fl W Allow writing of the pack label area on the selected disk. +.It Fl w +Write a standard label on the designated drive. +.It Ar disk +Specify the +.Ar disk +to operate on. +It can be specified either by its full pathname or an abbreviated disk form. +In its abbreviated form, the path to the device, the +.Sq r +donating +.Qq raw device , +and the slice, can all be omitted. +For example, the first IDE disk can be specified as either +.Pa /dev/rwd0c , +.Pa /dev/wd0c , +or +.Ar wd0 . +.It Ar disktype +Specify a +.Ar disktype +entry from the +.Xr disktab 5 +database. +.It Ar packid +Specify a pack identification string for the device +.Pq see below . +.It Ar protofile +Used with the restore option +.Pq Fl R +to specify a file to read an ASCII label from. .El .Pp -The first form of the command (read) is used to examine the label on -the named disk drive (e.g., sd0 or -.Pa /dev/rsd0c ) . +The first form of the command +.Pq read +is used to examine the label on the named disk drive. It will display all of the parameters associated with the drive and its partition layout. Unless the @@ -227,8 +238,9 @@ flag 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. .Pp -The second form of the command (write) is used to write a standard -label on the designated drive. +The second form of the command +.Pq write +is used to write a standard label on the designated drive. 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 @@ -252,8 +264,9 @@ If the disk does not already have a label, the flag must be used. In either case, the kernel's in-core label is replaced. .Pp -In the third form of the command (edit), the label is read from the -in-core kernel copy, or directly from the disk if the +In the third form of the command +.Pq edit , +the label is read from the in-core kernel copy, or directly from the disk if the .Fl r flag is also given. The label is formatted and then supplied to an editor for changes. @@ -268,9 +281,10 @@ Existing bootstrap code is unchanged regardless of whether .Fl r was specified. .Pp -The initial label editor mode is only intended for new disks as it -will move partitions around as necessary to maintain a contiguous pool -of free blocks. +The initial label editor mode +.Pq fourth form +is only intended for new disks as it will move partitions around as necessary +to maintain a contiguous pool of free blocks. Some commands or prompts take an optional unit. Available units are .Sq b @@ -285,10 +299,11 @@ and .Sq g for gigabytes. Quantities will be rounded to the nearest -cylinder when units are specified for sizes (or offsets). +cylinder when units are specified for sizes +.Pq or offsets . Commands may be aborted by entering .Ql ^D -(Control-D). +.Pq Control-D . Entering .Ql ^D at the main @@ -299,60 +314,39 @@ At prompts that request a size, may be entered to indicate the rest of the available space. The editor commands are as follows: .Bl -tag -width "p [unit] " -.It \&? Op command +.It Cm ?\& Op Ar command Display help message with all available commands. -You may specify a +A .Em command -for which to get more detailed help. -There is also (simple) context-sensitive help available at most prompts. -.It M -Display this manual page. -.It u -Undo (or redo) last change. -Entering -.Em u -once will undo your last change. -Entering it again will restore the change. -.It p Op unit -Print the current disk label. -If a -.Em unit -is given, the size and offsets are displayed in terms of the -specified unit. -.It e -Edit drive parameters. -This option is used to set the following -parameters: sectors/track, tracks/cylinder, sectors/cylinder, -number of cylinders on the disk, total sectors on the disk, rpm, -interleave, disk type, and a descriptive label string. -.It b +may be specified to get more detailed help. +There is also +.Pq simple +context-sensitive help available at most prompts. +.It Cm a Op Ar part +Add new partition. +This option adds a new BSD partition. +If no partition letter is specified +.Pq a\-p , +the user will be prompted for one. +.It Cm b Set .Ox disk boundaries. This option tells .Nm which parts of the disk it is allowed to modify. -This option is -probably only useful for ports with fdisk partition tables where the -ending sector in the MBR is incorrect. +This option is probably only useful for ports with +.Xr fdisk 8 +partition tables where the ending sector in the MBR is incorrect. The user may enter .Ql * at the .Dq Size -prompt to indicate the entire size of the disk (minus -the starting sector). -This is useful for disks larger than 8 -gigabytes where the fdisk partition table is incapable of storing -the real size. -.It r -Recalculate free space. -This option should really not be necessary under normal circumstances. -.It a Op part -Add new partition. -This option adds a new BSD partition. -If no partition letter is specified (a-p), the user will be prompted for -one. -.It c Op part +prompt to indicate the entire size of the disk +.Pq minus the starting sector . +This is useful for disks larger than 8 gigabytes where the +fdisk partition table is incapable of storing the real size. +.It Cm c Op Ar part Change the size of an existing partition. If no partition is specified, the user will be prompted for one. The new size may be @@ -361,18 +355,32 @@ in terms of the aforementioned units and may also be prefixed with or .Ql - to change the size by a relative amount. -.It d Op part +.It Cm D +Sets the disk label to the default values as reported by the kernel. +This simulates the case where there is no disk label. +.It Cm d Op Ar part Delete an existing partition (or .Ql * to delete all partitions). If no partition is specified, the user will be prompted for one. -You may not delete the +The .Ql c -partition. -.It g Op d|b|u +partition cannot be deleted. +.It Cm e +Edit drive parameters. +This option is used to set the following parameters: +disk type, a descriptive label string, sectors/track, +tracks/cylinder, sectors/cylinder, number of cylinders, +total sectors, rpm, and interleave. +.It Xo +.Cm g +.Sm off +.Op Ar b | d | u +.Sm on +.Xc Set disk geometry based on what the -.Em disk , .Em BIOS , +.Em disk , or .Em user thinks (the @@ -380,18 +388,20 @@ thinks (the geometry is simply what the label said before .Nm made any changes). -.It D -Sets the disk label to the default values as reported by the kernel. -This simulates the case where there is no disk label. -.It m Op part +.It Cm M +Display this manual page. +.It Cm m Op Ar part Modify parameters for an existing partition. If no partition is specified, the user will be prompted for one. This option allows -the user to change the filesystem type, starting offset, partition -size, block fragment size, block size, and cylinders per group for -the specified partition (not all parameters are configurable for -non-BSD partitions). -.It n Op part +the user to change the filesystem type, starting offset, partition size, +and mount point for the specified partition. +If expert mode is enabled (see +.Cm X +below), then block fragment size, block size, and cylinders per group +can also be modified. +Note that not all parameters are configurable for non-BSD partitions. +.It Cm n Op Ar part Name the mount point for an existing partition. If no partition is specified, the user will be prompted for one. This option is only valid if @@ -399,40 +409,57 @@ This option is only valid if was invoked with the .Fl f flag. -.It s Op path +.It Cm p Op Ar unit +Print the current disk label. +If a +.Em unit +is given, the size and offsets are displayed in terms of the +specified unit. +.It Cm 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 label. +.It Cm r +Recalculate free space. +This option should really not be necessary under normal circumstances. +.It Cm s Op Ar path Save the label to a file in .Tn ASCII -format (suitable for loading via -the +format (suitable for loading via the .Fl R option). If no path is specified, the user will be prompted for one. -.It w +.It Cm u +Undo +.Pq or redo +last change. +Entering +.Em u +once will undo the last change. +Entering it again will restore the change. +.It Cm w Write the label to disk. This option will commit any changes to the on-disk label. -.It 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 label. -.It x -Exit the editor without saving any changes to the label. -.It X +.It Cm X Toggle .Dq expert mode . -By default, some settings are reserved for experts only (such as the -block and fragment size on ffs partitions). -.It z +By default, some settings are reserved for experts only +(such as the block and fragment size on ffs partitions). +.It Cm x +Exit the editor without saving any changes to the label. +.It Cm z Zeroes out the existing partition table, leaving only the -.Dq c +.Sq c partition. The drive parameters are not changed. .El .Pp -In the restore form of the command, the prototype file used to create -the label should be in the same format as that produced when reading -or editing a label. +In the restore form of the command +.Pq fifth form , +the prototype file used to create the label should be in the same format +as that produced when reading or editing a label. Comments are delimited by -.Ar \&# +.Ar # and newline. As with .Fl w , @@ -440,12 +467,23 @@ any existing bootstrap code will be clobbered if .Fl r is specified and will be unaffected otherwise. .Pp +The sixth form of the command +.Pq protect +is used to control write access to the label area of a disk +so that the label cannot be inadvertantly overwritten. +The +.Fl N +and +.Fl W +options are only available on architectures that support this feature, +such as vax, hp300 and some sparc models. +.Pp The final three forms of .Nm are used to install bootstrap 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 bootstrap code is comprised of one or two boot programs, +depending on the machine. .Pp When installing bootstrap code with the .Fl B @@ -466,7 +504,9 @@ Otherwise, boot program names are derived from the name of the disk. These names are of the form .Pa basename Ns boot -for the primary (or only) bootstrap, and +for the primary +.Pq or only +bootstrap, and .Pf boot Pa basename for the secondary bootstrap; for example, .Pa /usr/mdec/sdboot @@ -477,15 +517,13 @@ if the disk device is .Pp The first of the three boot-installation forms is used to install bootstrap 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 except that they will install bootstrap code in -addition to a new 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 +except that they will install bootstrap code in addition to a new label. .Pp -Note that when a disk has no real BSD disklabel the kernel creates a +Note that when a disk has no real BSD disklabel, the kernel creates a default label so that the disk can be used. This default label will include other partitions found on the disk if they are supported on your architecture. @@ -496,32 +534,33 @@ However, these entries are not dynamic, they are fixed at the time .Nm is run. That means that subsequent changes that affect non-OpenBSD -partitions will not be present in the default label, though you -may update them by hand. +partitions will not be present in the default label, +though they may be updated by hand. To see the default label, run .Nm with the .Fl d flag. -You can then run .Nm -with the +can then be run with the .Fl e -flag and paste any entries you want from the default label into the real -one. +flag and any entries pasted as desired from the default label into the real one. .Sh FILES .Bl -tag -width Pa -compact +.It Pa /etc/disklabels +Directory for backup labels. .It Pa /etc/disktab +Disk description file. .It Pa /usr/mdec/ Ns Em xx Ns boot +Primary bootstrap. .It Pa /usr/mdec/boot Ns Em xx +Secondary bootstrap. .El .Sh EXAMPLES -.Li # disklabel sd0 -.Pp Display the in-core label for sd0 as obtained via -.Pa /dev/rsd0c . +.Pa /dev/rsd0c : .Pp -.Li # disklabel -w -r /dev/rsd0c sd2212 foo +.Dl # disklabel sd0 .Pp Create a label for sd0 based on information for .Dq sd2212 @@ -532,7 +571,7 @@ Any existing bootstrap code will be clobbered. .Fl r flag though.) .Pp -.Li # disklabel -e -r sd0 +.Dl # disklabel -w -r /dev/rsd0c sd2212 foo .Pp Read the on-disk label for sd0, edit it and reinstall in-core as well as on-disk. @@ -542,13 +581,13 @@ flag though.) Existing bootstrap code is unaffected. .Pp -.Li # disklabel -R sd0 mylabel +.Dl # disklabel -e -r sd0 .Pp Restore the on-disk and in-core label for sd0 from information in .Pa mylabel . Existing bootstrap code is unaffected. .Pp -.Li # disklabel -B sd0 +.Dl # disklabel -R sd0 mylabel .Pp Install a new bootstrap on sd0. The boot code comes from @@ -559,7 +598,7 @@ On-disk and in-core labels are unchanged, but on some systems other information may be destroyed. Use with care. .Pp -.Li # disklabel -w -B /dev/rsd0c -b newboot sd2212 +.Dl # disklabel -B sd0 .Pp Install a new label and bootstrap. The label is derived from disktab information for @@ -568,6 +607,8 @@ and installed both in-core and on-disk. The bootstrap code comes from the file .Pa /usr/mdec/newboot . +.Pp +.Dl # disklabel -w -B /dev/rsd0c -b newboot sd2212 .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 @@ -611,7 +652,7 @@ will not install bootstrap code that overlaps it. .Xr disklabel 5 , .Xr disktab 5 , .Xr scan_ffs 8 -.Sh NOTES +.Sh CAVEATS On i386 machines, .Xr installboot 8 is normally used to install boot code. @@ -624,7 +665,7 @@ but this usage is deprecated. .Pp On some machines, such as the sparc, partition tables may not exhibit the full functionality that is described above. -.Sh CAVEATS +.Pp .Nm only supports up to a maximum of 15 partitions, .Sq a |