Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

disklabel(4)

disktab(4)

rz(7)

ra(7)

disklabel(8)  —  Maintenance

NAME

disklabel − Reads and writes disk pack label

SYNOPSIS

/sbin/disklabel [−r] disk

/sbin/disklabel −w [−r] [−t ufs | advfs] disk disktype [packid] [primary-boot secondary-boot]

/sbin/disklabel −e [−r] disk

/sbin/disklabel −R [−r] [−t ufs | advfs] disk protofile [disktype | primary-boot secondary-boot]

/sbin/disklabel [−N | −W] disk

/sbin/disklabel −z disk

DESCRIPTION

The disklabel command can be used to install, examine, or modify the label on a disk drive or pack. 

The disklabel command can be used to change the drive identification or the disk partitions on the drive, or to replace a damaged label or bootstrap.  The disk label is located on one of the first sectors of each disk (usually block 0).  On machines that require a block-0 bootstrap, the label is inserted into the bootstrap program.  This information is used by the system disk driver and by the bootstrap program to determine how to program the drive.  There are several forms of the command that display, install or modify the label on a disk. 

There are two copies of a disk label, one located on the disk and one located in system memory.  Because it is faster to access system memory than to perform I/O, when a system recognizes a disk, it copies the disk label into memory. 

The disk variable specifies the disk (for example, rz0 or /dev/rrz0a).  Note that if the disk partition is not specified, the a partition is used.  The disktype variable specifies the type of disk.  The /etc/disktab file contains a list of disk types and their parameters and partitions. 

If you want disks that are the same type to have different partition parameters, you must have separate /etc/disktab file entries describing each disk, or you must edit the disks’ labels after installation with the −w flag.  If your disk type is not specified in the /etc/disktab file, disklabel uses the default partition information in the driver. 

Each form has an additional option, −r, which causes the label to be read from or written to the disk directly, instead of reading the system’s in-memory copy of the label.  When writing, the in-memory copy is also updated if the parameters are valid.  The −r option must be used if there is no label already on the disk.  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. 

The first form of the command is used to examine the label on the specified disk drive.  It displays all of the parameters associated with the drive and its partition layout.  If the disk has no label or if the partition types on the disk are incorrect, the kernel may have constructed or modified the label.  If you specify the −r flag, the label from the raw disk is displayed instead of the in-memory label. 

The second form of the command, with the −w flag, writes a standard label on the designated drive.  You must specify the disk and the disk type as described in the /etc/disktab file.  The optional packid argument specifies a pack identification string that contains up to 16 characters.   Use quotes around the packid argument if it contains blanks.  If the −r flag is specified with the −w flag, the disk sectors that contain the label and bootstrap are written directly; otherwise the existing label is updated in place without modifying the bootstrap.  In either case, the kernel’s in-memory label is replaced.  Alternate versions of the bootstrap files can be specified with the primary-boot and secondary-boot) arguments.  If an alternate bootstrap is not specified, the standard bootstrap is used. 

The bootstrap programs are located in /mdec.  The names of the bootstrap programs can be specified in the /etc/disktab file, but if they are not specified, the default names use either the basenameboot syntax for the primary (block 0) bootstrap or the bootbasename syntax for the secondary (blocks 1-15 for UFS and blocks 64-95 for AdvFS) bootstrap.  For example, the names are /mdec/rzboot and /mdec/bootrz for a UFS rz-type disk.  If you specify the −t advfs option, the default names use either the basenameboot.advfs syntax for the primary bootstrap or the bootbasename.advfs syntax for the secondary bootstrap (blocks 64-95). 

An existing disk label can be edited by using the −e flag.  The label is read from the in-memory kernel copy, or directly from the disk if the −r flag is specified.  The label is formatted and then sent to an editor.  If no editor is specified with the EDITOR environment variable, the vi editor is used.  If vi is not available, the ed editor is used. 

Note that if an unexpected error occurs during the ed editing session, the following message will appear:

Warning, edit session exited abnormally!

You should re-edit the disk label to ensure that you made the modifications. 

When the editor terminates, the formatted label is reread and used to rewrite the disk label. 

Note that if you replace an existing label with a new label, the existing partition information will be copied to the new label if the new label’s partition is marked unused.  This may cause disklabel to fail and can be avoided by first clearing the disk label with the −z option. 

The following example clears the existing label, writes a new label, and then displays the current label:

# disklabel -z rz6
# disklabel -rw rz6 rzw7s
# disklabel -r rz6
# /dev/rrz6a:
type: SCSI
disk: rzw7s
label:
flags:
bytes/sector: 512
sectors/track: 71
tracks/cylinder: 15
sectors/cylinder: 1065
cylinders: 1900
sectors/unit: 2023500
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  cpg]
  a:   131072        0   unused    1024  8192   # (Cyl.    0 - 123∗)
  b:   262144   131072   unused    1024  8192   # (Cyl.  123∗- 369∗)
  c:  2023500        0   unused    1024  8192   # (Cyl.    0 - 1899)
  d:   163840  1703936   unused    1024  8192   # (Cyl. 1599∗- 1753∗)
  e:    32768  1867776   unused    1024  8192   # (Cyl. 1753∗- 1784∗)
  f:   122956  1900544   unused    1024  8192   # (Cyl. 1784∗- 1899∗)
  g:  1310720   393216   unused    1024  8192   # (Cyl.  369∗- 1599∗)
  h:   319564  1703936   unused    1024  8192   # (Cyl. 1599∗- 1899∗)

If you specify the −R flag, disklabel restores a disk label that was previously formatted and saved in an ASCII file.  The protofile argument specifies the prototype file that is used to create the label.  This file should be in the same format that is produced when reading or editing a label.  Comments are indicated with number signs (#) and newline.  If the −r option is specified, a block-0 bootstrap is installed on the machines that use that type of bootstrap; either the disk type or the names of the bootstrap files must be specified on such machines. 

The −N flag does not allow you to write to the disk pack label area.  The −W flag allows you to write to the disk pack label area.  The label sector is always write-protected when the drive is first opened; the write-enable flag set by −W persists only until all partitions on the drive are closed. 

FLAGS

−eEdits an existing label. 

−t ufs | advfs
Specifies which type of the local file system the boot blocks describe, UFS or AdvFS.

−rReads or writes the label directly to or from the disk, rather than going through the in-memory copy of the label. 

−RRestores a disk label that was formatted in a prior operation and saved in an ASCII file. 

−wWrites a standard label on the designated drive. 

−NDisallows writing of the pack label area on the specified disk. 

−WAllows writing of the pack label area on the specified disk. 

−zZeros (clears) the disk label. 

NOTES

The kernel 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 only a single large partition if a disk is unlabeled; thus the label must be written to the "a" or "c" 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 "a" partition. 

The kernel does not allow file system information to be set "unused" for open partitions.  For example, if you want to set the a partition to "unused," you must write the label using a different partition (such as the c partition).  For example:

# disklabel -w /dev/rrz0c rz56

If a file system exists for an open partition, the existing file system information is copied to the new label.  This preserves the existing information without returning an error. 

FILES

/etc/disktabContains information about disks and drives. 

/mdec/xxbootPrimary bootstrap programs. 

/mdec/bootxxSecondary bootstrap programs. 

RELATED INFORMATION

Files: disklabel(4), disktab(4), rz(7), ra(7)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026