Solstice DiskSuite 4.2.1 User's Guide

Metadevice Name Switching

In addition to renaming metadevices, DiskSuite's metarename command also provides the ability to switch "layered" metadevices. When used with the -x option, metarename switches (exchanges) the names of an existing layered metadevice and one of its subdevices. This includes a mirror and one of its submirrors, or a trans metadevice and its master device.


Note -

You must use the command line to exchange metadevices. This functionality is currently unavailable in DiskSuite Tool, although you can rename a metadevice with either the command line or DiskSuite Tool.


Prerequisites for Using Metadevice Name Switching

Creating a Metadevice Using Name Switching

If you have an existing stripe, you can use the metarename -x command to create a compound metadevice. This includes creating a mirror from a concat/stripe, or a trans device with a metadevice as the master device.

How to Create a Mirror From an Existing Concat/Stripe (Command Line)

This example begins with a concatenation, d1, with a mounted file system, and ends up with the file system mounted on a two-way mirror named d1.


# metastat d1
d1: Concat/Stripe
    Size: 5600 blocks
    Stripe 0:
        Device              Start Block  Dbase
        c0t0d0s1                   0     No
# metainit d2 1 1 c1t3d0s1
d2: Concat/Stripe is setup
# metainit -f d20 -m d1
d20: Mirror is setup
# umount /fs2
# metarename -x d20 d1
d20 and d1 have exchanged identities
# metastat d1
d1: Mirror
    Submirror 0: d20
      State: Okay
... 
 
d20: Submirror of d1
    State: Okay
...
# metattach d1 d2
d1: submirror d2 is attached
# metastat d1
d1: Mirror
    Submirror 0: d20
      State: Okay
    Submirror 1: d2
      State: Okay
...
# mount /fs2

The metastat command confirms that the concatenation d1 is in the "Okay" state. You use the metainit command to create a second concatenation (d2), and then to force (-f) the creation of mirror d20 from d1. You must unmount the file system before using metarename -x to switch d20 for d1; d1 becomes the top-level device (the mirror), which metastat confirms. You attach d2 as the second submirror, verify the state of the mirror with metastat, then remount the file system. Note that because the mount device for /fs2 did not change, you do not have to edit the /etc/vfstab file.

How to Create a Trans Metadevice From an Existing Metadevice (Command Line)

This example begins with a mirror, d1, with a mounted file system, and ends up with the file system mounted on a trans device named d1.


# metastat d1
d1: Mirror
    Submirror 0: d20
      State: Okay        
    Submirror 1: d2
      State: Okay        
...
# umount /fs2
# metainit d21 -t d1
d21: Trans is setup
# metarename -f -x d21 d1
d21 and d1 have exchanged identities
# metastat d1
d1: Trans
    State: Detached
    Size: 5600 blocks
    Master Device: d21
...
# metattach d1 d0
d1: logging device d0 is attached
# mount /fs2

The metastat command confirms that the mirror d1 is in the "Okay" state. You must unmount the file system before using the metainit command to create the trans device d21, with d1 as the master. The metarename -f -x command forces the switch of d21 and d1; d1 is now the top-level trans metadevice, as confirmed by the metastat command. A logging device d0 is attached with the metattach command. You then remount /fs2. Note that because the mount device for /fs2 has not changed (it is still d1), you do not have to edit the /etc/vfstab file.

Removing a Metadevice Using Name Switching

If you have an existing mirror or trans metadevice, you can use the metarename -x command to remove the mirror or trans metadevice and keep data on an underlying metadevice. For a trans metadevice, as long as the master device is a metadevice (stripe/concat, mirror, or RAID5 metadevice), you keep data on that metadevice.

When you use metarename -x as part of this process, the mount point of the file system remains the same.

How to Unmirror a File System and Retain the Mount Device (Command Line)

This example begins with a mirror, d1, containing a mounted file system, and ends up with the file system mounted on a stripe named d1.


# metastat d1
d1: Mirror
    Submirror 0: d20
      State: Okay        
    Submirror 1: d2
      State: Okay        
    Pass: 1
...
# umount /fs2
# metarename -x d1 d20
d1 and d20 have exchanged identities
# metastat d20
d20: Mirror
    Submirror 0: d1
      State: Okay        
    Submirror 1: d2
      State: Okay        
...
 
# metadetach d20 d1
d20: submirror d1 is detached
# metaclear -r d20
d20: Mirror is cleared
d2: Concat/Stripe is cleared
# mount /fs2

The metastat command confirms that mirror d1 is in the "Okay" state. This file system is unmounted before exchanging the mirror d1 and its submirror d20. This makes the mirror d20, as confirmed by metastat. Next, d1 is detached from d20, then mirror d20 and the other submirror, d2 are deleted. Finally, /fs2 is remounted. Note that because the mount device for /fs2 did not change, the /etc/vfstab file does not require editing.

How to Remove a Trans Metadevice and Retain the Mount Device (Command Line)

This example begins with a trans metadevice, d1, containing a mounted file system, and ends up with the file system mounted on the trans metadevice`s underlying master device, which will be d1.


# metastat d1
d1: Trans
    State: Okay        
    Size: 5600 blocks
    Master Device: d21
    Logging Device: d0
 
d21: Mirror
    Submirror 0: d20
      State: Okay        
    Submirror 1: d2
      State: Okay        
...
 
d0: Logging device for d1
    State: Okay        
    Size: 5350 blocks
# umount /fs2
# metadetach d1
d1: logging device d0 is detached
# metarename -f -x d1 d21
d1 and d21 have exchanged identities
# metastat d21
d21: Trans
    State: Detached    
    Size: 5600 blocks
    Master Device: d1
 
d1: Mirror
    Submirror 0: d20
      State: Okay        
    Submirror 1: d2
      State: Okay
# metaclear 21
# fsck /dev/md/dsk/d1
** /dev/md/dsk/d1
** Last Mounted on /fs2
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
 
FILE SYSTEM STATE IN SUPERBLOCK IS WRONG; FIX? y
 
3 files, 10 used, 2493 free (13 frags, 310 blocks, 0.5%
fragmentation)
# mount /fs2

The metastat command confirms that the trans metadevice, d1, is in the "Okay" state. The file system is unmounted before detaching the trans metadevice's logging device. The trans metadevice and its mirrored master device are exchanged using the -f (force) flag. Running metastat again confirms that the exchange occurred. The trans metadevice and the logging device (if desired) are cleared, in this case, d21 and d0, respectively. Next, the the fsck command is run on the mirror, d1, and the prompt is answered with a y. After the fsck command is done, the file system is remounted. Note that because the mount device for /fs2 did not change, the /etc/vfstab file does not require editing.