DISK(8)

NAME
disk - disk initialization and diagnosis

SYNOPSIS
/sbin/disk [ option flags ] [ action flags ] raw-device

DESCRIPTION
The disk utility program can be used to initialize, inspect, repair, and configure optical, floppy and SCSI disks.

The option flags are used with the -i action flag to specify certain parameters when initializing a disk:

-h hostname
    Specifies a hostname to be stored in the disk label. The actual hostname of a machine is not determined by the disk label, but in the case of removable optical media this field may be set for informational purposes to indicate which machine the disk belongs to.

-l labelname
    The labelname of a disk is printed in the message log when the system boots. For optical media this is also the name used as the mount point in the / directory when the disk is automounted.

-t disk_type
    The disk configuration information in /etc/disktab is named by an identifier called the disk type. By default, when the disk program is run it will attempt to determine the proper disk type to use. Use this flag to override the default. This is used to reinitialize a disk using a different set of configuration parameters from /etc/disktab (e.g. a different number and/or size of filesystem partition(s)).

The action flags are used to perform a specific command in the disk program (only one may be specified):

-i  This flag will initialize a disk including writing out a new disk label containing information about the host name, label name and information found in /etc/disktab. A boot program will be installed onto the boot block area of the disk from the file /usr/standalone/boot. If specified in the configuration information in /etc/disktab, the initialize flag will also build empty UFS filesystems on the disk. The initialize flag will destroy all data on the disk. WARNING: Don't initialize a mounted device. Example: "/sbin/disk -h myhost -l mydisk -i /dev/rod0a"

-e  This flag will eject ejectable media. No attempt is made to unmount the filesystems on this disk before ejecting.

-b  The boot program in /usr/standalone/boot will be written onto the boot block area of the disk.

-B  Same as -b, except that it takes as an argument the pathname of the file containing data to be written onto the boot block area of the disk.

-p partitionsize
    The first partition of a two-partition disk will be partitionsize, and the second partition uses the remainder of the disk. The partitionsize is in units of the native blocksize of the device (minimum 1K). The -p option only has meaning when used with -i.

-q  The default disk type information returned by the device driver for this disk will be printed. This flag is used by the Builddisk application to determine what kind of disk is present.

-s  If the device driver keeps any special statistics for the disk they will be printed with this flag.

-F  This flag formats the disk.

-H hostname
    This flag can be used to change the hostname field of the disk label without disturbing other fields in the label.

-L labelname
    This flag can be used to change the labelname field of the disk label without disturbing other fields in the label.

If no action flags are specified the program operates in an interactive mode. In interactive mode type the interrupt character at any time to abort the current command. Typing '?' will list the available commands. Many of the commands will prompt for additional arguments or sub-commands. There are many interactive commands in addition to the ones described by the option flags above:

read, write, verify, rw, rwr
    These commands will read, write and verify data on the disk. All block numbers used in these commands are absolute disk block numbers and do not correspond to block numbers reported from the filesystem. No bad sector forwarding or additions are performed with these commands. On an optical disk, these commands can be used to write a sector that has become unreadable due to an uncorrectable ECC errors. WARNING: These commands may destroy disk data.

look, set
    These commands may be used to inspect and modify the data buffers used in the read and write commands described above.

abort
    This command toggles whether an error will stop the read and write commands described above.

label
    This command is used to print and change information in the disk label. To change only the hostname or labelname fields use the -H hostname or -L labelname action flags described earlier.

bad Use this command to display and edit the bad block table maintained on optical disks.

bitmap
    Use this command to display and edit the sector status bitmap maintained on optical disks.

scan
    The scan command sequentially searches the disk for file system super blocks and prints the file system block number where they are found. This information is essential if the primary super block of a file system is damaged and one needs to specify an alternate super block location to the file system check program fsck but one does not know which block number to specify. (e.g. "fsck -bnnn /dev/rod0a" where "nnn" is the block number of the alternate super block). A list of these block numbers is produced when a file system is initialized with the newfs command, but this list usually isn't around when needed.

FILES

/etc/disktab
    for disk geometry and partition layout information

/usr/standalone/boot
    the default program written onto the boot block area

SEE ALSO
disktab(5)

BUGS
Like all low-level diagnostics written early in the life of a new computer, this program exhibits evolutionary development. Some features may be difficult to understand or not work exactly as advertised.