Showing posts with label VCS. Show all posts
Showing posts with label VCS. Show all posts

Tuesday, February 18, 2014

OS patching on Solaris with VCS/SVM Environment











Here I am providing step by step patching plan for VCS cluster setup environment.

General Note:
1. Download latest patch bundle from oracle site
2. Take full OS backup
3. Take all the configuration screenshot backup as well as explorer (Save it to your Local "Laptop")
4. Check server console access.
5. Check the server's hardware health.
6. Application and Database team contacts details.

Pre-Requisite:

I. Download patch bundle from oracle site and copy to server /var/tmp/ (10_Recommended.zip).
II. Make necessary free space on /,/opt and /var FS.

Pre-Implementation Plan:

1. Take all the configuration screenshot backup as well as explorer (Save it to your Local "Laptop").
Here is the list of general commands -
2. Snooze the servers alerts.

These are the steps to patch VCS cluster servers:

Ensure Application / Databases are brought down (If it is running) Check the server where the cluster groups are running:
[root@tpt01]# hastatus -sum | grep -i online
B ClusterService tpt01 Y N ONLINE
B nbu_sg tpt01 Y N ONLINE
[root@tpt01]#
If the cluster service groups are running in patching node, switch over to another node This command will failover all the running cluster service groups to another node and stop the cluster on current node (from where we are executing the command)
[root@tpt01]# hastop -local -evacuate
Pre- reboot the server before doing patching activity and check if the server booting without any issue.
[root@tpt01]# sync;sync;sync
[root@tpt01]# init 6
Unzip the patch bundle:
[root@tpt01]# /usr/local/bin/unzip 10_Recommended.zip
Move the VCS startup files (to prevent cluster from start while reboot):
[root@tpt01]# mv /etc/rc3.d/S99vcs /etc/rc3.d/bake_S99vcs
[root@tpt01]# mv /etc/llthosts /etc/back_llthosts
[root@tpt01]# mv /etc/llttab /etc/back_llttab
[root@tpt01]# mv /etc/gabtab /etc/back_gabtab
Stop the cluster on current node (Patching node):
[root@tpt01]# hastop -local
Compare below three outputs to identify the rootdisk and rootmirror disk before detaching the secondary rootmirror disk:
[root@tpt01]# prtconf -pv | grep -i bootpath
bootpath: '/pci@9,600000/SUNW,qlc@2/fp@0,0/disk@w2100001862f7d137,0:a'
[root@tpt01]#

[root@tpt01]# metastat d10
d10: Mirror
Submirror 0: d11
State: Okay
Submirror 1: d12
State: Okay
Pass: 1
Read option: roundrobin (default)
Write option: parallel (default)
Size: 75505920 blocks (36 GB)

