Popular Posts

Jan 25, 2017

Script to track configuration change in Solaris servers

Script to track configuration change in Solaris servers

       -  Purpose of this script - Defined configuration change will be notified to the listed recipient through e-Mail      
       -  This script will track the modification of configuration files in server.
       -  List of configuration files needs to be seeded inside the script - as per our requirement
       -  Four config files are included (vfstab,system,ntp.conf,resolv.conf) - we can include more files
       -  Schedule the script in cron to run every one hour
       -  If we need to change the schedule instead of one hour, then change the seconds (3660) mentioned  in script to appropriate
       -  If any one of the configuration files modified within one hour, we will receive a mail with those details.
       -  Detailed report will get attached in e-Mail
       -  Example, if we would like to run the script every 15 minutes, then change the 3600 to 900 seconds



 #!/bin/ksh
DIR=/var/tmp/confbkp
STAMP=`date +%d.%m.%Y.%H.%M`
ConfList=$DIR/ConfList
PRVHOUR=`perl -MPOSIX=strftime -le 'print strftime("%m%d%H%M", localtime(time-3660))'`

mkdir -p $DIR
> $DIR/tmp.out
echo "
File changes in last one hour - `uname -n`
=============================="> $DIR/result.out

#Define what all configuration files needs to be monitored.
echo "/etc/vfstab
/etc/system
/etc/resolv.conf
/etc/inet/ntp.conf" > $ConfList

#Create a file with One Hour old time stamp
touch -mt $PRVHOUR $DIR/stampfile

#Compare the config files one by one with current time stamp
for i in `cat $ConfList` ; do
COUNT=`find $i -newer /var/tmp/confbkp/stampfile -local -print | wc -l`
if [ $COUNT -eq 1 ] ; then
echo "$i" >> $DIR/tmp.out
fi
done

if [ -s $DIR/tmp.out ] ; then
cat $DIR/tmp.out >> $DIR/result.out
else
echo "No configuration chnages for the past one hour" >> $DIR/result.out
fi

#Sending the attachement in mail
cd $DIR
unix2dos result.out result.`uname -n`.txt
uuencode result.`uname -n`.txt result.`uname -n`.txt | mailx -s "Configuration - Audit Rport $STAMP `uname -n`" judi@gmail.com



Jan 24, 2017

java - tips

java - tips

1.  Download - Java Patches for Solaris Packages (Doc ID 1397756.1)
        Java SE JDK and JRE - Version 1.5.0 to 8
        Oracle Solaris on x86 (32-bit)
        Oracle Solaris on x86-64 (64-bit)
        Oracle Solaris on SPARC (64-bit)
        Oracle Solaris on SPARC (32-bit)


2.   jarsigner - JAR Signing and Verification Tool
          - Need to install the package developer/java/jdk-8 in solaris 11
            pkg install --accept developer/java/jdk-8

3.   Install Java 8 in solaris 10
          - Download the Java package jdk1.8.0_121 jdk-8u121-solaris-sparcv9.tar.Z ) from Oracle
                uncompress jdk-8u121-solaris-sparcv9.tar.Z
                tar -xvf  jdk-8u121-solaris-sparcv9.tar.Z
                pkgadd -d . SUNWj8cfg SUNWj8dev SUNWj8jmp SUNWj8man SUNWj8rt
                ls -ld /usr/java (This link will point the older Java version)
                rm /usr/java (remove the link and create new link to point the newer Java Version)
                cd /usr/jdk/ ; ln -s instances/jdk1.8.0 jdk1.8.0_121
                cd /usr ; ln -s jdk/jdk1.8.0_121 /usr/java
                java -version
                                java version "1.8.0_121"
                                Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
                                Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

