Friday, September 16, 2016

RHEL scan new LUNS

cd /root/storage/
cat scan.sh
#!/bin/bash

SLEEP_INTERVAL=30

echo "Scanning all fibre channel host adapters"

for i in `ls /sys/class/fc_host`
do
    echo "Rescanning /sys/class/fc_host/${i}:"

    echo "  Issuing a loop initialization on ${i}:"
    echo "1" > /sys/class/fc_host/${i}/issue_lip

    echo "  Scanning ${i} for new devices:"
    echo "- - -" > "/sys/class/scsi_host/${i}/scan"

    echo "Sleeping for ${SLEEP_INTERVAL} seconds"
    sleep ${SLEEP_INTERVAL}
done
---
multipath -ll | egrep '0a43|0a44|0a45|0a46|0a47' | sort

Create a template for new voting disk and add them into EOF /etc/multipath.conf

multipaths {

##############VOTING##############
multipath {
wwid 360060e80166f440000016f4400000a46
alias asmvoting001
}
multipath {
wwid 360060e80166f440000016f4400000a47
alias asmvoting002
}
multipath {
wwid 360060e80166f440000016f4400000a44
alias asmvoting003
}
multipath {
wwid 360060e80166f440000016f4400000a45
alias asmvoting004
}
multipath {
wwid 360060e80166f440000016f4400000a43
alias asmvoting005
}

}

add the following lines into  /etc/udev/rules.d/96-multipath-permission.rules
ACTION=="add|change", ENV{DM_UUID}=="*mpath-*" , ENV{DEVLINKS}=="/dev/mapper/asm*[a-z][0-9][0-9][0-9]*p1*", GROUP="oinstall", OWNER="grid", MODE="660"
multipath -F
service multipathd reload
multipath -ll | grep asm
multipath -ll | grep asm | sort
create a disk input file with the following content devlist

mapper/asmvoting001
mapper/asmvoting002
mapper/asmvoting003
mapper/asmvoting004
mapper/asmvoting005

vi devlist
mapper/asmvoting001
mapper/asmvoting002
mapper/asmvoting003
mapper/asmvoting004
mapper/asmvoting005

cat format_disk.sh
#! /bin/bash
ODEV="/oracle_asmdev";
if [ ! -d ${ODEV} ]
then
        /bin/mkdir ${ODEV}
        if [ $? -ne 0 ]
        then
                echo "mkdir ${ODEV} may have failed. Please investigate."
                exit 1
        fi
fi
check_disk() {
        /bin/dd if=/dev/${1} of=/dev/null bs=1048576 count=10
        if [ $? -ne 0 ]
        then
                echo "/dev/${1}p1 may not be configured correctly."
        fi
}
setup_device() {

        echo "2048,," | /sbin/sfdisk -uS /dev/${1} --force
        /sbin/partprobe /dev/${1}
        kpartx -a -v -p p /dev/${1}
}
setup_permission() {
        fdisk -l /dev/${1};
        #/bin/ln -s  /dev/"$1"p1 $2
        /bin/chown grid:oinstall $2
        /bin/chmod 0640 $2
}
echo -n "Enter rac env:eg - pgr2>"
read env
for rec in `cat devlist`
do
        asmrawdev=`echo $rec|cut -d"," -f1`
        asmdir=`echo $rec|cut -d"," -f2`
        echo "/dev/${asmrawdev}p1 -> ${ODEV}/$env-${asmdir}"
        if [ -b /dev/${asmrawdev} ]
        then
                echo "setup_device $asmrawdev ${ODEV}/$env-${asmdir}"
                setup_device $asmrawdev ${ODEV}/$env-${asmdir}
                echo "setup_permission $asmrawdev ${ODEV}/$env-${asmdir}"
                setup_permission $asmrawdev ${ODEV}/$env-${asmdir}
                echo "check_disk ${asmrawdev} ${ODEV}/$env-${asmdir}"
                check_disk ${asmrawdev} ${ODEV}/$env-${asmdir}
        else
                echo "/dev/${asmrawdev} does not exist"
        fi
done
exit 0
--
on 2nd and 3rd node
just update the /etc/multipath.conf and into  /etc/udev/rules.d/96-multipath-permission.rules file content same as first node

then scan for luns using the script /root/storage/scan.sh
---
multipath -F
service multipathd reload

Thursday, March 3, 2016

RHEL6 File system shrink

RHEL6 File system shrink
#take back-up
umount /opt

e2fsck -f /dev/mapper/VolGroup00-optvol
resize2fs /dev/mapper/VolGroup00-optvol 150G
lvchange -an /dev/mapper/VolGroup00-optvol
lvreduce -L 150G /dev/mapper/VolGroup00-optvol
lvchange -ay /dev/mapper/VolGroup00-optvol
e2fsck -f /dev/mapper/VolGroup00-optvol


RHEL6 File system extent on-line root fs

lvextend VolGroup00/rootvol -L +230G

resize2fs /dev/mapper/VolGroup00-rootvol 271G

Wednesday, January 21, 2015

A complete list of FORMAT control characters supported by the date command

A complete list of FORMAT control characters supported by the date command

