Showing posts with label disk. Show all posts
Showing posts with label disk. Show all posts

Monday 30 October 2017

How to change a disk in SVM Solaris volume manager

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.

!-[solaris]## 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".

!-[solaris]## 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

!-[solaris]## metadb -d c0t0d0s7
!-[solaris]## 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.

!-[solaris]## cfgadm -al
!-[solaris]## cfgadm -f -c unconfigure c0::dsk/c0t0d0
!-[solaris]## 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.

!-[solaris]## cfgadm -c configure c0::dsk/c0t0d0
!-[solaris]## cfgadm -al

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

!-[solaris]## prtvtoc /dev/rdsk/c0t1d0s2 | fmthard -s - /dev/rdsk/c0t0d0s2
!-[solaris]## 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.

!-[solaris]## metastat
!-[solaris]## metareplace -ef d4 c0t0d0s4
!-[solaris]## metareplace -ef d3 c0t0d0s3
!-[solaris]## metareplace -ef d1 c0t0d0s1
!-[solaris]## metareplace -ef d0 c0t0d0s0
!-[solaris]## metareplace -ef d5 c0t0d0s5
!-[solaris]## metareplace -ef d6 c0t0d0s6
!-[solaris]## metasync d0
!-[solaris]## metasync d1
!-[solaris]## metasync d3
!-[solaris]## metasync d4
!-[solaris]## metasync d5
!-[solaris]## metasync d6
!-[solaris]## metasync d7

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

!-[solaris]## 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.

Tuesday 4 July 2017

How to find the boot disk from HP-UX operating system

In this article , I would explain to you how we find which disk are used to boot the running HP-UX operating system. This is a bit tricky because its depending on the version of HP-UX, and whether it is using LVM or the less common choice.

For LVM disk layouts:

For 11.11 and earlier, use the below command to check which disk is in used.

hpx:/> echo “boot_string/S” | adb -k /stand/vmunix /dev/kmem
    boot_string:
    boot_string:    disk(0/0/2/0.6.0.0.0.0.0;0)/stand/vmunix

For 11.23, there are different ways for PARISC versus IA64:

PARISC:

hpx:/> echo “boot_string/S” | adb -o /stand/vmunix /dev/kmem
    boot_string:
    boot_string:    disk(1/0/0/3/0.6.0.0.0.0.0;0)/stand/vmunix

IA64 (Itanium/Integrity):

hpx:/> echo “bootdev/x” | adb -n /stand/vmunix /dev/kmem
    bootdev:
        0x100001c

Now to find the actual path, you’ll have to match the 0x100001c value to a minor number in the /dev/disk directory. Compare only the last 6 digits of the number (00001c) to find the device file. Then by using lssf, you can decode the hardware path:

    hpx:/> DSK=$(ll /dev/disk | awk ‘/00001c/{print $NF}’)
    hpx:/> echo $DSK
    disk11_p2

    hpx:/> HWPATH=$(lssf /dev/disk/$DSK | awk ‘{print $(NF-1)}’)
    hpx:/> echo “$DSK path = $HWPATH”
    disk11_p2 path = 64000/0xfa00/0xa

You can also use ioscan -m dsf to map agile device file names to legacy (CTD) style.

For VxVM disk layouts:

hpx:/> echo “raw_root/X” | adb -o /stand/vmunix /dev/kmem
     raw_root:
     raw_root:       0x3000002

This value is the minor number for the disk that was used to boot the current system. The minor number is found in the /dev/vx/dmp directory.

     hpx:/> DSK=$(ll /dev/vx/dmp | awk ‘/000002/{print $NF}’)
     hpx:/> echo $DSK
    c2t1d0s2

     hpx:/> HWPATH=$(lssf /dev/dsk/$DSK | awk ‘{print $(NF-1)}’)
     hpx:/> echo “$DSK path = $HWPATH”
     c2t1d0s2 path = 0/1/1/0.1.0

For completeness, I should mention that 11.31 will report the boot disk path in syslog.log (LVM or VxVM) like this:

vmunix: Boot device’s HP-UX HW path is: 0/1/1/0.0×1.0x0

However, syslog.log is a catch-all for a lot of items and often needs to be truncated when it grows too large. As a result, it can’t be relied on to always contain the current boot disk.