Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > M


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


mediainit — initialize disk or partition DDS tape


mediainit [-vr] [-f fmt_optn] [-i interleave] [-p size] pathname


mediainit initializes mass storage media by formatting the media, writing and reading test patterns to verify media integrity, then sparing any defective blocks found. This process prepares the disk or tape for error-free operation. Initialization destroys all existing user data in the area being initialized.

mediainit can also used for partitioning DDS tape media. See the -p option below for further details.


The following command options are recognized. They can be specified in any order, but all must precede the pathname. Options without parameters can be listed individually or grouped together. Options with parameters must be listed individually, but white space between the option and its parameter is discretionary.


Normally, mediainit provides only fatal error messages which are directed to standard error. The -v (verbose) option sends device-specific information related to low-level operation of mediainit to standard output (stdout). This option is most useful to trained service personnel because it usually requires detailed knowledge of device operation before the information can be interpreted correctly.


(re-certify) This option forces a complete tape certification whether or not the tape has been certified previously. All record of any previously spared blocks is discarded, so any bad blocks will have to be rediscovered. This option should be used only if:

  • It is suspected that numerous blocks on the tape have been spared which should not have been, or

  • It is necessary to destroy (overwrite) all previous data on the tape.

-f fmt_optn

The format option is a device-specific number in the range 0 through 239. It is intended solely for use with certain SS/80 devices that support multiple media formats (independent from interleave factor). For example, certain microfloppy drives support 256-, 512-, and 1024-byte sectors. mediainit passes any supplied format option directly through to the device. The device then either accepts the format option if it is supported, or rejects it if it is not supported. Refer to device operating manuals for additional information. The default format option is 0.

-i interleave

The interleave factor, interleave, refers to the relationship between sequential logical records and sequential physical records. It defines the number of physical records on the media that lie between the beginning points of two consecutively numbered logical records. The choice of interleave factor can have a substantial impact on disk performance.

-p size

Partition DDS cartridge media into two logical separate volumes: partition 0 and partition 1:

  • size specifies the minimum size of partition 1 (in MB). The maximum allowed value is 1200.

  • Partition 0 is the remainder of the tape (partition 0 physically follows partition 1 on the tape).

The actual size of partition 1 is somewhat larger than the requested size to allow for tape media errors during writing. Thus, a size of 400 formats the DDS tape into two partitions where partition 1 holds at least 400 megabytes of data, and the remainder of the tape is used for partition 0 (for a 1300 MB DDS cartridge, this means that partition 0 has a size somewhat less than 900 MB).

Note that it is unnecessary to format a DDS tape before use unless the tape is being partitioned. Unformatted DDS media does not require initialization when used as a single partition tape. Accessing partition 1 on a single-partition tape produces an error. To change a two-partition tape to single-partition, use mediainit with 0 specified as the size.


pathname is the path name to the character (raw) device special file associated with the device unit or volume that is to be initialized. mediainit aborts if you lack either read or write permission to the device special file, or if the device is currently open for any other process. This prevents accidental initialization of the root device or any mounted volume. mediainit locks the unit or volume being initialized so that no other processes can access it.

Except for SCSI devices, pathname must be a device special file whose minor number of the device being initialized has the diagnostic bit set. For device special files with the diagnostic bit set, the section number is meaningless. The entire device is accessed.

When a given unit contains multiple volumes as defined by the drive controller, any available unit or volume associated with that controller can be initialized, independent of other units and volumes that share the same controller. Thus, you can initialize one unit or volume to any format or interleave factor without affecting formats or data on companion units or volumes. However, be aware that the entire unit or volume (as defined by the drive controller) is initialized without considering the possibility that it may be subdivided into smaller structures by the the operating software. When such structures exist, unexpected loss of data is possible.

mediainit dominates controller resources and limits access by competing processes to other units or volumes sharing the same controller. If other simultaneous processes need access to the same controller, some access degradation can be expected until initialization is complete; especially if you are initializing a tape cartridge in a drive that shares the root disk controller.

In general, mediainit attempts to carefully check any -f (format option) or -i (interleave options) supplied, and aborts if an option is out of range or inappropriate for the media being initialized. Specifying an interleave factor or format option value of 0 has the same effect as not specifying the option at all.

For disks that support interleave factors, the acceptable range is usually 1 (no interleave) through n-1, where n is the number of sectors per track. Refer to the appropriate device operating manual for recommended values.

If a disk being initialized requires an interleave factor but none is specified, mediainit provides an appropriate, though not necessarily optimum default.

When a given device supports format options, the allowable range of interleave factors may be related to the specified format option. In such instances, mediainit cannot check the interleave factor if one is specified.


Most types of mass storage media must be initialized before they can be used. HP hard disks, flexible disks, and cartridge tapes require some form of initialization, but 9-track tapes do not. Initialization usually involves formatting the media, writing and reading test patterns, then sparing any defective blocks. Depending upon the media and device type, none, some, or all of the initialization process may have been performed at the factory. mediainit completes whatever steps are appropriate to prepare the media for error-free operation.

Most HP hard disks are formatted and exhaustively tested at the factory by use of a process more thorough but also more time-consuming than appropriate for mediainit. However, mediainit is still valuable for ensuring the integrity of the media after factory shipment, formatting with the correct interleave factor, and sparing any blocks which may have become defective since original factory testing was performed.

HP flexible disks are not usually formatted prior to shipment, so they must undergo the entire initialization process before they can be used.

When a tape is certified, it is thoroughly tested and defective blocks are spared. mediainit usually certifies a tape only if it has not been certified previously. If the tape has been previously certified and spared, mediainit usually reorganizes the tape's spare block table, retaining any previous spares, and optimizing their assignment for maximum performance under sequential access. Reorganizing the spare block table takes only a few seconds, whereas complete certification takes about a half-hour for 150-foot tapes, and over an hour for 600-foot tapes.

Reorganization of a tape's spare block table technically renders any existing data undefined, but the data is not usually destroyed by overwriting. To ensure that old tape data is destroyed, which is useful for security, complete tape re-certification can be forced with the -r option.

Some applications may require that a file system be placed on the media before use. mediainit does not create a file system; it only prepares media for writing and reading. If such a file system is required, other utilities such as newfs, lifinit, or mkfs must be invoked after running mediainit (see newfs(1M), lifinit(1), and mkfs(1M)).


mediainit returns one of the following values:


Successful completion.


A device-related error occurred.


A syntax-related error was encountered.


Appropriate error messages are printed on standard error during execution of mediainit.


For a device that contains multiple units on a single controller, each unit can be initialized independently from any other unit. It should be noted, however, that mediainit requires that there be no other processes accessing the device before initialization begins, regardless of which unit is being initialized. If there are accesses currently in progress, mediainit aborts.

Aborting mediainit is likely to leave the medium in a corrupt state, even if it was previously initialized. To recover, the initialization must be restarted.

During the initialization process, open() rejects all other accesses to the device being initialized, producing the error EACCES (see open(2)).


Series 800

Partitioning of DDS tape media (-p option) is not supported.


mediainit was developed by HP.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.