NAME | SYNOPSIS | DESCRIPTION | SAVED FILE FORMAT | FILES | EXAMPLES | ATTRIBUTES | SEE ALSO | DIAGNOSTICS | BUGS | RESTRICTIONS FOR ChorusOS
disklabel is a target utility.
The disklabel command can be used to install, examine, modify or restore 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.
There are four forms of the command that read (display), install, or rewrite the label on a disk. The first three forms have an additional 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 without microkernel 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 first form of the command (read) is used to examine the label on the named disk drive (for example, sd0 or /dev/rsd0c). It will display all of the parameters associated with the drive and its partition layout. Unless the -r flag is set, the microkernel'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 microkernel may have constructed or modified the label. If the -r. flag is set, the label from the raw disk will be displayed rather than the in-core label.
The second form of the command, with the -w flag set, is used to write a standard label on the designated drive. The required arguments to disklabel are the drive to be labelled (for example, sd0), and the drive type as described in the disktab(4CC) 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 packid parameter must be quoted if it contains blanks.
If the -r flag is set, 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 for any kind of operating system. If -r is not specified, 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 -r flag must be used. In either case, the microkernel's in-core label is replaced.
When updating the label, disklabel first tries to detect any existing valid DOS partitions on the disk. If any are found, disklabel notifies the user and asks for confirmation. This confirmation can be suppressed by using the -y argument (assuming a yes response) or the -n argument (assuming a no response) to all questions. These arguments allow disklabel to be run in an unattended mode.
The third form of the disklabel is used with the -R flag to restore a disk label that was previously saved in an ASCII file (such as by typing a command: disklabel disk > protofile).
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 # and newline. This form is useful when you want to use a disk dedicated to ChorusOS and want an easy way to define a single whole-disk partition.
If the -r flag is set, 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 for any kind of operating system. If -r is not specified, 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 -r flag must be used. In either case, the microkernel's in-core label is replaced.
When updating the label, disklabel first tries to detect any existing valid DOS partitions on the disk. If any are found, disklabel notifies the user and asks for confirmation. This confirmation can be suppressed by using the -y argument (assuming a yes response) or the -n argument (assuming a no response) to all questions. These arguments allow disklabel to be run in unattended mode.
The fourth form of the disklabel command is used to enable and disable writing to the disk label area.
By default it is not possible to write to the disk label area at the beginning of a disk. The disk driver silently ignores any attempt to do so. If you need to write to this area (for example, to obliterate the label) use the following command:
disklabel -W disk
To inhibit writing to the label area after previously allowing it, use the following command:
disklabel -N disk
disklabel uses an ASCII version of the label when examining, editing or restoring a disk label. The format is as follows:
# /dev/da0c: type: SCSI disk: da0c label: flags: bytes/sector: 512 sectors/track: 51 tracks/cylinder: 19 sectors/cylinder: 969 cylinders: 1211 sectors/unit: 1173930 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # milliseconds track-to-track seek: 0 # milliseconds drivedata: 0 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 81920 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 84*) b: 160000 81920 swap # (Cyl. 84* - 218*) c: 1173930 0 unused 0 0 # (Cyl. 0 - 1211*) h: 962010 211920 4.2BSD # (Cyl. 218*- 1211*)
Lines starting with a # mark are comments. Most of the other specifications are no longer used. The ones which must still be set correctly are:
An optional label, set by the packid option when writing a label.
Flags may be removable, ecc or badsect. removable is set for removable media drives, but no current ChorusOS driver evaluates this flag. ecc is no longer supported; badsect specifies that the drive can perform bad sector remapping.
Describes the total size of the disk. This value must be correct.
The UNIX partition table.
The partition table can have up to 8 entries. It contains the following information:
The partition identifier is a single letter in the range a to h. By convention, partition c is reserved to describe the entire disk.
The size of the partition in sectors.
The offset of the start of the partition from the beginning of the drive.
Describes the purpose of the partition. The example shows most normal usages. For UFS file systems, use type 4.2BSD. See /usr/include/sys/disklabel.h for a complete list.
For file systems only, the fragment size.
For file systems only, the block size.
For UFS file systems, the number of cylinders in a cylinder group. For LFS file systems, the segment shift value.
The remainder of the line is a comment and shows the cylinder allocations based on the obsolete (but possibly correct) geometry information about the drive. The asterisk (*) indicates that the partition does not begin or end exactly on a cylinder boundary.
/etc/disktab
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.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
The microkernel device drivers do 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 a single large partition if a disk is unlabeled; the label must therefore 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, and the second setting the label on the new partition while shrinking the ``a'' partition.
The newfs(1M) utility disallows creation of filesystems on FS_BOOT partitions.
When a disk name is given without a full pathname, the constructed device name uses the ``c'' partition.
DOS file systems are not supported on the first partition, a. They are only for partitions b, d, e, f, g and h. Making a DOS file system on the first partition will return that this partition is in read-only and no information is written to the disk.
Originally, this utility was able to install bootstrap code. Options related to bootstrap installation (-B, -b -s) are not supported in this version.
Restoring labels is not supported (-e option).
NAME | SYNOPSIS | DESCRIPTION | SAVED FILE FORMAT | FILES | EXAMPLES | ATTRIBUTES | SEE ALSO | DIAGNOSTICS | BUGS | RESTRICTIONS FOR ChorusOS