Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mirror(1M) — HP-UX 9.03

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

brc(1M)

hpuxboot(1M)

mirrorlog(1M)

uxgen(1M)

mirrortab(4)

mirror(1M)  —  Series 800 Only

NAME

mirror − disk mirroring utility

SYNOPSIS

mirror −c [−f] primarydev pstate secondarydev sstate

mirror −u mirrordev ...

mirror −o [−f] −p|−s mirrordev [[−p|−s] mirrordev ...]

mirror −r [−t] mirrordev

mirror −l [device ...]

Remarks:

This command requires installation of optional DataPair/800 software (not included in the standard HP-UX operating system) before it can be used. 

DESCRIPTION

mirror allows the System Administrator to configure, unconfigure, and control mirrored disks. A mirrored disk is a pair of disk sections that contain the same data, and that look to the user like a single section. The mirror driver automatically maintains the copies by sending writes to both sections, and sending reads to either one.

mirror must be used with exactly one of the options −c, −u, −o, −r, or −l. 

Configure a Mirror

mirror −c [−f] primarydev pstate secondarydev sstate

Configure a mirror.  Primarydev and secondarydev, the primary device and the secondary device, are the names of the two sections in the mirror. These must be the same sections on different drives of the same model of disk. The devices cannot already be in a mirror.

The device names can be either block or character devices.  The result is the same in either case: both the block and the character interface will be mirrored. 

Once the mirror is configured, the block and character names of the primary device become the names of the mirror itself.  The mirror can be read, written, or mounted, just like any other disk section. 

pstate and sstate are the initial states of the primary and secondary.  The states can be online or offline.  One of the two devices must be ONLINE.  The other can be ONLINE or OFFLINE.  ONLINE sections are written and read by the mirror driver as required.  OFFLINE sections are normally not accessed. 

Warning: Do not set both sections in a mirror ONLINE unless both sections have exactly the same data, or unless the current data will not be read.  If both sections are not exactly the same, set one section OFFLINE, then use mirror −r (reimage). 

The primary device may be in use (open or mounted), but if it is, it must be declared ONLINE, and the secondary must be declared OFFLINE.  The secondary device cannot be in use. 

−f manually sets the fail flag for the OFFLINE section.  This is a flag displayed by mirror −l (list), but not otherwise interpreted by the mirror driver.  It is meant to indicate that the device is OFFLINE because of a hardware failure. 

It is not possible to configure root and swap mirrors with mirror −c unless these mirrors have been put into the kernel by uxgen(1M).

Unconfigure a Mirror

mirror −u mirrordev ...

Unconfigure the named mirror(s).  The two sections composing the mirror revert to their original, unmirrored behavior. 

The mirror may be in use, but if it is, the primary device must be ONLINE.  If the mirror is in use, the primary device is in use after mirror −u completes. 

It is not possible to unconfigure a mirror if one section is in the REIMAGE state, caused by a running mirror −r.  To unconfigure a mirror being reimaged, kill the mirror −r first. 

Take One Section of a Mirror OFFLINE

mirror −o [−f] −p|−s mirrordev [[−p|−s] mirrordev ...]

Take one section of mirrordev OFFLINE.  −p requests that the primary go OFFLINE, and −s the secondary.  −f causes the fail flag to be set. 

Typically the System Administrator sets a section OFFLINE so that the mirror can be backed up or repaired.  The section is brought ONLINE again with mirror −r (reimage).  Applications using the mirror do not notice these state changes. 

One section in a mirror must always be ONLINE.  Thus, it is not possible to take the primary OFFLINE unless the secondary is ONLINE
 and vice versa.

If the mirror driver detects a device failure, it changes that section’s state to OFFLINE automatically, setting the fail flag, as long as the other section is ONLINE.  If the other section is not ONLINE, the mirror does not change state and the failure is handled as it would be for an unmirrored device. 

Sometimes sections in several mirrors must go OFFLINE simultaneously, for example because a single data base running on several mirrors needs to be backed up.  To do this, list the sections on a single command line, interspersing −p and −s as necessary. 