4.   Update Java latest version to Solaris 11 IPS Respository
              -   IPS repository is used to updated Solaris 11 servers with latest SRU or a specific package
              -   To make use of that, we need to have upto date packages in Repo with latest version
              -   The latest version of java is released (JAVA 6U141/7U131/8U121)
              -   we are updating the IPS repo with latest version
              -   For example, we have the java version 1.8.0.112 in IPS repo
              -   The latest version of Jave released is 1.8.0.121
              -   All Java version are available under this Oracle ( Doc ID 1397756.1 )
              -   Download the latest JAVA 6U141/7U131/8U121 IPS REPOSITORY INSTALL GUIDE FOR ORACLE SOLARIS 11
              -   Download the latest JAVA 6U141/7U131/8U121 IPS REPOSITORY FOR ORACLE SOLARIS 11

     A)   Two files has been downloaded
               cd /var/tmp/jdk8.121 ; ls
                                p25354925_1100_Solaris86-64.zip
                                p25354920_1100_SOLARIS64.zip

     B)   Unzip the file which contain the Install script
               unzip p25354925_1100_Solaris86-64.zip

     C)   Update the packages in IPS repository
               ./install-repo.ksh -s /var/tmp/jdk8.121 -d /sol.11.3/repo -v

            Now Java latest version are updated in IPS Repo
            Update Java independently Oracle Solaris 11.3 Clients from IPS Repository
     D)   To update the Java 8 packages:
               pkg change-facet version-lock.consolidation/java-8/java-8-incorporation=false
               pkg update jre-8

     E)   To update the Java 7 packages:
             pkg change-facet version-lock.consolidation/java-7/java-7-incorporation=false
             pkg update jre-7  

     F)   To update the Java 6 packages:
             pkg change-facet version-lock.consolidation/ub_javavm-6/ub_javavm-6-incorporation=false
             pkg update consolidation/ub_javavm-6/ub_javavm-6-incorporation@1.6.0.141

Jan 19, 2017

Install nano in Solaris 11.3

Install nano in Solaris 11.3


     -  Soalris 11.3 will have nano.2.0.9 version
     -  This is bit older version and reported as vulnerability by pci compliance scan
     -  The suggested version is nano.2.2.4 or later
     -  Latest stable versions are nano.2.4.1 , nano.2.5.0 , nano.2.6.0
     -  Download the stable versions of nano.2.4.1 or nano.2.5.0 or nano.2.6.0
     -  copy the .tar.gz file to server under /var/tmp

1.  unzip the gzip file, will get a .tar file 
        cd /var/tmp/
        gzip -d nano-2.6.0.tar.gz

2.  Extract the tar file.
        tar -xvf nano-2.6.0.tar

3.  Compile the binary and install
        cd nano-2.6.0
        ./configure
        make
        make install

4.  copy the existing nano binary and make avilable the latest version
        cp -p /usr/bin/nano /usr/bin/_nano.2.0.9
        /usr/local/bin/nano -V


judi-dev-01# /usr/local/bin/nano -V
 nano, version 2.6.0
 (C) 1999..2016 Free Software Foundation, Inc.
 (C) 2014..2016 the contributors to nano
 Email: nano@nano-editor.org    Web: http://www.nano-editor.org/
 Compiled options: --disable-libmagic --disable-utf8
judi-dev-01#



~
Install nano in solaris 11.3
compile nano in solaris 11.3
nano editor in solaris 11.3

~Judi~

Jan 4, 2017

Scripting tricks and one liners

Scripting tricks and one liners



This page is useful for those who know scripting logic and looking for one liners.


Shell Built in Variables and Meanings
      $# Number of command line arguments. Useful to test no. of command line args in shell script.
      $* All arguments to shell
      $@ Same as above
      $- Option supplied to shell
      $$ PID of shell
      $! PID of last started background process (started with &)


awk one liners

1.  Remove empty or blank lines with the following command
        awk NF file > newfile

2.  Remove first 2 or 3 lines from the output using awk
        awk 'NR > 3  { print } ' filename

3.  Print Horizontal lines to vertical
        awk ' { for(i=1;i<=NF;i++) { print $i } } ' filename

