Popular Posts

Showing posts with label solaris 9. Show all posts
Showing posts with label solaris 9. Show all posts

Mar 6, 2020

Solaris SVM mirroring root disks with Solaris volume manager

Solaris SVM mirroring root / boot disks with Solaris volume manager

APPLIES TO :  Oracle Solaris 8, 9, 10

ISSUE :  NIL

GOAL :  Mirror the Solaris root disk

SOLUTION :  Find below steps to mirror the root disk of Solaris 10 server.  

Prerequisites :   NIL


               1. Copy Partition table from root to mirror disk..
                       prtvtoc /dev/rdsk/c0t0d0s2 | fmthard -s - /dev/rdsk/c0t0d1s2

               2. Create the metadb state databases
                       metadb -afc 3 /dev/dsk/c0t0d0s7 /dev/dsk/c0t0d1s7

               3. To see the new state database replicas we just created :
                       metadb

               4. Create two submirrors for the root volume
                       metainit -f d11 1 1 c0t0d0s0
                       metainit d12 1 1 c0t0d1s0

                       metainit -f d21 1 1 c0t0d0s1
                       metainit d22 1 1 c0t0d1s1

                       metainit -f d31 1 1 c0t0d0s3
                       metainit d32 1 1 c0t0d1s3

                       metainit -f d41 1 1 c0t0d0s4
                       metainit d42 1 1 c0t0d1s4

                       metainit -f d51 1 1 c0t0d0s5
                       metainit d52 1 1 c0t0d1s5

                       metainit -f d61 1 1 c0t0d0s6
                       metainit d62 1 1 c0t0d1s6

               5. Setup one way mirror OR create main mirror with primary disk's sub mirror
                       metainit -f d100 -m d11
                       metainit d200 -m d21
                       metainit d300 -m d31
                       metainit d400 -m d41
                       metainit d500 -m d51

                       metainit d600 -m d61

               6. Backup the configuration files
                       cp /etc/vfstab /etc/vfstab.premirr
                       cp /etc/system /etc/system.premirr

               7. Activiate the Mirror using the metaroot command which will update the /etc/system and /etc/vfstab files
                       metaroot d100
               8. Verify the configuration  file /etc/system and /etc/vfstab
                       cat /etc/system|grep "md"
                              rootdev:/pseudo/md@0:0,10,blk --> This extra line reflects the mirror configuration


                       cat /etc/vfstab|grep -i md
              dev/md/dsk/d100 /dev/md/rdsk/d100        /       ufs     1    --> the root volume entry in vfstab modified.                                        

               9. Modify the system file
                       echo "set md:mirrored_root_flag=1" >> /etc/system

               10. Modify the vfstab for other metadevice entries
                       /dev/md/dsk/d200 - - swap - no -
                       /dev/md/dsk/d100 /dev/md/rdsk/d100 / ufs 1 no -
                       /dev/md/dsk/d400 /dev/md/rdsk/d400 /usr ufs 1 no -
                       /dev/md/dsk/d300 /dev/md/rdsk/d300 /var ufs 1 no -
                       /dev/md/dsk/d500 /dev/md/rdsk/d500       /opt    ufs     2       yes     -
                       /dev/md/dsk/d600 /dev/md/rdsk/d600 /oracle ufs 2 yes logging

               11. Before rebooting, run the sync command multiple times and lockfs -fa command to flush the data to file system
                       sync
                       sync
                       sync

                       lockfs -fa

               12. Now we can reboot the system.
                       shutdown -i6 -g0 -y

               13. Attaching the other submirror to the main mirror and sync the data
                       metattach d100 d12
                       metattach d200 d22
                       metattach d300 d32
                       metattach d400 d42
                       metattach d500 d52
                       metattach d600 d62

               14. Change the swap partition from slice device to meta device
                       swap -l
                       swap -d /dev/dsk/c0t0d0s1
                       swap -a /dev/md/dsk/d0

               15. if the dump device shows any disk slice path change it to meta device path.
                       dumpadm
                       dumpadm -d /dev/md/dsk/d1

               16. The sync will start now. To check the status of the mirror 
                       metastat -cp

               17. Install the boot block on the mirror disk
                       installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t0d1s0

               18. Reboot the server with both primary and secondary disks to check the stability of the mirror functionality. 



