From 1243d610de6f908a3f369493d6ce5c72f112fb27 Mon Sep 17 00:00:00 2001 From: Thomas Nikolajsen Date: Tue, 16 Sep 2008 21:58:06 +0000 Subject: [PATCH] MFC r1.3 r1.13 r1.8 (HEAD): * fix markup of `auto' argument * add `auto' where missing * delete extra synopsis * fix wrong single character quoting Delete false note. Comment out some .Pp's as well. Update disklabel64 doc: - Comment out all reference to boot / bootstrap from 64 bit label, it isn't supported yet. - Add note that this is 64 bit disk label. - Add gpt and newfs_hammer in description on setting up a disk from scratch --- sbin/disklabel64/disklabel64.5 | 36 +-- sbin/disklabel64/disklabel64.8 | 675 ++++++++++++++++++++--------------------- sbin/disklabel64/disklabel64.c | 8 +- 3 files changed, 343 insertions(+), 376 deletions(-) diff --git a/sbin/disklabel64/disklabel64.5 b/sbin/disklabel64/disklabel64.5 index c19766f798..aa1fea7ec7 100644 --- a/sbin/disklabel64/disklabel64.5 +++ b/sbin/disklabel64/disklabel64.5 @@ -34,42 +34,36 @@ .\" .\" @(#)disklabel.5.5 8.1 (Berkeley) 6/5/93 .\" $FreeBSD: src/sbin/disklabel/disklabel.5,v 1.7.2.4 2002/08/21 18:58:16 trhodes Exp $ -.\" $DragonFly: src/sbin/disklabel64/disklabel64.5,v 1.2 2007/08/10 18:28:27 swildner Exp $ +.\" $DragonFly: src/sbin/disklabel64/disklabel64.5,v 1.2.4.1 2008/09/16 21:58:06 thomas Exp $ .\" -.Dd June 5, 1993 +.Dd August 21, 2008 .Dt DISKLABEL64 5 .Os .Sh NAME .Nm disklabel64 -.Nd disk pack label +.Nd 64 bit disk pack label .Sh SYNOPSIS .In sys/disklabel64.h .Sh DESCRIPTION -Each disk or disk pack on a system may contain a disk label +Each disk or disk pack on a system may contain a 64 bit disk label which provides detailed information -about the geometry of the disk and the partitions into which the disk +the disk and the partitions into which the disk is divided. It should be initialized when the disk is formatted, and may be changed later with the .Xr disklabel64 8 program. -This information is used by the system disk driver and by the bootstrap -program to determine how to program the drive -and where to find the file systems on the disk partitions. +This information is used by the system disk driver +to determine how to program the drive. Additional information is used by the file system in order -to use the disk most efficiently and to locate important file system information. +to locate important file system information. The description of each partition contains an identifier for the partition type (standard file system, swap area, etc.). The file system updates the in-core copy of the label if it contains incomplete information about the file system. .Pp -The label is located in sector number -.Dv LABELSECTOR -of the drive, usually sector 0 where it may be found +The label is located in byte number 0 where it may be found without any information about the disk geometry. -It is at an offset -.Dv LABELOFFSET -from the beginning of the sector, to allow room for the initial bootstrap. The disk sector containing the label is normally made read-only so that it is not accidentally overwritten by pack-to-pack copies or swap operations; @@ -81,12 +75,14 @@ which is done as needed by the program. .Pp A copy of the in-core label for a disk can be obtained with the -.Dv DIOCGDINFO +.Dv DIOCGDINFO64 .Xr ioctl 2 ; -this works with a file descriptor for a block or character (``raw'') device +this works with a file descriptor for a block or character +.Pq Dq raw +device for any partition of the disk. The in-core copy of the label is set by the -.Dv DIOCSDINFO +.Dv DIOCSDINFO64 .Xr ioctl 2 . The offset of a partition cannot generally be changed while it is open, nor can it be made smaller while it is open. @@ -94,7 +90,7 @@ One exception is that any change is allowed if no label was found on the disk, and the driver was able to construct only a skeletal label without partition information. Finally, the -.Dv DIOCWDINFO +.Dv DIOCWDINFO64 .Xr ioctl 2 operation sets the in-core label and then updates the on-disk label; there must be an existing label on the disk for this operation to succeed. @@ -103,7 +99,7 @@ by writing to the raw disk. All of these operations are normally done using .Xr disklabel64 8 . .Pp -The format of the disk label is specified in +The format of the 64 bit disk label is specified in .In sys/disklabel64.h . .Sh SEE ALSO .Xr disklabel 5 , diff --git a/sbin/disklabel64/disklabel64.8 b/sbin/disklabel64/disklabel64.8 index 97e3ddb11b..20111a2c9c 100644 --- a/sbin/disklabel64/disklabel64.8 +++ b/sbin/disklabel64/disklabel64.8 @@ -34,9 +34,9 @@ .\" .\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD: src/sbin/disklabel/disklabel.8,v 1.15.2.22 2003/04/17 17:56:34 trhodes Exp $ -.\" $DragonFly: src/sbin/disklabel64/disklabel64.8,v 1.5.2.1 2008/08/04 20:35:47 thomas Exp $ +.\" $DragonFly: src/sbin/disklabel64/disklabel64.8,v 1.5.2.2 2008/09/16 21:58:06 thomas Exp $ .\" -.Dd July 27, 2008 +.Dd August 21, 2008 .Dt DISKLABEL64 8 .Os .Sh NAME @@ -50,7 +50,7 @@ .Fl w .Op Fl r .Op Fl n -.Ar disk Ar disktype/auto +.Ar disk Ar disktype Ns / Ns Cm auto .Oo Ar packid Oc .Nm .Fl e @@ -65,38 +65,35 @@ .Nm .Op Fl NW .Ar disk -.Pp -.Nm -.Fl B -.Oo -.Fl b Ar boot1 -.Fl s Ar boot2 -.Oc -.Ar disk -.Oo Ar disktype/auto Oc -.Nm -.Fl w -.Fl B -.Op Fl n -.Oo -.Fl b Ar boot1 -.Fl s Ar boot2 -.Oc -.Ar disk Ar disktype/auto -.Oo Ar packid Oc -.Nm -.Fl R -.Fl B -.Op Fl n -.Oo -.Fl b Ar boot1 -.Fl s Ar boot2 -.Oc -.Ar disk Ar protofile -.Oo Ar disktype/auto Oc -.Nm -.Fl f Ar slice_start_lba -.Oo Ar options Oc +.\" .Pp +.\" .Nm +.\" .Fl B +.\" .Oo +.\" .Fl b Ar boot1 +.\" .Fl s Ar boot2 +.\" .Oc +.\" .Ar disk +.\" .Oo Ar disktype Ns / Ns Cm auto Oc +.\" .Nm +.\" .Fl w +.\" .Fl B +.\" .Op Fl n +.\" .Oo +.\" .Fl b Ar boot1 +.\" .Fl s Ar boot2 +.\" .Oc +.\" .Ar disk Ar disktype Ns / Ns Cm auto +.\" .Oo Ar packid Oc +.\" .Nm +.\" .Fl R +.\" .Fl B +.\" .Op Fl n +.\" .Oo +.\" .Fl b Ar boot1 +.\" .Fl s Ar boot2 +.\" .Oc +.\" .Ar disk Ar protofile +.\" .Oo Ar disktype Ns / Ns Cm auto Oc .Sh DESCRIPTION The .Nm @@ -107,10 +104,10 @@ the label, it can be used to change the drive identification, the disk 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, -.Nm -can install bootstrap code. +.\" In +.\" addition, +.\" .Nm +.\" can install bootstrap code. .Ss Raw or in-core label The disk label resides close to or at the beginning of each disk slice. For faster access, the kernel maintains a copy in core at all times. @@ -135,22 +132,20 @@ forms require a disk device name, which should always be the raw device name representing the disk or slice. .Dx uses the following scheme for slice numbering: -If the disk doesn't use -.Xr gpt 8 , -but e.g. MBR (typically laid out by +If the disk doesn't use GPT (typically laid out by +.Xr gpt 8 ) , +but e.g.\& MBR (typically laid out by .Xr fdisk 8 ) , -then slice 0, e.g. +then slice 0, e.g.\& .Pa da0s0 , -represents the entire disk regardless of any DOS partitioning, -this is called the compatibility slice, -and slice 1 and onward, e.g. +represents the entire disk regardless of any DOS partitioning. +Slice 0 is called the compatibility slice, +and slice 1 and onward, e.g.\& .Pa da0s1 , represents a .Bx slice. -If the disk does use GPT (typically laid out by -.Xr gpt 8 ) , -then all slices are +If the disk does use GPT then all slices are .Bx slices, slice 0 isn't special, it is just the first slice on the disk. You do not have to include the @@ -196,16 +191,9 @@ To write a standard label, use the form .Fl w .Op Fl r .Op Fl n -.Ar disk Ar disktype/auto +.Ar disk Ar disktype Ns / Ns Cm auto .Oo Ar packid Oc .Pp -.Nm -.Fl w -.Op Fl r -.Op Fl n -.Ar disk -auto -.Pp The required arguments to .Nm are the drive to be labeled and the drive type as described in the @@ -228,17 +216,18 @@ disklabel that would have been written will be printed to stdout. .Pp If the .Fl r -flag is given, the disk sectors containing the label and bootstrap +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 rendered unbootable. -See the boot options below for a method of -writing the label and the bootstrap at the same time. +.\" A side-effect of this is that any existing bootstrap code will be overwritten +.\" and the disk rendered unbootable. +.\" See the boot options below for a method of +.\" writing the label and the bootstrap at the same time. If .Fl r is not specified, -the existing label will be updated via the in-core copy and any bootstrap -code will be unaffected. +the existing label will be updated via the in-core copy. +.\" and any bootstrap code will be unaffected. If the disk does not already have a label, the .Fl r flag must be used. @@ -248,7 +237,7 @@ For a virgin disk that is not known to .Xr disktab 5 , .Ar disktype can be specified as -.Dq auto . +.Cm auto . In this case, the driver is requested to produce a virgin label for the disk. This might or might not be successful, depending on whether the @@ -283,11 +272,11 @@ and then create a disklabel within that slice. This is described later on in this page. -.Pp -Installing a new disklabel does not in of itself allow your system to boot -a kernel using that label. -You must also install boot blocks, which is -described later on in this manual page. +.\" .Pp +.\" Installing a new disklabel does not in of itself allow your system to boot +.\" a kernel using that label. +.\" You must also install boot blocks, which is +.\" described later on in this manual page. .Ss Editing an existing disk label To edit an existing disk label, use the form .Pp @@ -310,9 +299,9 @@ environment variable, is used. When the editor terminates, the label file is used to rewrite the disk label. -Existing bootstrap code is unchanged regardless of whether -.Fl r -was specified. +.\" Existing bootstrap code is unchanged regardless of whether +.\" .Fl r +.\" was specified. If .Fl n is specified, no data will be written to the device, and instead the @@ -334,14 +323,14 @@ in ASCII format. 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 \&# +.Ql # and newline. -As when writing a new label, any existing bootstrap code will be -clobbered if -.Fl r -is specified and will be unaffected otherwise. -See the boot options below for a -method of restoring the label and writing the bootstrap at the same time. +.\" As when writing a new label, any existing bootstrap code will be +.\" clobbered if +.\" .Fl r +.\" is specified and will be unaffected otherwise. +.\" See the boot options below for a +.\" method of restoring the label and writing the bootstrap at the same time. If .Fl n is used, no data will be written to the device, and instead the @@ -370,144 +359,145 @@ command .Nm .Fl N .Ar disk -.Ss Installing bootstraps -The final three forms of -.Nm -are used to install bootstrap code. -If you are creating a -.Dq dangerously-dedicated -slice for compatibility with older PC systems, -you generally want to specify the compatibility slice, such as -.Pa da0s0 . -If you are creating a label within an existing DOS slice, -you should specify -the slice name such as -.Pa da0s1 . -Making a slice bootable can be tricky. -If you are using a normal DOS -slice you typically install (or leave) a standard MBR on the base disk and -then install the -.Dx -bootblocks in the slice. -.Pp -.Nm -.Fl B -.Oo -.Fl b Ar boot1 -.Fl s Ar boot2 -.Oc -.Ar disk -.Oo Ar disktype Oc -.Pp -This form installs the bootstrap only. -It does not change the disk label. -You should never use this command on the compatibility slice unless you -intend to create a -.Dq dangerously-dedicated -disk, such as -.Ar da0s0 . -This command is typically run on a -.Bx -slice such as -.Ar da0s1 . -.Pp -.Nm -.Fl w -.Fl B -.Op Fl n -.Oo -.Fl b Ar boot1 -.Fl s Ar boot2 -.Oc -.Ar disk Ar disktype -.Oo Ar packid Oc -.Pp -This form corresponds to the -.Dq write label -command described above. -In addition to writing a new volume label, it also installs the bootstrap. -If run on the compatibility slice this command will create a -.Dq dangerously-dedicated -label. -This command is normally run on a -.Bx -slice rather than the compatibility -slice. -If -.Fl n -is used, no data will be written to the device, and instead the -disklabel that would have been written will be printed to stdout. -.Pp -.Nm -.Fl R -.Fl B -.Op Fl n -.Oo -.Fl b Ar boot1 -.Fl s Ar boot2 -.Oc -.Ar disk Ar protofile -.Oo Ar disktype Oc -.Pp -This form corresponds to the -.Dq restore label -command described above. -In addition to restoring the volume label, it also installs the bootstrap. -If run on the compatibility slice this command will create a -.Dq dangerously-dedicated -label. -This command is normally run on a -.Bx -slice rather than the compatibility -slice. -.Pp -The bootstrap commands always access the disk directly, so it is not necessary -to specify the -.Fl r -flag. -If -.Fl n -is used, no data will be written to the device, and instead the -disklabel that would have been written will be printed to stdout. -.Pp -The bootstrap code is comprised of two boot programs. -Specify the name of the -boot programs to be installed in one of these ways: -.Bl -enum -.It -Specify the names explicitly with the -.Fl b -and -.Fl s -flags. -.Fl b -indicates the primary boot program and -.Fl s -the secondary boot program. -The boot programs are located in -.Pa /boot . -.It -If the -.Fl b -and -.Fl s -flags are not specified, but -.Ar disktype -was specified, the names of the programs are taken from the -.Dq b0 -and -.Dq b1 -parameters of the -.Xr disktab 5 -entry for the disk if the disktab entry exists and includes those parameters. -.It -Otherwise, the default boot image names are used: -.Pa /boot/boot1 -and -.Pa /boot/boot2 -for the standard stage1 and stage2 boot images. -.El -.Ss Initializing/Formatting a bootable disk from scratch +.\" .Ss Installing bootstraps +.\" The final three forms of +.\" .Nm +.\" are used to install bootstrap code. +.\" If you are creating a +.\" .Dq dangerously-dedicated +.\" slice for compatibility with older PC systems, +.\" you generally want to specify the compatibility slice, such as +.\" .Pa da0s0 . +.\" If you are creating a label within an existing DOS slice, +.\" you should specify +.\" the slice name such as +.\" .Pa da0s1 . +.\" Making a slice bootable can be tricky. +.\" If you are using a normal DOS +.\" slice you typically install (or leave) a standard MBR on the base disk and +.\" then install the +.\" .Dx +.\" bootblocks in the slice. +.\" .Pp +.\" .Nm +.\" .Fl B +.\" .Oo +.\" .Fl b Ar boot1 +.\" .Fl s Ar boot2 +.\" .Oc +.\" .Ar disk +.\" .Oo Ar disktype Ns / Ns Cm auto Oc +.\" .Pp +.\" This form installs the bootstrap only. +.\" It does not change the disk label. +.\" You should never use this command on the compatibility slice unless you +.\" intend to create a +.\" .Dq dangerously-dedicated +.\" disk, such as +.\" .Ar da0s0 . +.\" This command is typically run on a +.\" .Bx +.\" slice such as +.\" .Ar da0s1 . +.\" .Pp +.\" .Nm +.\" .Fl w +.\" .Fl B +.\" .Op Fl n +.\" .Oo +.\" .Fl b Ar boot1 +.\" .Fl s Ar boot2 +.\" .Oc +.\" .Ar disk Ar disktype Ns / Ns Cm auto +.\" .Oo Ar packid Oc +.\" .Pp +.\" This form corresponds to the +.\" .Dq write label +.\" command described above. +.\" In addition to writing a new volume label, it also installs the bootstrap. +.\" If run on the compatibility slice this command will create a +.\" .Dq dangerously-dedicated +.\" label. +.\" This command is normally run on a +.\" .Bx +.\" slice rather than the compatibility +.\" slice. +.\" If +.\" .Fl n +.\" is used, no data will be written to the device, and instead the +.\" disklabel that would have been written will be printed to stdout. +.\" .Pp +.\" .Nm +.\" .Fl R +.\" .Fl B +.\" .Op Fl n +.\" .Oo +.\" .Fl b Ar boot1 +.\" .Fl s Ar boot2 +.\" .Oc +.\" .Ar disk Ar protofile +.\" .Oo Ar disktype Ns / Ns Cm auto Oc +.\" .Pp +.\" This form corresponds to the +.\" .Dq restore label +.\" command described above. +.\" In addition to restoring the volume label, it also installs the bootstrap. +.\" If run on the compatibility slice this command will create a +.\" .Dq dangerously-dedicated +.\" label. +.\" This command is normally run on a +.\" .Bx +.\" slice rather than the compatibility +.\" slice. +.\" .Pp +.\" The bootstrap commands always access the disk directly, so it is not necessary +.\" to specify the +.\" .Fl r +.\" flag. +.\" If +.\" .Fl n +.\" is used, no data will be written to the device, and instead the +.\" disklabel that would have been written will be printed to stdout. +.\" .Pp +.\" The bootstrap code is comprised of two boot programs. +.\" Specify the name of the +.\" boot programs to be installed in one of these ways: +.\" .Bl -enum +.\" .It +.\" Specify the names explicitly with the +.\" .Fl b +.\" and +.\" .Fl s +.\" flags. +.\" .Fl b +.\" indicates the primary boot program and +.\" .Fl s +.\" the secondary boot program. +.\" The boot programs are located in +.\" .Pa /boot . +.\" .It +.\" If the +.\" .Fl b +.\" and +.\" .Fl s +.\" flags are not specified, but +.\" .Ar disktype +.\" was specified, the names of the programs are taken from the +.\" .Dq b0 +.\" and +.\" .Dq b1 +.\" parameters of the +.\" .Xr disktab 5 +.\" entry for the disk if the disktab entry exists and includes those parameters. +.\" .It +.\" Otherwise, the default boot image names are used: +.\" .Pa /boot/boot1 +.\" and +.\" .Pa /boot/boot2 +.\" for the standard stage1 and stage2 boot images. +.\" .El +.\" .Ss Initializing/Formatting a bootable disk from scratch +.Ss Initializing/Formatting a disk from scratch To initialize a disk from scratch the following sequence is recommended. Please note that this will wipe everything that was previously on the disk, including any @@ -516,8 +506,10 @@ slices. .Bl -enum .It Use +.Xr gpt 8 +or .Xr fdisk 8 -to initialize the hard disk, and create a slice table, referred to +to initialize the hard disk, and create a GPT or MBR slice table, referred to as the .Dq "partition table" in @@ -531,6 +523,8 @@ slices created in the previous step. .It Finally use .Xr newfs 8 +or +.Xr newfs_hammer 8 to create file systems on new partitions. .El .Pp @@ -559,24 +553,28 @@ and finally a partition for .Pa /home (usually all remaining space). +If you are tight on space all sizes can be halved. Your mileage may vary. .Pp -.Nm fdisk Fl BI Pa da0 +.Nm gpt create Pa da0 +.Pp +.Nm gpt add Pa da0 .Pp .Nm -.Fl w B -.Pa da0s1 +.\" .Fl w B +.Fl r w +.Pa da0s0 .Cm auto .Pp .Nm .Fl e -.Pa da0s1 +.Pa da0s0 .Sh FILES .Bl -tag -width ".Pa /etc/disktab" -compact -.It Pa /boot/boot1 -Default stage1 boot image. -.It Pa /boot/boot2 -Default stage2 boot image. +.\" .It Pa /boot/boot1 +.\" Default stage1 boot image. +.\" .It Pa /boot/boot2 +.\" Default stage2 boot image. .It Pa /etc/disktab Disk description file. .El @@ -656,9 +654,6 @@ The partition identifier is a single letter in the range .Ql a to .Ql p . -By convention, partition -.Ql c -is reserved to describe the entire disk. .It Ar size The size of the partition in sectors, .Cm K @@ -727,25 +722,6 @@ for more details). .Pp The remainder of the line is a comment and shows the size of the partition in MB. -.Pp -.Dx -no longer snoop-adjusts the on-disklabel when reading or writing -raw labels. -.Nm -is now responsible for adjusting the label when operating in raw mode. -Traditional (32 bit -.Bx ) -disklabels store offsets as absolute block numbers -rather than slice-relative block numbers. -If -.Nm -is unable to issue the -.Dv DIOCGPART -ioctl to get slice information it will -refuse to read or write the label in raw mode. -The -.Fl f -option may be used to force the operation by supplying a manual offset. .Sh EXAMPLES .Dl "disklabel64 da0s1" .Pp @@ -776,15 +752,15 @@ based on information for .Dq da2212 found in .Pa /etc/disktab . -Any existing bootstrap code will be clobbered -and the disk rendered unbootable. +.\" Any existing bootstrap code will be clobbered +.\" and the disk rendered unbootable. .Pp .Dl "disklabel64 -e -r da0s1" .Pp Read the on-disk label for .Pa da0s1 , edit it, and reinstall in-core as well as on-disk. -Existing bootstrap code is unaffected. +.\" Existing bootstrap code is unaffected. .Pp .Dl "disklabel64 -e -r -n da0s1" .Pp @@ -802,8 +778,7 @@ Try to auto-detect the required information from and write a new label to the disk. Use another .Nm Fl e -command to edit the -partitioning and file system information. +command to edit the partitioning information. .Pp .Dl "disklabel64 -R da0s1 savedlabel" .Pp @@ -811,7 +786,7 @@ Restore the on-disk and in-core label for .Pa da0s1 from information in .Pa savedlabel . -Existing bootstrap code is unaffected. +.\" Existing bootstrap code is unaffected. .Pp .Dl "disklabel64 -R -n da0s1 label_layout" .Pp @@ -826,44 +801,44 @@ or .Cm * partition sizes. .Pp -.Dl disklabel64 -B da0s1 -.Pp -Install a new bootstrap on -.Pa da0s1 . -The boot code comes from -.Pa /boot/boot1 -and possibly -.Pa /boot/boot2 . -On-disk and in-core labels are unchanged. -.Pp -.Dl disklabel64 -w -B /dev/da0s1 -b newboot1 -s newboot2 da2212 -.Pp -Install a new label and bootstrap. -The label is derived from disktab information for -.Dq da2212 -and installed both in-core and on-disk. -The bootstrap code comes from the files -.Pa /boot/newboot1 -and -.Pa /boot/newboot2 . -.Pp -.Dl dd if=/dev/zero of=/dev/da0 bs=512 count=32 -.Dl fdisk -BI da0 -.Dl dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 -.Dl disklabel64 -w -B da0s1 auto -.Dl disklabel64 -e da0s1 -.Pp -Completely wipe any prior information on the disk, creating a new bootable -disk with a DOS partition table containing one -.Dq whole-disk -slice. -Then -initialize the slice, then edit it to your needs. -The -.Pa dd -commands are optional, but may be necessary for some BIOSes to properly -recognize the disk. -.Pp +.\" .Dl disklabel64 -B da0s1 +.\" .Pp +.\" Install a new bootstrap on +.\" .Pa da0s1 . +.\" The boot code comes from +.\" .Pa /boot/boot1 +.\" and possibly +.\" .Pa /boot/boot2 . +.\" On-disk and in-core labels are unchanged. +.\" .Pp +.\" .Dl disklabel64 -w -B /dev/da0s1 -b newboot1 -s newboot2 da2212 +.\" .Pp +.\" Install a new label and bootstrap. +.\" The label is derived from disktab information for +.\" .Dq da2212 +.\" and installed both in-core and on-disk. +.\" The bootstrap code comes from the files +.\" .Pa /boot/newboot1 +.\" and +.\" .Pa /boot/newboot2 . +.\" .Pp +.\" .Dl dd if=/dev/zero of=/dev/da0 bs=512 count=32 +.\" .Dl fdisk -BI da0 +.\" .Dl dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 +.\" .Dl disklabel64 -w -B da0s1 auto +.\" .Dl disklabel64 -e da0s1 +.\" .Pp +.\" Completely wipe any prior information on the disk, creating a new bootable +.\" disk with a DOS partition table containing one +.\" .Dq whole-disk +.\" slice. +.\" Then +.\" initialize the slice, then edit it to your needs. +.\" The +.\" .Pa dd +.\" commands are optional, but may be necessary for some BIOSes to properly +.\" recognize the disk. +.\" .Pp This is an example disklabel that uses some of the new partition size types such as .Cm % , M , G , @@ -908,40 +883,41 @@ 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 if a disk is unlabeled; thus, the label must be written to the -.Dq a +.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 setting the label on the new partition while shrinking the -.Dq a +.Ql a partition. -.Pp -On some machines the bootstrap code may not fit entirely in the area -allocated for it by some file systems. -As a result, it may not be possible to have file systems on some partitions -of a -.Dq bootable -disk. -When installing bootstrap code, -.Nm -checks for these cases. -If the installed boot code would overlap a partition of type -.Dv FS_UNUSED -it is marked as type -.Dv FS_BOOT . -The -.Xr newfs 8 -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 , -.Nm -will not install bootstrap code that overlaps it. +.\" .Pp +.\" On some machines the bootstrap code may not fit entirely in the area +.\" allocated for it by some file systems. +.\" As a result, it may not be possible to have file systems on some partitions +.\" of a +.\" .Dq bootable +.\" disk. +.\" When installing bootstrap code, +.\" .Nm +.\" checks for these cases. +.\" If the installed boot code would overlap a partition of type +.\" .Dv FS_UNUSED +.\" it is marked as type +.\" .Dv FS_BOOT . +.\" The +.\" .Xr newfs 8 +.\" 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 , +.\" .Nm +.\" will not install bootstrap code that overlaps it. .Sh SEE ALSO +.Xr dd 1 , .Xr uuid 3 , .Xr ccd 4 , .Xr disklabel64 5 , @@ -951,41 +927,34 @@ will not install bootstrap code that overlaps it. .Xr disklabel 8 , .Xr fdisk 8 , .Xr gpt 8 , +.Xr newfs 8 , +.Xr newfs_hammer 8 , .Xr vinum 8 .Sh BUGS -Installing a -.Xr disklabel 8 -label on a slice with a -.Nm -label installed requires reboot. First the existing label -has to be overwritten, eg. by -.Xr dd 1 , -see above, then a reboot is required before the new label can be installed. -.Pp -For the i386 architecture, the primary bootstrap sector contains -an embedded -.Em fdisk -table. -The -.Nm -utility takes care to not clobber it when installing a bootstrap only -.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 -table by the dummy one in the bootstrap program. -This is only of -concern if the disk is fully dedicated, so that the -.Bx -disklabel -starts at absolute block 0 on the disk. -.Pp +.\" For the i386 architecture, the primary bootstrap sector contains +.\" an embedded +.\" .Em fdisk +.\" table. +.\" The +.\" .Nm +.\" utility takes care to not clobber it when installing a bootstrap only +.\" .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 +.\" table by the dummy one in the bootstrap program. +.\" This is only of +.\" concern if the disk is fully dedicated, so that the +.\" .Bx +.\" disklabel +.\" starts at absolute block 0 on the disk. +.\" .Pp The .Nm utility diff --git a/sbin/disklabel64/disklabel64.c b/sbin/disklabel64/disklabel64.c index 8a250ce8a7..7bf8aebcb5 100644 --- a/sbin/disklabel64/disklabel64.c +++ b/sbin/disklabel64/disklabel64.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.6 2008/07/10 03:15:56 thomas Exp $ + * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.6.2.1 2008/09/16 21:58:06 thomas Exp $ */ /* * Copyright (c) 1987, 1993 @@ -71,7 +71,7 @@ * @(#)disklabel.c 1.2 (Symmetric) 11/28/85 * @(#)disklabel.c 8.2 (Berkeley) 1/7/94 * $FreeBSD: src/sbin/disklabel/disklabel.c,v 1.28.2.15 2003/01/24 16:18:16 des Exp $ - * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.6 2008/07/10 03:15:56 thomas Exp $ + * $DragonFly: src/sbin/disklabel64/disklabel64.c,v 1.6.2.1 2008/09/16 21:58:06 thomas Exp $ */ #include @@ -1511,7 +1511,7 @@ Warning(const char *fmt, ...) void usage(void) { - fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n", "usage: disklabel64 [-r] disk", "\t\t(to read label)", " disklabel64 -w [-r] [-n] disk type [ packid ]", @@ -1520,12 +1520,14 @@ usage(void) "\t\t(to edit label)", " disklabel64 -R [-r] [-n] disk protofile", "\t\t(to restore label with existing boot program)", +#if 0 " disklabel64 -B [-n] [ -b boot1 [ -s boot2 ] ] disk [ type ]", "\t\t(to install boot program with existing label)", " disklabel64 -w -B [-n] [ -b boot1 [ -s boot2 ] ] disk type [ packid ]", "\t\t(to write label and boot program)", " disklabel64 -R -B [-n] [ -b boot1 [ -s boot2 ] ] disk protofile [ type ]", "\t\t(to restore label and boot program)", +#endif " disklabel64 [-NW] disk", "\t\t(to write disable/enable label)"); exit(1); -- 2.11.4.GIT