Showing posts with label cfgadm. Show all posts
Showing posts with label cfgadm. Show all posts

Thursday, February 23, 2017

How to change a disk in SVM Solaris volume manager

Hope you are doing well at your end. This post documentation explain how to change a disk in SVM ( Solaris volume manager).It means that we have mirrored the disk (RAID1) using SVM. Solaris Volume manager is basically used for creating, modifying & partitioning the different RAID partition.

In this post, I will take my sparc server machine. My Sun Sparc server consist 2 hard disk, let us assume the server has 2 hard disk: c0t0d0 and c0t1d0. We will assume c0t0d0 failed and need to be replaced.

Step by Step Method as described below:

1. In the initial step, we will find that which hard disk is down or faulty. To check this we will used "format" command.

sun01# format
       0. c0t0d0 <__drive type unknown__>
          /pci@0,600000/pci@0/pci@8/pci@0/scsi@1/sd@0,0
       1. c0t1d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@0,600000/pci@0/pci@8/pci@0/scsi@1/sd@1,0

If you see the "format" command output, we have two disk "c0t0d0,c0t1d0". Disk "c0t0d0" is in faulty state and it's down, You can see the drive type is in unknown state.

2. If you are running the "metastat" command you can see the status of hard disk which is show status in "need maintenance".

sun01# metastat    # will show status in "need maintenance"

        flags           first blk       block count
     a        u         16              8192            /dev/dsk/c0t0d0s7
     a        u         8208            8192            /dev/dsk/c0t0d0s7
     a    p  luo        16              8192            /dev/dsk/c0t1d0s7
     a    p  luo        8208            8192            /dev/dsk/c0t1d0s7

sun01# metadb -d c0t0d0s7
sun01# metadb

Using above command we delete metadb on failing disk and check that metadb on the other disk.

4. Now, we will unconfigure the corresponding disk which is down right now. This is the main step of this post so you can more careful while running the command which is given below.

sun01# cfgadm -al
sun01# cfgadm -f -c unconfigure c0::dsk/c0t0d0
sun01# cfgadm -al

Using cfgadm command we will unconfigure the c0t0d0 faulty hard disk so that we will replace the down hard disk in next step.

5. Now you can change the faulty disk to new one and reconfigure it again with same name.

sun01# cfgadm -c configure c0::dsk/c0t0d0
sun01# cfgadm -al

6. In this steo we will duplicate partitionning schema of first disk to the second and create metadb.

sun01# prtvtoc /dev/rdsk/c0t1d0s2 | fmthard -s - /dev/rdsk/c0t0d0s2
sun01# metadb -a -f -c2 /dev/dsk/c0t0d0s7

7. In second last step you will run all the below command for replacement of the failinf SVM partition.

sun01# metastat
sun01# metareplace -ef d4 c0t0d0s4
sun01# metareplace -ef d3 c0t0d0s3
sun01# metareplace -ef d1 c0t0d0s1
sun01# metareplace -ef d0 c0t0d0s0
sun01# metareplace -ef d5 c0t0d0s5
sun01# metareplace -ef d6 c0t0d0s6
sun01# metasync d0
sun01# metasync d1
sun01# metasync d3
sun01# metasync d4
sun01# metasync d5
sun01# metasync d6
sun01# metasync d7

8. In final step you need to make the disk bootable so that operating system will be boot on the mirror disk.

sun01# installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

Using this step you can make a disk bootable. I hope this post is useful for you. You are requested to please comment on the post if you have any issue, I will try to back you with my answer.