Sun Microsystems, Inc.
spacer | | |  
black dot
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
System Administration Commandsmetattach(1M)


 metattach, metadetach - attach or detach metadevice to or from a mirror or trans device, or attach space (blocks) to a soft partition to grow the soft partition


 /usr/sbin/metattach [-h]
 /usr/sbin/metattach [-s setname] mirror [metadevice]
 /usr/sbin/metattach [-s setname] [-i size] concat/stripe component...
 /usr/sbin/metattach [-s setname] RAID component...
 /usr/sbin/metattach [-s setname] softpart size
 /usr/sbin/metattach [-s setname] trans log
 /usr/sbin/metadetach [-s setname] [-f] mirror submirror
 /usr/sbin/metadetach [-s setname] [-f] trans



metattach is used to add submirrors to a mirror, add logging devices to trans devices, grow metadevices, or grow soft partitions. Growing metadevices can be done without interrupting service. To grow the size of a mirror or trans, the slices must be added to the submirrors or to the master devices.

Solaris Volume Manager supports one-to-four-way mirrors. Thus, you can only attach a metadevice to a mirror if there are three or fewer submirrors beneath the mirror. Once a new metadevice is attached to a mirror, metattach will automatically start a resync operation to the new submirror.

Attaching a new logging device to a busy trans metadevice is allowed, although a trans metadevice will start using its new logging device only after the trans is idle (after it is unmounted, for example). The busy trans will be in an Attaching state (metastat) until the logging device is actually attached. Attaching a logging device in the Hard Error or Error state (metastat) is not allowed.

metadetach is used to detach submirrors from mirrors and to detach logging devices from trans metadevices.

When a submirror is detached from a mirror, it is no longer part of the mirror, thus reads and writes to and from that metadevice via the mirror are no longer performed through the mirror. Detaching the only existing submirror is not allowed. Detaching a submirror that has slices reported as needing maintenance (by metastat) is not allowed unless the -f (force) flag is used.

metadetach also detaches the logging device from a trans. Once detached, the logging device is no longer part of the trans, thus the trans is no longer logging and all benefits of logging are lost. Any information on the logging device that pertains to the master device is written to the master device before the logging device is detached.

Detaching the logging device from a busy trans device is not allowed unless the -f (force) flag is used. Even so, the logging device is not actually detached until the trans is idle. The trans is in the Detaching state (metastat) until the logging device is detached.



Root privileges are required for all of the following options except -h.

Force the detaching of metadevices that have components that need maintenance or are busy. You can use this option only when a mirror is in a maintenance state that can be fixed with metareplace(1M). If the mirror is in a maintenance state that can only be fixed with metasync(1M) (as shown by the output of metastat(1M)), metadetach -f will have no effect, because the mirrors must be resynchronized before one of them can be detached.
Displays a usage message.
-i size
Specifies the interlace value for stripes, where size is a specified value followed by either `k' for kilobytes, `m' for megabytes, or `b' for blocks. The units can be either uppercase or lowercase. If size is not specified, the size defaults to the interlace size of the last stripe of the metadevice. When an interlace size change is made on a stripe, it will be carried forward on all stripes that follow.
-s setname
Specifies the name of the diskset on which the metattach command or the metadetach command will work. Using the -s option will cause the command to perform its administrative function within the specified diskset. Without this option, the command will perform its function on local metadevices.


The logical name for the physical slice (partition) on a disk drive, such as /dev/dsk/c0t0d0s2, being added to the concatenation, stripe, concatenation of stripes, or RAID5 metadevice.
Specifies the metadevice name of the concatenation, stripe, or concatenation of stripes.
Specifies the metadevice name of the logging device to be attached to the trans metadevice.
Specifies the name of the metadevice to be attached to the mirror as a submirror. This metadevice must have been previously created by the metainit command.
Specifies the mirror.
Specifies the metadevice name of the RAID5 metadevice.
Specifies the amount of space to add to the soft partition in K or k for kilobytes, M or m for megabytes, G or g for gigabytes, T or t for terabytes, and B or b for blocks (sectors).
Specifies the metadevice name of the existing soft partition.
The metadevice name of the submirror to be detached from the mirror.
Specifies the metadevice name of the trans metadevice (not the master or logging device).


 Example 1. Concatenating a New Slice to a Metadevice

This example concatenates a single new slice to an existing metadevice, d8. Afterwards, you would use the growfs(1M) command to expand the file system.

# metattach d8 /dev/dsk/c0t1d0s2

Example 2. Detaching Logging Device from Trans Metadevice

This example detaches the logging device from a trans metadevice d9. Notice that you do not have to specify the logging device itself, as there can only be one.

# metadetach d9

Example 3. Expanding a RAID5 Metadevice

This example expands a RAID5 metadevice, d45, by attaching another slice.

# metattach d45 /dev/dsk/c3t0d0s2

When you add additional slices to a RAID5 metadevice, the additional space is devoted to data. No new parity blocks are allocated. The data on the added slices is, however, included in the overall parity calculations, so it is protected against single-device failure.

Example 4. Expanding a Soft Partition

The following example expands a soft partition, d42, by attaching 150 Mbytes.

# metattach d42 150M

When you add additional space to a soft partition, the additional space is taken from any available space on the slice and might not be contiguous with the existing soft partition.

Example 5. Adding Space to Two-Way Mirror

This example adds space to a two-way mirror by adding a slice to each submirror. Afterwards, you would use the growfs(1M) command to expand the file system.

# metattach d9 /dev/dsk/c0t2d0s5
# metattach d10 /dev/dsk/c0t3d0s5

Example 6. Detaching a Submirror from a Mirror

This example detaches a submirror, d2, from a mirror, d4.

# metadetach d4 d2

Example 7. Adding Four Slices to Metadevice

This example adds four slices to an existing metadevice, d9. Afterwards, you would use the growfs(1M) command to expand the file system.

# metattach d9 /dev/dsk/c0t1d0s2 /dev/dsk/c0t2d0s2 \
     /dev/dsk/c0t3d0s2 /dev/dsk/c0t4d0s2



The following exit values are returned:

Successful completion.
An error occurred.



See attributes(5) for descriptions of the following attributes:




metaclear(1M), metadb(1M), metadetach(1M), metahs(1M), metainit(1M), metaoffline(1M), metaonline(1M), metaparam(1M), metarecover(1M), metareplace(1M), metaroot(1M), metaset(1M), metastat(1M), metasync(1M),,,, attributes(5)

Solaris Volume Manager Administration Guide



When a submirror is detached from its mirror, the data on the metadevice may not be the same as the data that existed on the mirror prior to running metadetach. In particular, if the -f option was needed, the metadevice and mirror probably do not contain the same data.

SunOS 5.9Go To TopLast Changed 4 Jun 2001

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.