FORMAT controls the output. It can be the combination of any one of the following:
%FORMAT StringDescription
%%a literal %
%alocale's abbreviated weekday name (e.g., Sun)
%Alocale's full weekday name (e.g., Sunday)
%blocale's abbreviated month name (e.g., Jan)
%Blocale's full month name (e.g., January)
%clocale's date and time (e.g., Thu Mar 3 23:05:25 2005)
%Ccentury; like %Y, except omit last two digits (e.g., 21)
%dday of month (e.g, 01)
%Ddate; same as %m/%d/%y
%eday of month, space padded; same as %_d
%Ffull date; same as %Y-%m-%d
%glast two digits of year of ISO week number (see %G)
%Gyear of ISO week number (see %V); normally useful only with %V
%hsame as %b
%Hhour (00..23)
%Ihour (01..12)
%jday of year (001..366)
%khour ( 0..23)
%lhour ( 1..12)
%mmonth (01..12)
%Mminute (00..59)
%na newline
%Nnanoseconds (000000000..999999999)
%plocale's equivalent of either AM or PM; blank if not known
%Plike %p, but lower case
%rlocale's 12-hour clock time (e.g., 11:11:04 PM)
%R24-hour hour and minute; same as %H:%M
%sseconds since 1970-01-01 00:00:00 UTC
%Ssecond (00..60)
%ta tab
%Ttime; same as %H:%M:%S
%uday of week (1..7); 1 is Monday
%Uweek number of year, with Sunday as first day of week (00..53)
%VISO week number, with Monday as first day of week (01..53)
%wday of week (0..6); 0 is Sunday
%Wweek number of year, with Monday as first day of week (00..53)
%xlocale's date representation (e.g., 12/31/99)
%Xlocale's time representation (e.g., 23:13:48)
%ylast two digits of year (00..99)
%Yyear
%z+hhmm numeric timezone (e.g., -0400)
%:z+hh:mm numeric timezone (e.g., -04:00)
%::z+hh:mm:ss numeric time zone (e.g., -04:00:00)
%:::znumeric time zone with : to necessary precision (e.g., -04, +05:30)
%Zalphabetic time zone abbreviation (e.g., EDT)

Friday, October 24, 2014

VCS Commands

VCS Commands

haconf -makerw
hagrp -add app_sg
hagrp -modify app_sg SystemList node01 0 node02 1
hagrp -modify app_sg AutoStartList node01 node02
hagrp -display app_sg -attribute AutoStartList
hares -add app_dg DiskGroup app_sg
hares -add app_nic NIC app_sg
hares -add app_mnt Mount app_sg
hares -add app_vol Volume app_sg
hares -add app_ip IP app_sg
hares -list
hagrp -modify app_sg SystemList node01 node02
hagrp -modify app_sg SystemList node01 0 node02 1
hagrp -modify app_sg AutoStartList node02 node01
hagrp -modify app_sg SystemList node01 0 node02 1
hagrp -modify app_sg AutoStartList node01 node02
hares -modify app_dg DiskGroup webdg
hares -modify app_mnt BlockDevice /dev/vx/dsk/webdg/vol2
hares -modify app_mnt FSType vxfs
hares -modify app_mnt FsckOpt "-%y"
hares -modify app_mnt FsckOpt "%-y"
hares -modify app_mnt MountPoint /webvol2
hares -modify app_ip Device e1000g3
hares -modify app_ip Address 10.200.50.215
hares -modify app_ip NetMask 255.255.255.0
hares -modify app_vol Volume vol2
hares -modify app_vol DiskGroup webdg
--
hares -link app_ip app_nic
hares -link app_mnt app_vol
hares -link app_mnt app_ip
hares -link app_vol app_dg
-------------
hares -modify app_mnt Critical 1
hares -modify app_dg Enabled 1
-----------------------
hares -list
hares -dep
---------
root@node01:/var/VRTSvcs/log # hastatus -sum

-- SYSTEM STATE
-- System               State                Frozen

A  node01               RUNNING              0
A  node02               RUNNING              0

-- GROUP STATE
-- Group           System               Probed     AutoDisabled    State

B  apache_sg       node01               Y          N               ONLINE
B  apache_sg       node02               Y          N               OFFLINE
B  app_sg          node01               Y          N               OFFLINE
B  app_sg          node02               Y          N               ONLINE
root@node01:/var/VRTSvcs/log #
----------------------------------------------------------------
 hagrp -switch app_sg -to node02

Wednesday, September 10, 2014

Openfiler & ISCSI in Solaris 10


Some of the commands in Solaris 10 ISCSI

$ iscsiadm modify discovery --static enable
$ iscsiadm list static-config
$ iscsiadm add static-config iqn.2006-01.com.openfiler:tsn.2d3b68e3a76c,10.208.133.201:3260
$ iscsiadm remove static-config iqn.2006-01.com.openfiler:tsn.2d3b68e3a76c,10.208.133.201,3260
$ svcs -a |grep iscsi
online         23:34:48 svc:/network/iscsi/initiator:default
online         23:34:55 svc:/system/iscsitgt:default

Openfiler

1. Map ISCSI LUN
2. Share Network range.

(Incomplete doc)