4.  Print Vertical lines into Horizontal
        nawk 'ORS=" "' filename && echo
       OR
        cat file | xargs echo

4.  Column wise awk , if column 2 has word "JUDI", print the entire line
        awk '$2 == "JUDI" {print $0}' filename.log

5.  Use awk command to separate the fields using field separator
        grep -i judi /etc/passwd |awk -F":" '{print $6}'

6.  Print the line immediately before the pattern, not the line containing the pattern
        awk '/^DD/{print x};{x=$0}' myfile.txt

7.  Print the line where pattern is found,print previous line too using awk,
        awk '/^DD/{print x;print};{x=$0}' myfile.txt

8.  Print the line immediately after the pattern, not the line containing the pattern
        awk '/^DD/{f=1;next}f{print;exit}' myfile.txt
        awk '/PATTERN/{i=1;next;}{if(i){i--; print;}}'

9.  Print the line where pattern is found,print next line too
        awk '/^DD/{f=1;print;next}f{print;exit}' myfile.txt

10. Print the line where pattern is found, print the previous line and print the next 4 lines
        /usr/xpg4/bin/awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=1 a=4 s="Retryable" /var/adm/messages.3

11. Print the next four lines after the pattern using awk
        cat /etc/passwd | awk '/judi/ {for(i=1; i<=4; i++) {getline; print}}'

12. Multiple word grep pattern in awk, prints all records in 'filename' that contain both `2400' and `foo'.
        awk '/2400/ && /foo/' filename

13. Print if any one of the word exists in awk like egrep,  prints all records in 'filename' that contain either `2400' or `foo', or both.
        awk '/2400/ || /foo/' filename