~ Judi ~

Aug 26, 2019

vi cheat sheet & vi basic commands

vi cheat sheet & vi basic commands


APPLIES TO :  Oracle SPARC Solaris and all unix OS

ISSUE : 

GOAL :  Easy reference to work in vi editor

SOLUTION :  


     1. To Move the cursor left  in vi editor
                 Press h
                 Press 5h - to move the cursor 5 characters left

     2. To Move the cursor right  in vi editor
                 Press l
                 Press 5l - to move the cursor 5 characters right

     3. To Move the cursor down  in vi editor
                 Press j
                 Press 5j - to move the cursor 5 lines down

     4. To Move the cursor up  in vi editor
                 Press k
                 Press 5k - to move the cursor 5 lines up

     5. To move the cursor to the right one word at a time in vi editor
                 Press w (“word”)
                 Press 5w - to move the cursor 5 words right

     6. To move the cursor to the left one word at a time  in vi editor
                 Press b (“back”)
                 Press 5b - to move the cursor 5 words left

     7. To move the cursor to the last character of the current word in vi editor
                 Press e (“end”)

     Moving to Start or End of Line
     8. To move the cursor to the start of the current line in vi editor
                 Press ^ or Press 0

     9. To move the cursor to the end of the current line in vi editor
                 Press $

     10. To move the cursor to the beginning of the next line down in vi editor
                 Press the Return key

     11. To move the cursor one character to the left in vi editor
                 Press the Back Space key

     12. To move the cursor one character to the right in vi editor
                 Press the Space Bar

     13. To move the cursor to the top of the screen in vi editor
                 Press H (“high”)

     14. Move to the first non-blank character of the line in vi editor
                 Press ^

     15. Jump forward one sentence in vi editor
                 Press )

     16. Jump backward one sentence in vi editor
                 Press (

     17. Jump forward one paragraph in vi editor
                 Press }

     18. Jump backward one paragraph in vi editor
                 Press {

     19. Jump to the middle of the screen in vi editor
                 Press M

     20. Jump to the bottom of the screen in vi editor
                 Press L

     21. Move the cursor to the end of file  in vi editor
                 Press G

     22. To create line numbers at the beginning of file  in vi editor
                 :set number

     23. Append or add a text next to the cursor in vi editor
                 Press a and type your content and press esc when finished

     24. Insert a text at the left of the cursor in vi editor
                 Press i and type your content and press esc when finished.

     25. Insert new line below the cursor  in vi editor
                 Press o

     26. Insert new line above the cursor  in vi editor
                 Press O

     27. Undoing a previous command or a change  in vi editor
                 Press u

     28. Undo all changes made to a line in vi editor
                 Press U

     29. To delete one character, position the cursor over the character to be deleted in vi editor
                 Press x

     30. To delete a word, place the cursor at the beginning of the word in vi editor
                 Press dw

     31. To delete a line, place the cursor anywhere on the line in vi editor
                 Press dd

     Copying Lines
     32. To Copy a line, place the cursor anywhere on the line  in vi editor
                 Press yy

     33. Paste the copied line, place the cursor above the line we need to paste in vi editor
                 Press p
                 Press P - paste the copied line to the above line


     Searching and Replacing
     34. Search a string in vi editor
                 :s/string
                 The first match of your string will be highlighted, Type n to see the additional occurance of nex match.

     35. Search and Replace a string in a line in vi editor
                 :s/pattern/replace/
                 This will replace the pattern with replace in the current line

     36. Search and Replace a string in a entire file in vi editor
                 :%s/pattern/replace/
                 This will replace every occurance of pattern with replace



~Judi~

Mar 22, 2018

Enable ssh in Solaris Legacy os Versions 6, 7 , 8 or 9


Enable ssh in Solaris Legacy os Versions 6, 7, 8 or 9

Issue :
Solaris 9 and below versions do not have ssh installed, This is a headache for those who are new to  Solaris administration and not familiar with Solaris 9 and below or Legacy Solaris OS's

Goal :
Install the ssh and supporting packages to enable ssh in Solaris 7, 8, 9 servers.
The required packages are :
    openssh
    openssl (SSL)
    prngd (Psuedo Random Generator Daemon)
    zlib (Z library)

All of the required packages are availble to download in the below google drive link.

Solution :
        1. Download the sshpkgs.sol8.tar.gz bundle and readme file from google drive
               OR
                     Package website link -   http://spout.ussg.indiana.edu/solaris/sparc/
                     Download the packages openssh , openssl (SSL) , prngd , zlib (Z library)

        2. Extract the package bundle
               # gzip -d sshpkgs.sol8.tar.gz ; tar -xvf sshpkgs.sol8.tar

        3. Install the openssl package
               # pkgadd -d openssl-0.9.6c-sol8-sparc-local

        4. Install the prngd package
               # pkgadd -d prngd-0.9.23-sol8-sparc-local

        5. Install the zlib package
               # pkgadd -d zlib-1.1.4-sol8-sparc-local

        6. Install the openssh package
               # pkgadd -d openssh-3.1p1-sol8-sparc-local

        7. Create a startup script for the ssh daemon with below content
                # vi /etc/init.d/sshd
                              #! /bin/sh
                              #
                              # start/stop the secure shell daemon
                              case "$1" in
                              'start')
                                   # Start the ssh daemon
                                   if [ -f /usr/local/sbin/sshd ]; then
                                        echo "starting SSHD daemon"
                                        /usr/local/sbin/sshd &
                                   fi
                                   ;;
                              'stop')
                                   # Stop the ssh deamon
                                   PID=`/usr/bin/ps -e -u 0 | /usr/bin/fgrep sshd | /usr/bin/awk '{print $1}'`
                                   if [ ! -z "$PID" ] ; then
                                        /usr/bin/kill ${PID} >/dev/null 2>&1
                                   fi
                                   ;;
                              *)
                                   echo "usage: /etc/init.d/sshd {start|stop}"
                                   ;;
                              esac

        8. Make the script executable and create a startup script on run level 2
                # chmod +x /etc/init.d/sshd
                # ln -s /etc/init.d/sshd /etc/rc2.d/S99sshd

        9. Create a startup script for the pseudo random generator daemon.
                # vi /etc/init.d/prngd
                              #! /bin/sh
                              #
                              # start/stop the pseudo random generator daemon
                              case "$1" in
                              'start')
                                   # Start the ssh daemon
                                   if [ -f /usr/local/bin/prngd ]; then
                                        echo "starting PRNG daemon"
                                        /usr/local/bin/prngd /var/spool/prngd/pool&
                                   fi
                                   ;;
                              'stop')
                                   # Stop the ssh deamon
                                   PID=`/usr/bin/ps -e -u 0 | /usr/bin/fgrep prngd | /usr/bin/awk '{print $1}'`
                                   if [ ! -z "$PID" ] ; then
                                        /usr/bin/kill ${PID} >/dev/null 2>&1
                                   fi
                                   ;;
                              *)
                                   echo "usage: /etc/init.d/prngd {start|stop}"
                                   ;;
                              esac

        10. Make the script executable and create a startup script on run level 2
                 # chmod +x /etc/init.d/prngd
                 # ln -s /etc/init.d/prngd /etc/rc2.d/S99prngd

        11. Start the prngd sevice
                 # mkdir -p /var/spool/prngd
                 # /etc/init.d/prngd start

        12. Create a public key pair to support the new, DSA-based version 2 protocol
                 # /usr/local/bin/ssh-keygen -d -f /usr/local/etc/ssh_host_dsa_key -N ""

        13. Create a public key pair to support the old, RSA-based version 1 protoco
                 # /usr/local/bin/ssh-keygen -b 1024 -f /usr/local/etc/ssh_host_rsa_key -t rsa -N ""

        14. Edit ssh daemon configuration file /usr/local/etc/sshd_config, enable protocol 2 and 1
                 Uncomment the line, that says
                 protocol 2,1

        15. starting SSHD daemon
                 # /etc/init.d//sshd start

Your ssh server is now ready to accept a ssh session.



~Judi~

###Help
http://www.unixguide.net/sun/ssh_installation.shtml

###PKGS available under
http://spout.ussg.indiana.edu/solaris/freeware/sparc/5.8/







Popular Posts