Secondly, when used with the -x option, metarename switches (exchanges) the names of an existing layered metadevice and one of its subdevices. (In DiskSuite terms, a layered metadevice can be either a mirror or a trans metadevice.) The x option enables you to switch the metadevice names of a mirror and one of its submirrors, or a trans metadevice and its master device.
metarename -x makes it easier to mirror or unmirror an existing stripe or concatenation, and to create or remove a trans of an existing metadevice.
When used to mirror an existing stripe or concatenatation, you must stop access to the device. For example, if the device contains a mounted file system, you must first unmount the file system before doing the rename.
metarename -x can also be used to create a trans metadevice from an existing metadevice, or to untrans the device. This applies only to the master device. A logging device cannot be created or removed via metarename. Before you can rename a trans device, you must detach the logging device. Then you must stop access to the trans metadevice itself.
You cannot rename or switch metadevices that are in an errored state or that have subcomponents in an errored state, or metadevices actively using a hot spare replacement.
You can only switch metadevices that have a direct child/parent relationship. You could not, for example, directly exchange a stripe in a mirror that is a master device with the trans metadevice.
You must use the -f flag when switching members of a trans metadevice.
Only metadevices can be switched, not slices.
metadevice2
Specifies the target metadevice name for the rename or switch operation.
# metarename d10 d100
This example creates a two-way mirror from an existing stripe named d1 with a mounted file system, /home2.
# metainit d2 1 1 c13d0s1
# metainit -f d20 -m d1
# umount /home2
# metarename -x d20 d1
# metattach d1 d2
# mount /home2
First, a second concatenation d2, is created. (d1 already exists.) The metainit command creates a one-way mirror, d20, from d1. Next, you umount the file system and switch d1 for d20, making d1 the top-level device (mirror). You attach the second submirror, d2, to create a two-way mirror. Lastly, you remount the file system.
This example takes an existing mirror named d1 with a mounted file system, and ends up with the file system mounted on a stripe d1.
# umount /fs2
# metarename -x d1 d20
# metadetach d20 d1
# metaclear -r d20
# mount /fs2
First, you unmount the file system, then switch the mirror d1 and its submirror d20. This makes the mirror into d20. Next, you detach d1 from d20, then delete the mirror d20 and its other submirror. You then remount the file system.
This example creates a trans metadevice from an existing RAID5 metadevice named d1 which contains the file system /myhome.
# umount /myhome
# metainit d21 -t d1
# metarename -f -x d21 d1
# metattach d1 d0
# mount /myhome
You umount the file system before using the metainit command to create the trans metadevice d21, with d1 as the master device. You then switch d21 and d1, making d1 the top-level metadevice (trans metadevice). A logging device d0 is attached with the metattach command. You then remount the file system.
This example deletes a trans metadevice named d10 while its mount point is /myhome. The master device, which is a stripe, is named d2. The logging device, also a stripe, is named d5.
# umount /myhome
# metadetach d10
# metarename -f -x d10 d2
# metaclear d2
# metaclear d5
# fsck /dev/md/dsk/d10
# mount /myhome
You umount the file system first, then detach the trans metadevice's logging device. The trans metadevice is switched with the master device, making the trans metadevice d2 and the underlying stripe d10. You clear the trans metadevice d2 and the logging device d5. d10 must be fsck'd, and then the file system is remounted.
Solstice DiskSuite User's Guide, Solstice DiskSuite Reference
Metadevice names are (still) limited to strings of the pattern d<xyz> where xyz is a value between 0 and 1024 . You cannot use logical names for metadevices.