Solaris Volume Manager (SVM) – Adding Mirror to a metadevice housing soft partitions.

To add a mirror to a metadevice with one or more soft partitions can be done with a short amount of downtime, but it’s a bit tricky. The best way to illustrate this procedure is with an example.

In the example below, we’ll use the following metadevice names:

d50 – this is the current metadevice (most likely a stripe or concat device) which is divided into softpartitons

d70 thru d79 – these are the soft partitions currently on d50.

d80 – a new metadevice that we will create to be used the main mirror device

The problem with this configuration is that d50 cannot be used directly as a submirror because it is currently the “parent” of one or more softpartitions.  To get it mirrored, we first  have to remove the softpartitions (but just temporarily).  Then, after d50 is simply a submirror of a mirror metadevice, we can create the soft partitions on the mirror device  without loss of data.

Here is the step-by-step example procedure:

1. Backup all data, and verify that no hotspare is in use for any  of the metadevices being modified.

2. Run ‘metastat -p’ and save the output into a file.  then, edit the file and remove all the lines EXCEPT for the soft partitions d70 thru d79.  Also change all occurance of d50 to d80, since that will be the new “parent” of the softpartitions.  If you put the word “metainit” in front of each line, you’ll then have a script that you can run in step 5 (below) to recreate all the soft partitons.

So in summary, we’ve changed the file from this:








d70 -p d50 -o 496594974 -b 20480

d71 -p d50 -o 496574493 -b 20480

d72 -p d50 -o 496554012 -b 20480

d73 -p d50 -o 1385984063 -b 106954752

d74 -p d50 -o 1377427518 -b 8556544

d75 -p d50 -o 1373233213 -b 4194304

d76 -p d50 -o 1356455996 -b 16777216

d77 -p d50 -o 1339678779 -b 16777216

d78 -p d50 -o 1322901562 -b 16777216

d79 -p d50 -o 1306124345 -b 16777216

to this:

metainit d70 -p d80 -o 496594974 -b 20480

metainit d71 -p d80 -o 496574493 -b 20480

metainit d72 -p d80 -o 496554012 -b 20480

metainit d73 -p d80 -o 1385984063 -b 106954752

metainit d74 -p d80 -o 1377427518 -b 8556544

metainit d75 -p d80 -o 1373233213 -b 4194304

metainit d76 -p d80 -o 1356455996 -b 16777216

metainit d77 -p d80 -o 1339678779 -b 16777216

metainit d78 -p d80 -o 1322901562 -b 16777216

metainit d79 -p d80 -o 1306124345 -b 16777216

3. Unmount all the softpartitions.

4. Run ‘metaclear’ on all the softpartitions to remove them.  For example:

# metaclear d70 d71 d72 d73 d74 d75 d76 d77 d78 d79

5. Now you are free to use d50 as a submirror, so create a mirror device (d80) using d50:

# metainit d80 -m d50

6. Recreate the softpartitions by running the script file you edited in step 2.  This will recreate all the soft partitions, but on d80, instead of d50.  Since the locations of the soft partitions are the same, the data will still be intact.

7. Mount all the softpartitions again… at this point, your downtime is over, and normal operations on the soft partitions are able to start.

8. Create a new concat or stripe metadevice of the same size as d50.

We’ll call this new submirror d60.  then, attach it to d80:

# metainit d60 1 4 c1t2d0s0 c1t2d1s0 c1t2d2s0 c1t2d3s0

# metattach d80 d60

 








Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

4 Responses

  1. kishor says:

    Please can u clear about what is exactly metadevice and why it is used ?

  2. Jayakrishnan G Naik says:

    How to mount/use the softpartitions from a detached mirror, say in above case If I detached d80 when mirror is sync. I detached root , var as well and I need to reboot from detached mirror disk with all soft partitions mounter from detached mirror d80

    Can we do this?

    • Jayakrishnan says:

      Oh Sorry, Not d80 I mean d60 which is the submirror which I want to detach and boot the mirror disk seperately.

  1. September 17, 2015

    […] Read – Adding Mirror to a metadevice housing soft partitions. […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us