d11: Submirror of d10
State: Okay
Size: 75505920 blocks (36 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t0d0s0 0 No Okay Yes
d12: Submirror of d10
State: Okay
Size: 75505920 blocks (36 GB)
Stripe 0:
Device Start Block Dbase State Reloc Hot Spare
c1t1d0s0 0 No Okay Yes
Device Relocation Information:
Device Reloc Device ID
c1t0d0 Yes id1,ssd@n2000001862f7d137
c1t1d0 Yes id1,ssd@n2000001862f7f113
[root@tpt01]#

[root@tpt01]# echo | format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w2100001862f7d137,0
1. c1t1d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
/pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w2100001862f7f113,0
Detach secondary root mirror disk from root disk (For fail back the change if not success) Validate which are the MD device to detach since this server we have only / and swap FS on root disk. (Mainly we have consider /,/var,/opt and /export/home if we have these FS are separately : To confirm swap device name:
[root@tpt01]# swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d20 85,20 16 16790384 15817232
[root@tpt01]#
To confirm root device name:
[root@tpt01]# df -h /
Filesystem size used avail capacity Mounted on
/dev/md/dsk/d10 35G 29G 6.2G 83% /
[root@tpt01]#
Detach secondary root mirror disk:
[root@tpt01]# metadetach d10 d12
[root@tpt01]# metadetach d20 d22
Run fsck in secondary disk:
[root@tpt01]# fsck -y /dev/md/rdsk/d12
Mount the secondary disk on /mnt:
[root@tpt01]# mount /dev/dsk/c1t1d0s0 /mnt
Take back of system and vfstab files:
[root@tpt01]# cd /mnt/etc
[root@tpt01]# cp system system.29JAN2014
[root@tpt01]# cp vfstab vfstab.29JAN2014
Edit vfstab and add the entries:
[root@tpt01]# vi vfstab
/dev/dsk/c1t1d0s0 /dev/rdsk/c1t1d0s0 / ufs 1 no -
/dev/dsk/c1t1d0s1 - - swap - no -
Comment out the root information in /etc/system file (to prevent system to boot without MD device:
[root@tpt01]# vi system
*rootdev:/pseudo/md@0:0,10,blk
[root@tpt01]# sync;sync;sync
Un mount the mnt and boot the system with secondary disk:
[root@tpt01]# umount /mnt
Shutdown and bring into OBP Prompt:
Note: It is a good practice to test secondary mirror disk . Reboot the system using the secondary mirror disk to make sure it is booting up properly:
[root@tpt01]#shutdown -i0 -g0 -y
ok>devalias
ok>boot disk1
Shutdown the system again, then boot the primary disk into single-user mode for patching:
[root@tpt01]# shutdown -i0 -g0 -y
ok>boot -s
Go to the patch directory:
[root@tpt01]# cd /var/tmp/patches
[root@tpt01]# cd 10_Recommended 
[root@tpt01]# ./installpatchset --s10patchset

Setup ………………………..
Once patch installation done then reboot the server:
[root@tpt01]# init 6
Do a health check and find the new patch level:
[root@tpt01]# uname –a
Revoke the configuration as like earlier:
[root@tpt01]# mv /etc/rc3.d/bake_S99vcs /etc/rc3.d/S99vcs
[root@tpt01]# mv /etc/back_llthosts /etc/llthosts
[root@tpt01]# mv /etc/back_llttab /etc/llttab
[root@tpt01]# mv /etc/back_gabtab /etc/gabtab
Start the VCS cluster:
[root@tpt01]# hastart
Determine if the upgrade was successful.  Attached it back after few days: [root@tpt01]#metattach d10 d12
[root@tpt01]#metattach d20 d22
If not success reboot the server with secondary disk (roll-back) procedure. Posted dedicated post for revert back the OS patching

Friday, February 14, 2014

Fail-back plan for solaris OS patching with VCS/SVM Environment.


If the patching activity failed due to some unexpected reason (unfortunately ).Then we have to perform below task to bring the server into normal / operational status .

If the patching was not success, then reboot the server with secondary disk and roll-back the change.

Note : Now we have to consider secondary disk as a primary disk.

Boot the server from secondary disk with multiuser mode:
OK>boot disk1
Check whether we have any old configured metadb:
[root@tpt01]#metadb -i
These three below (Clear DB, Copy VTOC & Create DB ) steps are optional but good practice to do this.
Clear old metadb configuration:
[root@tpt01]#metadb -d /dev/dsk/c1t1d0s7 /dev/dsk/c1t0d0s7
Copy the VTOC from secondary disk to primary disk (old / Corrupted disk):
[root@tpt01]#prtvtoc /dev/rdsk/c1t1d0s2 | fmthard –s - /dev/rdsk/c1t0d0s2
SVM root mirroring steps. Create metadb newly with three replicas:
[root@tpt01]#metadb -afc3 /dev/dsk/c1t1d0s7 /dev/dsk/c1t0d0s7
Create MD device for / FS:
[root@tpt01]#metainit -f d11 1 1 c1t1d0s0
[root@tpt01]#metainit -f d12 1 1 c1t0d0s0
[root@tpt01]#metainit d10 -m d11
[root@tpt01]#metaroot d10
Shutdown and boot the server with secondary disk:
[root@tpt01]#init 5
OK>boot disk1
Attach secondary submirror to main meta mirror:
[root@tpt01]#metattach d10 d12
If we have dedicated file system like for i.e /var , /opt , /export/home then we have to perform same steps like above. As per my current setup, I have only / and /swap FS. For root file system I have already completed the mirroring let me do for /swap device. Create MD device for / swap FS:
[root@tpt01]#metainit -f d21 1 1 c1t1d0s1
[root@tpt01]#metainit -f d22 1 1 c1t0d0s1
[root@tpt01]#metainit d20 -m d21
[root@tpt01]#metattach d20 d22
Check whether syncing is happening:
[root@tpt01] metastat | grep -i sync or %
Edit vfstab and add the MD entries: Note : when you run metaroot command it will automatically add MD device name for /FS on /etc/vfstab, apart from that we have to add for other FS, i.e I am adding entry for /sawp FS. 
Here I am adding for /swap FS:
[root@tpt01]# vi vfstab
/dev/md/dsk/d10 /dev/md/rdsk/d10 / ufs 1 no -
/dev/md/dsk/d20 - - swap - no -
[root@tpt01]#
Now move back VCS configuration files to earlier state:
[root@tpt01]# mv /etc/rc3.d/bake_S99vcs /etc/rc3.d/S99vcs
[root@tpt01]# mv /etc/back_llthosts /etc/llthosts
[root@tpt01]# mv /etc/back_gabtab /etc/gabtab
Start VCS cluster service:
[root@tpt01]# hastart
Check cluster status:
[root@tpt01]# hastatus -sum | grep -i online
B ClusterService tpt01 Y N ONLINE
B nbu_sg tpt02 Y N ONLINE
[root@tpt01]#
To update the eeprom value to boot the server into secondary disk persistently. 
Check current status :
[root@tpt01]# eeprom | grep -i boot-device
boot-device=/pci@9,600000/SUNW,qlc@2/fp@0,0/disk@w2100001862f7d137,0:a disk net
[root@tpt01]# eeprom | grep -i nvramrc
use-nvramrc?=true
nvramrc=devalias net /pci@9,700000/network@2
[root@tpt01]#
As per the above current value use-nvramrc is true. It means server will ignore the boot device name and try to boot the server accordingly referred by use-nvramrc values: To change eeprom value: Here I am creating boot device name and updating nvramrc value:
[root@tpt01]#eeprom "boot-device=rootdisk rootmirror"
eeprom "nvramrc=devalias rootdisk /pci@9,600000/SUNW,qlc@2/fp@0,0/disk@w2100001862f7f113,0:a devalias rootmirror /pci@9,600000/SUNW,qlc@2/fp@0,0/disk@w2100001862f7d137,0:a"
[root@tpt01]#