To backup or repair a section once it is OFFLINE, whether it is the primary or the secondary, use the secondary name, which is the offline-access device while the mirror is configured.  As with the mirror, both block and character interfaces can be used.  It is not possible to write to the offline-access device.  It is not possible to open the offline-access device unless one section is OFFLINE.  It is not possible to change state while the offline-access device is open. 

This command can also be used to set or clear the fail flag for a single mirror, even when the device is already OFFLINE. 

Reimage a Mirror

mirror −r [−t] mirrordev

Reimage the named mirror.  This happens in three steps.  First, the OFFLINE section’s state changes to REIMAGE.  Second, the mirror driver copies data from the ONLINE section to the REIMAGE section until the two copies are identical.  Third, the section’s state changes from REIMAGE to ONLINE.  Only then does the command complete. 

One section must be OFFLINE.  The offline-access device must not be open. 

−t requests a table-driven reimage.  When a section goes OFFLINE, either through mirror −o or because of device failure, the driver starts keeping a table that records subsequent writes to the ONLINE side.  A table-driven reimage restores only those blocks.  The table is in memory, and is lost across reboots. 

Without −t, a full reimage is performed, which copies every block in the section.  A full reimage is required if the disk was replaced while the section was OFFLINE.  A table-driven reimage is an error in this case, but this error is undetectable by mirror. mirror requires a full reimage if the system has rebooted since the section went OFFLINE. 

List Mirrors

mirror −l [device ...]

List mirrors.  With no devices named, all configured mirrors are listed.  Otherwise, mirrors containing the given devices are listed. 

Output is formatted, one line per mirror, as follows:

primarydev pstate secondarydev sstate fail

primarydev and pstate are the primary device and its state.  The state is given as ONLINE, OFFLINE, or REIMAGE.  Similarly, sstate is the state of secondarydev. fail is FAIL if the fail flag is set, and GOOD otherwise. 

If a device is specified, and it is not mirrored, its state is shown as UNCONF, and no secondary or failure information is printed. 

If the −m, −mp, or −ms options to hpuxboot(1M) have been used to select which side of the root mirror to put ONLINE, and the side selected is the one that would normally be OFFLINE, the two states are shown as ONLINE and NOREIM.  This indicates to mirrorrc(1M) that mirrortab(1M) is not reliable, and that no mirrors should be automatically reimaged.

Safety Protections

mirror requests other than −l are rejected if the mirrorlog daemon is no longer alive.  Also, the daemon’s death can cause some mirrored writes to block indefinitely.  These are safety precautions that avoid possible loss of data.  To recover, restart mirrorlog.

mirror fails when disk mirroring is not configured into the kernel, or when the request is issued on a client cnode in an HP-UX cluster. 

EXAMPLES

Mirror /extra, currently mounted on /dev/dsk/c2000d0s5, with /dev/dsk/c2001d0s5, which is free:

$ mirror −c /dev/dsk/c2000d0s5 online /dev/dsk/c2001d0s5 offline

Reimage the OFFLINE section (full reimage):

$ mirror −r /dev/dsk/c2000d0s5

Set the primary OFFLINE for backup:

$ mirror −o −p /dev/dsk/c2000d0s5

After the backup, which reads from /dev/[r]dsk/c2001d0s5, reimage the OFFLINE section using the table:

$ mirror −r −t /dev/dsk/c2000d0s5

Describe all mirrors:

$ mirror −l
/dev/dsk/c2000d0s5 ONLINE /dev/dsk/c2001d0s5 ONLINE GOOD

HARDWARE DEPENDENCIES

Requires HP 9000 Series 800 with HP 7936FL/7937FL disks. 

SEE ALSO

brc(1M), hpuxboot(1M), mirrorlog(1M), uxgen(1M), mirrortab(4). 

Hewlett-Packard Company  —  HP-UX Release 9.03: April 1994

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