14. Prints all the words expect the given word in awk ,Like grep -v ; prints all records in 'filename' that do not contain the string `foo'.
        awk '! /foo/' filename

15. Print last word using awk
        awk '{print $NF}' /tmp/123 # Prints last word from the file

16. Print last but one word using awk
        awk '{print $(NF-2)}' /tmp/123 # Prints last but one word from the file

17. Compare two files line by line and print the difference line alone
        nawk 'NR==FNR{name[$1]++;next} !($1 in name)' file1 file2

18. Compare two files line by line and print the matching lines alone
        nawk 'NR==FNR{name[$1]++;next}$1 in name' file2 file1

19. Compare tow file line by line and print the difference of both files
        nawk '{ h[$0] = ! h[$0] } END { for (k in h) if (h[k]) print k }' file1 file2

20. Print outputs between two patterns
        awk '/Cpu Compatibility Group/{flag=1;next}/Server Pool =/{flag=0}flag'

21. Print the previous line where pattern is found, {Find the NIC interface wby knowing the IP Address
        ifconfig -a | awk '/192.168.1.10/{print x};{x=$0}'

22. Do not print the pattern matching line and next line.
        iostat -E | awk '/NET/{matched=1;next} 1==matched{matched=0;next} {print}'
        iostat -E | awk '/NET|SEAGATE|TEAC/{matched=1;next} 1==matched{matched=0;next} {print}'

23. Print all records from some regexp:
        nawk '/regexp/{f=1}f' file OR                 (ex) nawk '/SunOS/{f=1}f' /var/adm/messages

24. Print all records after some regexp:
        nawk 'f;/regexp/{f=1}' file
                (ex) nawk 'f;/SunOS/{f=1}' /var/adm/messages

25. Print the Nth record after some regexp:
        nawk 'c&&!--c;/regexp/{c=N}' file
                (ex) nawk 'c&&!--c;/SunOS/{c=N}' /var/adm/messages

26. Print every record except the Nth record after some regexp:
        nawk 'c&&!--c{next}/regexp/{c=N}1' file
nnawk 'c&&!--c{next}/SunOS/{c=5}1' /var/adm/messages.2 (Every 5th line after SunOS will not display)

27. Print the N records after some regexp: Not the regexp
        nawk 'c&&c--;/regexp/{c=5}' file
                nawk 'c&&c--;/regexp/{c=5}' /var/adm/messages.2

28. Print every record except the N records after some regexp:
        nawk 'c&&c--{next}/regexp/{c=N}1' file

29. Print every record except the N records after some regexp:
        nawk '/regexp/{c=N}c&&c--' file


General one liners

1.  Print characters in bold letters
        echo -e "I am \033[1m BOLD \033[0m Person"

2.  Black foreground and white background in default color scheme
        echo -e "\033[7m Linux OS! Best OS!! \033[0m"

3.  Print characters in colours  30m - 37m(black)
        echo -e "\033[31m I am in Red"

4.  set background color 40m - 47m
        echo -e "\033[44m Wow!!!"

5.  will show all files beginning with letters a,b,c
        ls [abc]*

6.  Print from line number 20 to line number 30 and store this result to file called 'hlist'
        tail +20 < hotel.txt | head -n30 >hlist

7.  passing command to another server using 'Single Quote'
        ssh -q -o ConnectTimeout=10 root@$i 'uname -a; /usr/platform/`uname -i`/sbin/prtdiag -v | head -1'

8.  Find how many times a line has repeated in a file
        cat /tmp/1234 | sort | uniq -c | sort -nr | more

9.  Remove duplicate words from a line
        echo "zebra ant spider spider ant zebra ant" | xargs -n1 | sort -u | xargs 

10. Remove/delete the first 8 words(includes spaces) in a file's every line
        cut -d' ' -f8- <filename>

11. Find any string has alpha
        echo "IamARobot" | grep '[a-zA-Z]'

12. Find any string has numeric
        echo "IamARobot7" | grep '[0-9]'

13. Find any string has alpha umeric
        echo "IamARobot7" | grep '[a-zA-Z0-9]'

14. Print words in a straight line giving a tab space
        echo Mountpoint\tVolume\tFilesystem\tTotal\tBlocks

15. To get previous day in solaris (86400 seconds for one day) Calculate accordingly
        perl -MPOSIX=strftime -le 'print strftime("%d", localtime(time-86400))'

16. To get previous two days date in solaris
        perl -MPOSIX=strftime -le 'print strftime("%d", localtime(time-172800))'

17. To get previous date in solaris (24 Hours per day) Calculate accordiangly
        TZ=GMT+24 date +%d-%m-%Y
        TZ=GMT+48 date +%d-%m-%Y

18. Remove first 5 words from a file
        cat filename | cut -d " " -f6-

19. Find the duplicate entries from a file
        cat /tmp/1234 | sort | uniq -c | sort -nr

20. Division /Divide using expr command
        expr $(df -k /var | tail -1 | awk '{print $2}') \/ 1024 \/ 1024

21. Remove blank/empty line in a file
        grep '^..' <filename>

22. Find exact pattern match using grep
        grep '\<judi07\>' file.txt

23. Get epoch seconds of current time in solaris
        nawk "BEGIN{print srand}"

24. Set Prompt after login in UNIX - Update the profile file
        PS1=`hostname`:'$PWD# '

25. Read a file and print the lines one by one
        while IFS= read -r var; do
             echo "$var"
             sleep 1
        done < filename

26. A file has multiple lines, Every three lines will be send to a separate file, file name starts with "x"
        split -l 3 filename

27. Read filename1 by line by line ; Get a string from that line as var "A" ; if that var available/matches in any of the line in  filename2,
      Aappend the entire line of filename1 to filename2 next to the line matches the string
        #!/usr/bin/ksh
        while IFS= read -r var
        do
                A=`echo "$var" | awk -F"/" '{print $4}' | awk '{print $1}'`
                printf '%s\n' /$A/a "$var" . w q | ex -s filename2
        done < filename1

28.  Append a character at the end of each line in unix file
        awk '{print $0 "," } file > outFile

        sed 's/$/,/' file > outFile

29.  WC Command Examples to Count Number of Lines, Words, Characters in UNIX
          wc -l : Prints the number of lines in a file.
          wc -w : Prints the number of words in a file.
          wc -c : Displays the count of bytes in a file.
          wc -m : prints the count of characters from a file.

30.  Find full process name using ps command
          /usr/ucb/ps -auwx

31.  How to find the length of a string  in Linux
          $ x="judi"
          $ echo ${#x}

            4

32. Remove all special characters
        tr -dc '[:alnum:]\n\r'
        The first tr deletes special characters. d means delete, c means complement (invert the character set). So, -dc means delete all characters except those specified. The \n and \r are included to preserve linux or windows style newlines

33. Translate upper characters to lower lower case
        tr '[:upper:]' '[:lower:]'

34. Translate upper characters to lower lower case
        tr '[:upper:]' '[:lower:]'

          

for loop
    - This for loop is used to fetch the outputs from a list of servers
    - with conditions provided,
    - Any one of the server struck with timeout- No Problem
    - Password issue - No Problem
    - HostKeyChecking - No Problem
        #!/bin/ksh
        > NotReach.txt
        > Outputs.txt
        for i in `cat server_list` ; do
            ssh -nq -o StrictHostKeyChecking=no -o BatchMode=yes -o ConnectTimeout=15 judi@$i "uname -a" >> Outputs.txt
            if [ $? -ne 0 ];then
                echo "$i - Not Reachable" >> NotReach.txt
            fi
        done




sed one liners
1.  Remove last n characters - 1 or 2 or 3 or n characters
        sed 's/.\{1\}$//'

2.  remove empty lines using sed
        sed '/^$/d'

3.  print the last line using sed
        sed '$!d'

4.  Replace a Character using sed (Replace M with a space)
        sed 's/\M/ /g' 

5.  Replace a Character using sed (Replace M with a G)
        sed 's/\M/G/g'

6.  print the line immediately before the pattern, not the line containing the pattern
        sed -n '/^DD/{g;1!p;};h' myfile.txt

7.  print the line immediately after the pattern, not the line containing the pattern
        sed -n '/^DD/{n;p;}' myfile.txt

8.  Print the line where pattern is found,print next line too
        sed -n '/^DD/{p;n;p;}' myfile.txt

9.  Remove round Brackets using sed
        sed 's/[)(]//g'

10. To remove last four characters from a string or a file
        echo "diana123" | sed "s/....$//" #(dian - the dots refers each characters)
        sed "s/....$//" file1

11. To remove first 2 characters from a string or file
        sed 's/^..//' file1

12. To display last four characters from a string or a file
        echo "diana123" | sed "s/.*\(..$\)/\1/"
        sed "s/.*\(....$\)/\1/" file1

13. To display the last four characters from a file line by line
        while read -r line
        do
         echo ${line:(-4)}
        done < "file"

14. Exact pattern match of a variable using awk
        awk '$1=="'$ServerName'" {print $1}' file.txt

15. Remove only the mentioned special characters ex: " and ,
        sed 's/[\",]//g'



find command one liners
1.  Find symbolic links in a directory.
        find /opt/home/judi/ -type l -ls

2. Find files more than 270 days old
        /usr/xpg4/bin/find /opt/home/judi/ -mtime +270 -exec ls -l {} \;

3. Find the directories alone under the path /var/tmp/
        find /var/tmp/ -type d -exec ls -ld {} \;

4. grep contents in file using find command.
        find / -xdev -type f -exec grep -l bmc {} \;


~Judi~
Comments are welcome :)





Solaris 10 kernel patching procedure - SVM mirrored disk

Solaris 10 kernel patching procedure - SVM mirrored disk




Preparation:
  -  Collect basic command outputs for easy reference
  -  Collect the latest explorer output
  -  Make sure that you have a full backup of all file systems.
  -  Download the Recommended OS Patchset Solaris 10 SPARC
  -  unzip the Patchset in /root

Tasks:
  -  Preform a Sanitary reboot
  -  Boot the server from both disks before breaking the mirror
  -  Break the mirror, detatch the secondary disk from SVM
  -  Boot the server from secondary disk without svm (sliced disk)
  -  Boot the server from primary disk
  -  Boot the server from primary disk in single user mode
  -  Install the patches
  -  If patching is success, Attach the secondary disk to mirror
  -  If patching fails, Boot the server from secondary disk and create mirror


Disk c1t0d0 and c1t1d0 are in SVM mirror

1. Verify that the server is in good state before patching by performing a normal reboot of server.
    A clean reboot is required and verify no software/hardware issues were detected before proceeding
      shutdown -i6 -y -g0

2. Install bootblocks in both disk partition
      installboot /usr/platform/`uname –i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0
      installboot /usr/platform/`uname –i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

3. Make sure from which disk the server is booted
      prtconf -vp | grep bootpath

    This server is booted from disk c1t0d0

4. Bring down the server to OBP Prompt.
    Boot the server in rootdisk and rootmirror disk
      init 0
      devalias
      boot rootmirror

5. After successful boot, bring down the server to OBP and boot through rootdisk disk
      init 0
      boot rootdisk

6. metadevice outputs as follows
      root@Judi-dev-01 # metastat -c
      d20              m   12GB d21 d22
          d21          s   12GB c1t0d0s1
          d22          s   12GB c1t1d0s1
      d10              m  124GB d11 d12
          d11          s  124GB c1t0d0s0
          d12          s  124GB c1t1d0s0
      root@Judi-dev-01 #

      root@Judi-dev-01 # metadb
              flags           first blk       block count
           a m  p  luo        16              8192            /dev/dsk/c1t0d0s7
           a    p  luo        8208            8192            /dev/dsk/c1t0d0s7
           a    p  luo        16400           8192            /dev/dsk/c1t0d0s7
           a    p  luo        16              8192            /dev/dsk/c1t1d0s7
           a    p  luo        8208            8192            /dev/dsk/c1t1d0s7
           a    p  luo        16400           8192            /dev/dsk/c1t1d0s7
      root@Judi-dev-01 #

     If any one of the above steps failed, Stop proceeding further and fix the issue

7. After successful boot, detatch the rootmirror
      metadetach d20 d22
      metadetach d10 d12

8. Clear the metadevice
      metaclear d22
      metaclear d12

9. Delete the metadb from secondary disk
      metadb -d /dev/dsk/c1t1d0s7

10. Mount rootmirror/secondary disk's s0 slice to change the configuration.
      The change will allow to boot the server in sliced mode
        mount /dev/dsk/c1t1d0s0 /mnt
        cp -p /mnt/etc/vfstab /mnt/etc/vfstab.`date +%d-%b-%Y-%H-%M-%S`
        cp -p /mnt/etc/system /mnt/etc/system.`date +%d-%b-%Y-%H-%M-%S`

11. Edit the /mnt/etc/vfstab and modify the dsk / rdsk path to slised mode
        #/dev/md/dsk/d20        -       -       swap    -       no      -
        #/dev/md/dsk/d10        /dev/md/rdsk/d10        /       ufs     1       no      logging

        /dev/dsk/c1t1d0s1 -       -       swap    -       no      -
        /dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0        /       ufs     1       no      logging

12. Edit the /mnt/etc/system file and remove the entry related to SVM mirror
        * Begin MDD root info (do not edit)
        rootdev:/pseudo/md@0:0,10,blk
        set md_mirror:md_resync_bufsz = 2048
        set md:mirrored_root_flag = 1
        * End MDD root info (do not edit)

13. un mount the slice s0
        umount /mnt

14. Bring down the server to OBP
        init 0

15. Boot the server using sliced disk without SVM 
        boot rootmirror

16. After successful boot, reboot the server in rootdisk (SVM disk) and install the patch
        init 0
        boot rootdisk -s
        cd 10_Recommended
        ./installpatchset --s10patchset

17. Once the patch installation completed reboot the server
        init 6

18. Verify the server is updated with latest kernel version
        uname -a

19. Once application / Database team confirms that there is no issues with the new patches
      Attach the rootmirror disk with rootdisk
        metainit -f d12 1 1 c1t1d0s1
        metainit -f d22 1 1 c1t1d0s0

        metattach d10 d12
        metattach d20 d22

 Once the sync completes reboot the server once

Back-out Procedure:

 If the server fails to boot from the patched disk (rootdisk) or Application team want to revert the changes
1. Reboot the server from rootmirror disk with old kernel version
        init 0
        boot rootmirror

2. Create mirror with rootdisk
        prtvtoc /dev/rdsk/c1t1d0s2 | fmthard -s - /dev/rdsk/c1t0d0s2
        metadb -afc 3 c1t0d0s7 c1t1d0s7

        metainit -f d12 1 1 c1t1d0s1
        metainit -f d11 1 1 c1t0d0s1

        cp /etc/vfstab /etc/vfstab.`date +%d-%b-%Y-%H-%M-%S`

        metaroot d10

3. Check the /etc/system file, you will find an extra line
        rootdev:/pseudo/md@0:0,10,blk

4. Find the entry for root filesystem replaced with metadevice like below
        /dev/md/dsk/d10 /dev/md/rdsk/d10        /       ufs     1

5. Add the below entry in the /etc/system, This enable the server to boot from a single disk in case of disk failure
        set md:mirrored_root_flag = 1

6. Add the below entry in the /etc/system, this will perform fast sync
        set md_mirror:md_resync_bufsz = 2048

7. reboot the system
        shutdown -i6 -g0 -y

8. after reboot attach the other sub-mirror
        metattach d10 d11

9. Create metadevice for swap partition
        metainit -f d22 1 1 c1t1d0s0
        metainit -f d21 1 1 c1t0d0s0

        metainit d20 -m d22
        metattach d20 d21

10. Change the /etc/vfstab entry manually for the swap to metadevice instead of sliced swap
        #/dev/dsk/c1t0d0s1 -       -       swap    -       no      -
         #Change with below
        /dev/md/dsk/d20        -       -       swap    -       no      -

11. Verify the swap is using slice or metadevice,
        swap -l

12. If the swap uses sliced device change to metadevice
        swap -d /dev/dsk/c1t0d0s1
        swap -a /dev/md/dsk/d20

13. Set the swap as the dump device
        dumpadm -d swap

14. Install bootblocks in both disk partition
        installboot /usr/platform/`uname –i`/lib/fs/ufs/bootblk /dev/rdsk/c1t0d0s0
        installboot /usr/platform/`uname –i`/lib/fs/ufs/bootblk /dev/rdsk/c1t1d0s0

Once the sync completes, reboot the server once


Set the OBP parameters from OS

   ls -l /dev/dsk/c1t0d0s0
   ls -l /dev/dsk/c1t1d0s0

   eeprom "nvramrc=devalias rootdisk /devices/pci@1c,600000/scsi@2/sd@0,0:a rootmirror /devices/pci@1c,600000/scsi@2/sd@1,0:a"

   eeprom boot-device="rootdisk rootmirror"

   eeprom "use-nvramrc?=true"

Set the OBP parameters from OBP

   nvalias rootdisk /devices/pci@1c,600000/scsi@2/sd@0,0:a rootmirror /devices/pci@1c,600000/scsi@2/sd@1,0:a

   setenv boot-device rootdisk mirrordisk



~
Solaris 10 patching procedure with backout
Solaris 10 patching with backout procedure
Solaris 10 patching procedure - SVM mirrored disk
-

~Judi~
Comments are welcome :)

Popular Posts