Solstice DiskSuite metaview

In my line of work as a Solaris Systems Administrator and Data Storage engineer I use Solstice DiskSuite pretty much every day of the week (and weekends when needed). One of it's many tools is the metastat command which simply prints the status of it's metadevices.

Whilst metastat provides nice output, I wanted something that would give me a quick overview of my metadevices and associated mirrors, so I created the script to do exactually that.

# metaview

and here's some sample output

Sample output

metaview (with healthy metadevice state)
                ======PRIMARY MIRROR====== ======SECONDARY MIRROR====
MetaDev  Size   MetaDev State Device       MetaDev State Device
d10       16 GB d11     OK    c0t0d0s0     d12     OK    c1t1d0s0
d20       32 GB d21     OK    c0t0d0s1     d22     OK    c1t1d0s1
d30       16 GB d31     OK    c0t0d0s3     d32     OK    c1t1d0s3
d40       16 GB d41     OK    c0t0d0s4     d42     OK    c1t1d0s4
d50       16 GB d51     OK    c0t0d0s5     d52     OK    c1t1d0s5
d60       40 GB d61     OK    c0t0d0s6     d62     OK    c1t1d0s6
d70       99 GB d73     OK    emcpower25a  d71     OK    emcpower28a
metaview (with metadevice in LAST ERRED)
                ======PRIMARY MIRROR====== ======SECONDARY MIRROR====
MetaDev  Size   MetaDev State Device       MetaDev State Device
d10       12 GB d11     OK    c0t0d0s0     d12     OK    c1t1d0s0
d101      67 GB d102    ERRED c0t2d0s0
d20       12 GB d21     OK    c0t0d0s1     d22     OK    c1t1d0s1
d30       12 GB d31     OK    c0t0d0s3     d32     OK    c1t1d0s3
d40       12 GB d41     OK    c0t0d0s4     d42     OK    c1t1d0s4
d50       12 GB d51     OK    c0t0d0s5     d52     OK    c1t1d0s5
d60      7.8 GB d61     OK    c0t0d0s6     d62     OK    c1t1d0s6
metaview (with metadevice RESYNCING)
                ======PRIMARY MIRROR====== ======SECONDARY MIRROR====
MetaDev  Size   MetaDev State Device       MetaDev State Device
d10       15 GB d11     OK    c1t0d0s0     d12     OK    c0t1d0s0
d140      15 GB d141    OK    c1t0d0s4     d142    OK    c0t1d0s4
d150      15 GB d151    OK    c1t0d0s5     d152    OK    c0t1d0s5
d20       31 GB d22     OK    c1t1d0s1     d21     OK    c0t0d0s1
d30       15 GB d31     OK    c1t0d0s3     d32     SYNC  c0t1d0s3
d40      3.0 GB d42     OK    c1t1d0s6     d41     SYNC  c0t0d0s6
d50       40 GB d100    OK    c1t2d0s4     d101    OK    c0t3d0s4
metaview (with mixed devices in SYNC, FAULT LAST ERRED state)
                ======PRIMARY MIRROR====== ======SECONDARY MIRROR====
MetaDev  Size   MetaDev State Device       MetaDev State Device
d10       12 GB d11     OK    c1t0d0s0     d12     OK    c2t1d0s0
d20       19 GB d23     OK    c1t0d0s1     d22     SYNC  c2t1d0s1
d30       12 GB d31     OK    c1t0d0s3     d32     SYNC  c2t1d0s3
d40       12 GB d41     FAULT c1t0d0s4
d50       12 GB d51     OK    c1t0d0s5
d60       67 GB d61     OK    c1t2d0s6     d62     OK    c2t3d0s6
d70      499 GB d71     ERRED emcpower0a
d80       49 GB d81     OK    emcpower3a
d90       99 GB d91     FAULT emcpower2a

Download

The script is available for download.

Todo: want to modify the script for resync to show % percentage done