Thursday, February 26, 2015

fstab nfs entry for Solaris and Redhat

Solaris nfs share entry

# cat /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
mynfsservera:/vol/mynasdevice5/myunxsrvs3 - /mynfsmnt1 nfs - yes -
mynfsserverb:/vol/mynasdevice4/myunxsrvss4 - /mynfsmnt2 nfs - yes -

=================================================

Linux - Redhat nfs share entry
# cat /etc/fstab
mynfsservera:/vol/mynasdevice5/myunxsrvs3 /mynfsmnt1 nfs defaults        0 0
mynfsserverb:/vol/mynasdevice4/myunxsrvss4 /mynfsmnt2 nfs defaults        0 0
 

Wednesday, February 25, 2015

Find the size of the disk that is part of ASM disk

# lvs
# fdisk -l
# multipath -ll | more
# multipath -ll | grep -A 1 ASMDISK
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//' | grep ASM
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//' | grep ASM
# multipath -ll | grep -A 1 ASMDISK | awk '/ASMDISK/ {print $1} /size=/ {print substr($0,1,11)}' | awk '/ASMDISK/ {l1=$0; getline; print l1 " " $0}'  | sort
ASMDISK01 [size=101G]
ASMDISK02 [size=101G]
ASMDISK02 [size=101G]
ASMDISK04 [size=101G]
ASMDISK05 [size=101G]
ASMDISK06 [size=101G]
ASMDISK07 [size=101G]
ASMDISK08 [size=101G]
ASMDISK09 [size=101G]
ASMDISK10 [size=101G]
ASMDISK19 [size=101G]
ASMDISK21 [size=101G]


# ls -l /dev/mapper
# multipath -ll
# multipath -ll  | grep -A 1 3600

# multipath -ll  | grep -A 1 3600
SANDISK03 (360060160mmn02600481hgjn40112e011) dm-2 DGC,VRAID
[size=100G][features=1 queue_if_no_path][hwhandler=1 emc][rw]
--
SANDISK02 (360060160mmn02600491hgjn40112e011) dm-0 DGC,VRAID
[size=100G][features=1 queue_if_no_path][hwhandler=1 emc][rw]
--
SANDISK01 (360060160mmn026004a1hgjn40112e011) dm-1 DGC,VRAID
[size=100G][features=1 queue_if_no_path][hwhandler=1 emc][rw]

# df -h
Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/sanvg-oradbdata
                      249G  115G  121G  49% /data/oradata
/dev/mapper/sanvg-oradblog
                       47G  181M   44G   1% /data/oralog

# pvs -o +devices
  PV                     VG     Fmt  Attr PSize   PFree    Devices
  /dev/cciss/c0d0p5      system lvm2 a--   84.44G    7.44G /dev/cciss/c0d0p5(0)
  /dev/mpath/SANDISK01p1 sanvg  lvm2 a--  100.00G       0  /dev/mpath/SANDISK01p1(0)
  /dev/mpath/SANDISK02p1 sanvg  lvm2 a--  100.00G       0  /dev/mpath/SANDISK02p1(0)
  /dev/mpath/SANDISK03p1 sanvg  lvm2 a--  100.00G 1012.00M /dev/mpath/SANDISK03p1(0)
  /dev/mpath/SANDISK03p1 sanvg  lvm2 a--  100.00G 1012.00M /dev/mpath/SANDISK03p1(13314)
  /dev/mpath/SANDISK03p1 sanvg  lvm2 a--  100.00G 1012.00M

# vgs -o +devices
  VG     #PV #LV #SN Attr   VSize   VFree    Devices
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK01p1(0)
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK02p1(0)
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK03p1(0)
  sanvg    3   2   0 wz--n- 299.99G 1012.00M /dev/mpath/SANDISK03p1(13314)
  system   1   5   0 wz--n-  84.44G    7.44G /dev/cciss/c0d0p5(0)

# lvs -o +devices
  LV            VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert Devices
  oradblv1      sanvg  -wi-ao 252.00G                                       /dev/mpath/SANDISK01p1(0)
  oradblv1      sanvg  -wi-ao 252.00G                                       /dev/mpath/SANDISK02p1(0)
  oradblv1      sanvg  -wi-ao 252.00G                                       /dev/mpath/SANDISK03p1(0)
  oradblv2      sanvg  -wi-ao  47.00G                                       /dev/mpath/SANDISK03p1(13314)


# Linux disk migration instructions

Step 1: Back up main config files
#   /etc/inittab
#   /etc/fstab
#   /etc/multipath.conf
#   more points as you go ...

#     update multipath.conf  ASM filesystem disks: ASMDISK or flatefile
#  
# set runlevel to 1
#  reboot
#     a) create new physical disks
#     b) create new volume group SANVG1 and add physical disks to it
#     c) create new logical volumes to match existing logical volumes
#     d) create new filesystems to match existing filesystems
#     e) make temporary mount points
#     f) rsync new filesystems with existing filesystems
#     g) reset /etc/fstab to point to new filesystems
# run asm update step
# reset multipath.cfg with new linux filesystem and new asm disks
# reboot
# verify disk configuration
# reset runlevel to 3
# restore /etc/inittab
# reboot
# verify application

Check if service is running or not on Redhat servers

[dev@localhost ~]$ cat  http.check.ksh

#!/bin/ksh
# Checks if particular servce is running or not.
#
###### config_file ######
#-----------------------#
#### cat hosts_list ####
######## server1 ########
######## server2 ########
#
USER_CHOICE=$1
HOSTS_LIST=$2
# APP_CHK=httpd

if [ -z $USER_CHOICE ]
then
    echo usage: your_script.ksh --check  {hosts_list_config_file}
    exit 0
fi
if [ -z $HOSTS_LIST ]
then
    echo usage: your_script.ksh --check  {hosts_list_config_file}
    exit 0
fi
if [ ! -f $HOSTS_LIST ]
then
    echo file $HOSTS_LIST does not exist. Pls add to the configuration.
    echo please check the config file and try again
    exit 4
fi
if [ "$USER_CHOICE" = "--check" ]
then
    for i in $(cat $HOSTS_LIST)
    do
       # /usr/bin/uptime > /dev/null 2>&1
       # if [ $? -eq 1 ]
       # then
       #         echo something wrong >> failed.log
       # else
 
        if [[ "$(service httpd status | grep httpd | awk -F" " '{print $3}')" = "stopped" ]]
        then
                echo httpd is stopped
        else
                echo httpd is running.
        fi

    done
else
    # no valid choice
    echo usage: your_script.ksh --check  {hosts_list_config_file}
fi
[dev@localhost ~]$

Config file
[dev@localhost ~]$ cat hosts_list
localhost.localdomain

To run the script
[dev@localhost ~]$ sh http.check.ksh --check hosts_list

Tuesday, February 24, 2015

Create filesystem using LVM on Redhat 6

aigsun15% cat LVM_SYBASE
# File_name: LVM_SYBASE
# Sam; Only for personal use
# This is a config file for sybase FS.
# mPoint        Size (GB)       vg              LV
#-------------------------------------------------------
#/web           10              datavg          WEB
#/webdata       15              datavg          WEBDATA
#
# system: scsi-(0:1)  Total (GB):- 36
/opt/sybase     15              system          OPT_SYBASE
/opt/foglight   10              system          OPT_FOGLIGHT
/opt/gaurdium   10              system          OPT_GUARDIUM
#
# sybdata scsi-(1:0)  Total (GB):- 176
/data/sybdata   175             sybdata         DATA_SYBDATA
#
# syblog scsi-(2:0)   Total (GB):- 71
/data/syblog    70              syblog          DATA_SYBLOG
#
# sybtemp scsi-(3:0)  Total (GB):- 156
/data/sybtemp   25              sybtemp         DATA_SYBTEMP
/data/sybdump   130             sybtemp         DATA_SYBDUMP
#
# sybserver: scsi-(3:1) Total (GB):- 36
/data/sybase    10              sybserver       DATA_SYBASE
/data/sybserver 25              sybserver       DATA_SYBSERVER
aigsun15% ls -l
total 14
-rw-r--r--   1 sam   sysadmin     1068 Aug 20 16:13 LVM_SYBASE
-rw-r--r--   1 sam   sysadmin      492 Aug 20 16:15 LVM_WEBLOGIC
-rw-r--r--   1 sam   sysadmin     2680 Aug 20 16:55 lvm_create_fs_SB.sh
-rw-r--r--   1 sam   sysadmin     1924 Aug 20 16:18 lvm_create_fs_WL.sh
aigsun15% cat lvm_create_fs_SB.sh
#!/bin/sh
# Sam; Only for personal use
# Automate FS creation task. This script tested and verified on Redhat Enterprise 6.x version.
# Mon Feb 24 12:13:24 EST 2014
# Update: Thu Aug 14 09:55:12 EDT 2014
# 1. Added the entry for mount point on config file.
# 2. Added entry to the fstab.
# 3. Ownership Change
#
# Config file entry eg.
# # File_name: LVM_SYBASE
# # For SYBASE Server
# Note: Please understand the config file LVM_SYBASE before running this script.
# echo "- - -" > /sys/class/scsi_host/host[0-3]/scan
# pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
# vgextend system /dev/sdb1
# vgcreate sybdata /dev/sdc1
# vgcreate syblog /dev/sdd1
# vgcreate sybtemp /dev/sde1
# vgcreate sybserver /dev/sdf1
#
# This is a config file for sybase FS.
# mPoint        Size (GB)       vg              LV
#-------------------------------------------------------
#/web           10              datavg          WEB
#/webdata       15              datavg          WEBDATA
#
if [ `/usr/bin/whoami` != "root" ]
then
        echo "You must be root to run this script"
        exit 1
fi
# Creating LVM.
echo "###########################################################################" >>/etc/fstab
/bin/cat LVM_SYBASE | grep -v "^#" | while read mymt mysize myvg myfs
do
        echo " "
        # Check if mount point already exists.
        #/bin/df -h ${mymt}
        /bin/ls -ld ${mymt}
        if [ $? -eq 0 ]; then
                echo "Mount Point exists."
                echo "Please review the config file."
                exit 1
        fi
        /sbin/lvcreate -L ${mysize}G -n ${myfs} ${myvg}
        /sbin/mkfs.ext4 /dev/${myvg}/${myfs}
        # Create mount point
        /bin/mkdir -p ${mymt}
        # Add Entry to fstab
#       echo "###########################################################################" >>/etc/fstab
        echo "/dev/${myvg}/${myfs}      ${mymt} ext4    defaults        1 2" >>/etc/fstab
        # Mount the filesystem.
        /bin/mount -a
        # Verify if the filesystems were created.
        /bin/df -hP      ${mymt}
        # Check the condition if the process is successful.
        if [ $? -eq 0 ]; then
                echo "Successfully Created fileystem."
                continue
        else
                echo "Failed, please review the error"
                # exit
        fi
        # Change the ownership
        /bin/chown sybase:users /data/syb*
        /bin/chown sybase:users /opt/sybase
        /bin/chown qstinsp:qstcinsg /opt/foglight
echo " ----------------end----------------"
done
# Backout Plan
# List your LVMs
# lvscan
# lvremove /dev/${myvg}/${myfs}
# vgdestroy datavg
aigsun15% ls -l
total 14
-rw-r--r--   1 sam   sysadmin     1068 Aug 20 16:13 LVM_SYBASE
-rw-r--r--   1 sam   sysadmin      492 Aug 20 16:15 LVM_WEBLOGIC
-rw-r--r--   1 sam   sysadmin     2680 Aug 20 16:55 lvm_create_fs_SB.sh
-rw-r--r--   1 sam   sysadmin     1924 Aug 20 16:18 lvm_create_fs_WL.sh

aigsun15% cat LVM_WEBLOGIC
# File_name: LVM_WEBLOGIC
# Script Name: lvm_create_WL.sh
# Sam; Only for personal use
# For Weblogic
# vg    FS      Size(GB)  mPoint
#--------------------------------
#datavg WEB     10      /web
#datavg WEBDATA 15      /webdata
#
datavg  PKGS            20      /pkgs
datavg  CLOUD             10      /cloud
datavg  CLOUD_DOCROOT     10      /cloud/docroot
datavg  CLOUD_SERVERS     10      /cloud/servers
datavg  DATA_TEST       10      /data/test
datavg  DATADATA        10      /datadata
aigsun15% ls -l
total 14
-rw-r--r--   1 sam   sysadmin     1068 Aug 20 16:13 LVM_SYBASE
-rw-r--r--   1 sam   sysadmin      492 Aug 20 16:15 LVM_WEBLOGIC
-rw-r--r--   1 sam   sysadmin     2680 Aug 20 16:55 lvm_create_fs_SB.sh
-rw-r--r--   1 sam   sysadmin     1924 Aug 20 16:18 lvm_create_fs_WL.sh

aigsun15% cat lvm_create_fs_WL.sh
#!/bin/sh
# Sam; Only for personal use
# Automate FS creation task. This script tested and verified on Redhat Enterprise 6.x version.
# Config file entry eg.
# # Config File Name: LVM_WEBLOGIC
# # For Weblogic
# # vg    FS      Size(GB) Mnt point
# --------------------------------
# datavg  WEB     10     /web
# datavg  WEBDATA 15     /webdata
#
# Mon Feb 24 12:13:24 EST 2014
# Update: Thu Aug 14 09:55:12 EDT 2014
# Added the entry for mount point on config file.
# Added entry to the fstab.
#
if [ `/usr/bin/whoami` != "root" ]
then
        echo "You must be root to run this script"
        exit 1
fi
# Creating LVM.
echo "###########################################################################" >>/etc/fstab
/bin/cat LVM_WEBLOGIC | grep -v "^#" | while read myvg myfs mysize mymt
do
        echo " "
        # Check if mount point already exists.
        #/bin/df -h ${mymt}
        /bin/ls -ld ${mymt}
        if [ $? -eq 0 ]; then
                echo "Mount Point exists."
                echo "Please review the config file."
                exit 1
        fi
        /sbin/lvcreate -L ${mysize}G -n ${myfs} ${myvg}
        /sbin/mkfs.ext4 /dev/${myvg}/${myfs}
        # Create mount point
        /bin/mkdir -p ${mymt}
        # Add Entry to fstab
        echo "/dev/${myvg}/${myfs}      ${mymt} ext4    defaults        1 2" >>/etc/fstab
        # Mount the filesystem.
        /bin/mount -a
        # Verify if the filesystems were created.
        /bin/df -h      ${mymt}
        # Check the condition if the process is successful.
        if [ $? -eq 0 ]; then
                echo "Successfully Created fileystem."
                continue
        else
                echo "Failed, please review the error"
                # exit
        fi
echo " ----------------end----------------"
done
# Backout Plan
# List your LVMs
# lvscan
# lvremove /dev/${myvg}/${myfs}
# vgdestroy datavg
aigsun15%

LVM striping

umount /opt/data11
umount /opt/data12
umount /opt/data13
umount /opt/data14
umount /opt/data15


lvremove SANvg11/DATA11
lvremove SANvg12/DATA12
lvremove SANvg13/DATA13
lvremove SANvg14/DATA14
lvremove SANvg15/DATA15


vgremove SANvg11
vgremove SANvg12
vgremove SANvg13
vgremove SANvg14
vgremove SANvg15


vgcreate -s 128M SANvg11 /dev/mapper/DATADISK85p1 /dev/mapper/DATADISK86p1 /dev/mapper/DATADISK87p1 /dev/mapper/DATADISK88p1

vgcreate -s 128M SANvg12 /dev/mapper/DATADISK89p1 /dev/mapper/DATADISK90p1 /dev/mapper/DATADISK91p1 /dev/mapper/DATADISK92p1

vgcreate -s 128M SANvg13 /dev/mapper/DATADISK93p1 /dev/mapper/DATADISK94p1 /dev/mapper/DATADISK95p1 /dev/mapper/DATADISK96p1

vgcreate -s 128M SANvg14 /dev/mapper/DATADISK97p1 /dev/mapper/DATADISK98p1 /dev/mapper/DATADISK99p1 /dev/mapper/DATADISK100p1

vgcreate -s 128M SANvg15 /dev/mapper/DATADISK101p1 /dev/mapper/DATADISK102p1 /dev/mapper/DATADISK103p1 /dev/mapper/DATADISK104p1



lvcreate -i4 -I128 -L402G -n DATA11 SANvg11 /dev/mapper/DATADISK85p1 /dev/mapper/DATADISK86p1 /dev/mapper/DATADISK87p1 /dev/mapper/DATADISK88p1

lvcreate -i4 -I128 -L402G -n DATA12 SANvg12 /dev/mapper/DATADISK89p1 /dev/mapper/DATADISK90p1 /dev/mapper/DATADISK91p1 /dev/mapper/DATADISK92p1

lvcreate -i4 -I128 -L402G -n DATA13 SANvg13 /dev/mapper/DATADISK93p1 /dev/mapper/DATADISK94p1 /dev/mapper/DATADISK95p1 /dev/mapper/DATADISK96p1

lvcreate -i4 -I128 -L402G -n DATA14 SANvg14 /dev/mapper/DATADISK97p1 /dev/mapper/DATADISK98p1 /dev/mapper/DATADISK99p1 /dev/mapper/DATADISK100p1

lvcreate -i4 -I128 -L402G -n DATA15 SANvg15 /dev/mapper/DATADISK101p1 /dev/mapper/DATADISK102p1 /dev/mapper/DATADISK103p1 /dev/mapper/DATADISK104p1


mkfs.ext3 /dev/SANvg11/DATA11

mkfs.ext3 /dev/SANvg12/DATA12

mkfs.ext3 /dev/SANvg13/DATA13

mkfs.ext3 /dev/SANvg14/DATA14

mkfs.ext3 /dev/SANvg15/DATA15



mount -a

chown litpmgr1:litpappg /opt/data12 /opt/data13 /opt/data14 /opt/data15 /opt/data11

ls -ld  /opt/data12 /opt/data13 /opt/data14 /opt/data15 /opt/data11

lvs -a -o +devices | grep SANvg

vgdisplay SANvg11 SANvg12 SANvg13 SANvg14 SANvg15

tcpdump info

Tcpdump

# tcpdump –c 30 –I eth0
# tcpdump -w /tmp/tcpdump.pcap -n –tttt -i eth5 dst 1.2.3.4 and port 22

# tcpdump -w comm.pcap -i eth0 src xxx.xxx.xxx.xxx and port 22 and dst xxx.xxx.xxx.xxx and port 22
# tcpdump -i eth0 -n dst port 80
# tcpdump -w comm.pcap -s 1000 -i bond0 udp and \(host 172.20.68.176 and host 172.24.173.9\)
# tcpdump -i any -w /var/tmp/tcpdump00 -s0 not host he3lnxd120-priv and not host he3lnxd121-priv and not host he3lnxd122-priv and not tcp port 22
# tcpdump -r /var/tmp/tcpdump00 -vSxX > /var/tmp/mosdump
# tcpdump –A –I eth0
# tcpdump –tttt –r data.pcap
# tcpdump -nnvXSs 0 -c2 icmp
# tcpdump -D -> Displays available interfaces
# tcpdump portrange 9001-10002
# tcpdump -s0 -i eth0 -w file.pcap not tcp port 22
#tcpdump -r capture.pcap -w http.pcap tcp port 80 (reads a capture file and output it to another file)
# tcpdump -i any -w /var/tmp/`hostname`_tcpdump.pac -s0 host he2lnxp201 and not tcp port 22
# tcpdump -nnvXSs 0 -r he3lnxd120_tcpdump.pcap > /tmphe3lnxd120_tcpdump.txt

-i any : Listen on all interfaces just to see if you're seeing any traffic.
-n : Don't resolve hostnames.
-nn : Don't resolve hostnames or port names.
-X : Show the packet's contents in both hex and ASCII.
-XX : Same as -X, but also shows the ethernet header.
-v, -vv, -vvv : Increase the amount of packet information you get back.
-c : Only get x number of packets and then stop.
-s : Define the snaplength (size) of the capture in bytes. Use -s0 to get everything, unless you are intentionally capturing less.
-S : Print absolute sequence numbers.
-e : Get the ethernet header as well.
-q : Show less protocol information.
-E : Decrypt IPSEC traffic by providing an encryption key.
-v: slightly verbose
-vv: More verbose
-vvv: Total verbosity


Creating loopback devices on Redhat


Creating loopback devices on Redhat

By default, system supports 8 loopback devices. If you have a requirement to mount more than 8 loopback devices such as ISO images, then you have to add extra devices.  You can have a maximum of 64 devices as on now.

You can try to test multiple loopback devices how many you can mount it.

# mount -o iso9696 /opt/file.iso /myiso1

if you want to create more devices, you can do so by using,
# mknod -m 0600 /dev/look9 b 7 9

verify

You can create more,

for ((i=8;i<64;i++)); do
[ -e /dev/loop$i ] || mknod -m 0600 /dev/loop$i b 7 $i
done

Patching Redhat6 server.

Patching Instruction:

Patching Redhat and Solaris servers
1. Create a screen session
# screen
2. Register the host to the correct Satellite chanel
# rhnreg_ks --activationkey=1-123232343434dfsgfgdfgg  --serverUrl https://yourhost.local/abc --force
3. Update your system and reboot.
# yum clean all
# yum update –y
Once the patching is done, exit out of screen
# Init 6 (or reboot)

Sunday, February 15, 2015

rsync files from one system to another

#!/bin/ksh
#************************************************************************
# This script will rsync filesystems under /sasdata & /appdata            *
# from my_S_host over to my_target_host                                *
#************************************************************************
SOURCE_HOST=my_S_host
TARGET_HOST=mytarget_host
SOURCE_FS=/var/tmp/fs_my_S_host.tmp
MAXTHREADS=5
SLEEPTIME=5
grep -v "^#" ${SOURCE_FS}|while read FileSystem
do
        while [ `ps -ef | grep -c [r]sync` -gt ${MAXTHREADS} ]
        do
                echo "Sleeping ${SLEEPTIME} seconds"
                sleep ${SLEEPTIME}
        done
        echo "\nRunning rsync in background to copy ${FileSystem} over to ${TARGET_HOST}:${FileSystem} ...."
        nohup rsync -aAHx ${FileSystem}/ ${TARGET_HOST}:${FileSystem}/ </dev/null >/dev/null 2>&1 &
done
bash-3.2#

-------------------------------------------------------------------------
#!/bin/sh
D_HOST=mytarget_host
C_FILE=/var/tmp/myFS.txt
for i in `cat ${C_FILE}`
do
 echo "Syncing $i to ${D_HOST} . Please wait ...."
 /usr/bin/rsync -logtprz --exclude-from=/var/tmp/my.opt.exclude --progress --rsh='ssh -l root' $i root@${D_HOST}:$i
done

Unable to bring the disk under vxvm control on Solaris 10 x64

Unable to bring the disk under vxvm control on Solaris 10 x64

./vxdisksetup -i c1t0d0
VxVM ./vxdisksetup ERROR V-5-2-3570 Configuration daemon ( vxconfigd ) is not accessible.

1. Removed # rm /etc/vx/reconfig.d/state.d/install-db didn't work.
2. vxconfigd -k -m boot and vxconfigd -k -m enable didn't work
3.  Reboot didin't enable the vxconfigd.
so
again manually booted and enabled and started working..

   18  ps -aef | grep vx
   19  vxconfigd -m enable
   20  vxdisk list
   21  vxdisk scandisks
   22  vxdisk list
   23  cd /etc/vx/bin
   24  ./vxdisksetup -i c1t0d0
   25  ps -aef | grep vx
   26  cd /etc/vx
   27  ls
   28  cd reconfig.d/
   29  ls
   30  cd state.d/
   31  ls
   32  vxconfigd -k -m boot
   33  vxconfigd -k -m enable
   34  vxdctl
   35  vxdctl enable
   36  ls /etc/vx/reconfig.d/state.d/install-db
   37  vxconfigd -k -m boot
   38  vxconfigd -k -m enable
   39  vxdctl enable
   40  vxdctl init unknon
   41  hostname
   42  vxconfigd -k
   43  ps -ef | grep vx
   44  vxdisk list
   45  pwd
   46  cd ../../bin
   47  ls
   48  echo | format
   49  ./vxdisksetup -i c1t0d0
   50  ./vxdisksetup -i c1t1d0
   51  ./vxdisksetup -i c1t2d0
   52  vxdisk list
   53  vxdiskadm
   54  vxdisk list
   55  vxdg list
   56  vxdisk list
   57  vxdg list
   58  vxdiskadm
   59  history
bash-3.2#


============== detail ===========


    root  3454     1   0 22:40:18 ?           0:00 /opt/VRTSdbed/bin/vxdbd
bash-3.2# vxdisk list
DEVICE       TYPE            DISK         GROUP        STATUS
c0t1d0s2     auto:none       -            -            online invalid
c1t0d0s2     auto:none       -            -            online invalid
c1t1d0s2     auto:none       -            -            online invalid
c1t2d0s2     auto:none       -            -            online invalid
bash-3.2# pwd
/etc/vx/reconfig.d/state.d
bash-3.2# cd ../../bin
bash-3.2# ls
egettxt              vxchksundev          vxdmpraw             vxmirror             vxrelocd
strtovoff            vxckdiskrm           vxdmproot            vxmksdpart           vxresize
ugettxt              vxclustadm           vxdxcld              vxmonitor            vxroot
vx_cmd_completion    vxclustipc           vxedvtoc             vxnative             vxrootadm
vxa5kchk             vxcntrllist          vxedvtoc.SunOS_5.10  vxnewdmname          vxslicer
vxattachd            vxconfigbackup       vxeeprom             vxparms              vxspare
vxbadcxcld           vxconfigbackupd      vxencap              vxparms.SunOS_5.10   vxsparecheck
vxbaddxcld           vxconfigrestore      vxevac               vxpartadd            vxsplitlines
vxbootadm            vxconvarrayinfo      vxformat             vxpartinfo           vxswapctl
vxbootsetup          vxcxcld              vxgetdmpnames        vxpartrm             vxtaginfo
vxcached             vxdarestore          vxgetrootdisk        vxpartrmall          vxunreloc
vxcap-part           vxdevlist            vxisasm              vxprtvtoc            vxunroot
vxcap-vol            vxdevpromnm          vxisforeign          vxr5check            vxvvrsecdgd
vxcdsconvert         vxdisksetup          vxldiskcmd           vxr5vrfy             vxvvrsecdgerrhndlr
vxcheckda            vxdiskunsetup        vxlist               vxreattach
bash-3.2# echo | format
Searching for disks...
Inquiry failed for this logical diskdone


AVAILABLE DISK SELECTIONS:
       0. c0d1 <Úxäþ¢Ã¿Ã¾©Ã¿Ã¾Ã¬@©Ã¼Ã¾ cyl 2085 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@7,1/ide@1/cmdk@1,0
       1. c1t0d0 <VMware,-VMware Virtual -1.0 cyl 2044 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@0,0
       2. c1t1d0 <VMware,-VMware Virtual -1.0 cyl 2044 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@1,0
       3. c1t2d0 <VMware,-VMware Virtual -1.0 cyl 2044 alt 2 hd 128 sec 32>
          /pci@0,0/pci15ad,1976@10/sd@2,0
Specify disk (enter its number): Specify disk (enter its number):
bash-3.2# ./vxdisksetup -i c1t0d0
bash-3.2# ./vxdisksetup -i c1t1d0
bash-3.2# ./vxdisksetup -i c1t2d0
bash-3.2# vxdisk list
DEVICE       TYPE            DISK         GROUP        STATUS
c0t1d0s2     auto:none       -            -            online invalid
c1t0d0s2     auto:cdsdisk    -            -            online
c1t1d0s2     auto:cdsdisk    -            -            online
c1t2d0s2     auto:cdsdisk    -            -            online
bash-3.2# vxdiskadm

Volume Manager Support Operations
Menu: VolumeManager/Disk

 1      Add or initialize one or more disks
 2      Encapsulate one or more disks
 3      Remove a disk
 4      Remove a disk for replacement
 5      Replace a failed or removed disk
 6      Mirror volumes on a disk
 7      Move volumes from a disk
 8      Enable access to (import) a disk group
 9      Remove access to (deport) a disk group
 10     Enable (online) a disk device
 11     Disable (offline) a disk device
 12     Mark a disk as a spare for a disk group
 13     Turn off the spare flag on a disk
 14     Unrelocate subdisks back to a disk
 15     Exclude a disk from hot-relocation use
 16     Make a disk available for hot-relocation use
 17     Prevent multipathing/Suppress devices from VxVM's view
 18     Allow multipathing/Unsuppress devices from VxVM's view
 19     List currently suppressed/non-multipathed devices
 20     Change the disk naming scheme
 21     Get the newly connected/zoned disks in VxVM view
 22     Change/Display the default disk layouts
 23     Dynamic Reconfiguration Operations
 list   List disk information


 ?      Display help about menu
 ??     Display help about the menuing system
 q      Exit from menus

Select an operation to perform: 1

Add or initialize disks
Menu: VolumeManager/Disk/AddDisks
  Use this operation to add one or more disks to a disk group.  You can
  add the selected disks to an existing disk group or to a new disk group
  that will be created as a part of the operation. The selected disks may
  also be added to a disk group as spares. Or they may be added as
  nohotuses to be excluded from hot-relocation use. The selected
  disks may also be initialized without adding them to a disk group
  leaving the disks available for use as replacement disks.

  More than one disk or pattern may be entered at the prompt.  Here are
  some disk selection examples:

  all:          all disks
  c3 c4t2:      all disks on both controller 3 and controller 4, target 2
  c3t4d2:       a single disk (in the c#t#d# naming scheme)
  xyz_0 :       a single disk (in the enclosure based naming scheme)
  xyz_ :        all disks on the enclosure whose name is xyz

Select disk devices to add: [<pattern-list>,all,list,q,?] list

DEVICE       DISK         GROUP        STATUS
c0t1d0       -            -            online invalid
c1t0d0       -            -            online
c1t1d0       -            -            online
c1t2d0       -            -            online

Select disk devices to add: [<pattern-list>,all,list,q,?] c1t0d0
  Here is the disk selected.  Output format: [Device_Name]

  c1t0d0

Continue operation? [y,n,q,?]  (default: y)
  You can choose to add this disk to an existing disk group, a
  new disk group, or leave the disk available for use by future
  add or replacement operations.  To create a new disk group,
  select a disk group name that does not yet exist.  To leave
  the disk available for future use, specify a disk group name
  of "none".

Which disk group [<group>,none,list,q,?]  (default: none) list

NAME         STATE           ID

Which disk group [<group>,none,list,q,?]  (default: none) datadg

Create a new group named datadg? [y,n,q,?]  (default: y)

Create the disk group as a CDS disk group? [y,n,q,?]  (default: y)

Use a default disk name for the disk? [y,n,q,?]  (default: y)

Add disk as a spare disk for datadg? [y,n,q,?]  (default: n)

Exclude disk from hot-relocation use? [y,n,q,?]  (default: n)

Add site tag to disk? [y,n,q,?]  (default: n)
  A new disk group will be created named datadg and the selected disks
  will be added to the disk group with default disk names.

  c1t0d0

Continue with operation? [y,n,q,?]  (default: y)
  The following disk device appears to have been initialized already.
  The disk is currently available as a replacement disk.
  Output format: [Device_Name]

  c1t0d0

Use this device? [y,n,q,?]  (default: y)
  The following disk you selected for use appears to already have
  been initialized for the Volume Manager.
  Please use vxdisk -f init if you want to reinitialize this disk.

  VxVM  NOTICE V-5-2-120
Creating a new disk group named datadg containing the disk
  device c1t0d0 with the name datadg01.

Add or initialize other disks? [y,n,q,?]  (default: n)

Volume Manager Support Operations
Menu: VolumeManager/Disk

 1      Add or initialize one or more disks
 2      Encapsulate one or more disks
 3      Remove a disk
 4      Remove a disk for replacement
 5      Replace a failed or removed disk
 6      Mirror volumes on a disk
 7      Move volumes from a disk
 8      Enable access to (import) a disk group
 9      Remove access to (deport) a disk group
 10     Enable (online) a disk device
 11     Disable (offline) a disk device
 12     Mark a disk as a spare for a disk group
 13     Turn off the spare flag on a disk
 14     Unrelocate subdisks back to a disk
 15     Exclude a disk from hot-relocation use
 16     Make a disk available for hot-relocation use
 17     Prevent multipathing/Suppress devices from VxVM's view
 18     Allow multipathing/Unsuppress devices from VxVM's view
 19     List currently suppressed/non-multipathed devices
 20     Change the disk naming scheme
 21     Get the newly connected/zoned disks in VxVM view
 22     Change/Display the default disk layouts
 23     Dynamic Reconfiguration Operations
 list   List disk information


 ?      Display help about menu
 ??     Display help about the menuing system
 q      Exit from menus

Select an operation to perform: q

Goodbye.
bash-3.2# vxdisk list
DEVICE       TYPE            DISK         GROUP        STATUS
c0t1d0s2     auto:none       -            -            online invalid
c1t0d0s2     auto:cdsdisk    datadg01     datadg       online
c1t1d0s2     auto:cdsdisk    -            -            online
c1t2d0s2     auto:cdsdisk    -            -            online
bash-3.2# vxdg list
NAME         STATE           ID
datadg       enabled,cds          1424059065.23.unknon
bash-3.2#

How to enable su - to root on freebsd

How to enable su - on freebad.

If you get error like below, you have to perform the following task below.

su: Sorry for normal user account

By default su - to root is disabled. Only users on wheel group are allow to su to root.

You can change this behivour by
a. adding use to the wheel group and
b. changing the pam_group config at /etc/pam.d/su

A. Add user to the wheel group.
# pw user mod <username> -G wheel
# pw user mod jay -G wheel
# groups jay
jay wheel

B. modify /etc/pam.d/su file to enable for all users by commenting out the line below.
# vi /etc/pam.d/su

# auth requisite pam_group.so no_warn group=wheel root_only fail_safe ruser
wq !

Now, open a new ssh session and try again. you should be able to login to root with su - 

Tuesday, February 10, 2015

Compress a big file


1. Check the filesystem on the system which is over 85% used.
# df -hP  /www/domain/TheDesk/logs/
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/datavg-WWW_DOMAIN 30G   24G  4.1G  86% /www/domain
2. Go to the directory location to find a large file.
# cd /www/domain/TheDesk/logs
# du -sh *
# ls -lh app_mod_jk.log.log
-rw-r--r-- 1 root root 21G Feb 10 11:15 app_mod_jk.log.log
3. Since you don't have space on the system, and you simply can't delete the file.
Find another filesystem where you can store the log temporarily.
# df -hP
/dev/mapper/datavg-WWW_APPROOT 30G  1.3G   27G   5% /www/approot
4. Compress your log to different filesystem.
# gzip -c app_mod_jk.log.log > /www/approot/app_mod_jk.log.log.2102015.gz
# ls -lh app_mod_jk.log.log
-rw-r--r-- 1 root root 21G Feb 10 11:27 app_mod_jk.log.log
5. Zero you log.
Note, if size does not change, you may have to hup the process id.
# cat /dev/null >app_mod_jk.log.log
6. Move your compress log back to the original position.
# mv /www/approot/app_mod_jk.log.log.2102015.gz /www/domain/TheDesk/logs/
#

Sunday, February 8, 2015

RH7- Installing JBOSS EAP on REHL 7

Installing JBOSS 6.3 EAP on REHL7

Download the package: www.jboss.org,

http://www.jboss.org/download-manager/file/jboss-eap-6.3.0.GA.zip


1. Create following user and directory

# useradd jboss; passwd jboss
# mkdir /servers
# chown -R jboss:jboss /servers

2. Download and install (extract) java from oracle.
http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-6u3-jdk-6u29-downloads-523388.html

# mkdir /usr/java

3. Copy or extract your JBOSS on installation directory.
# mkdir /server/jboss-eap6; cd /server/jboss-eap6
# unzip jboss-eap-6.3.0.GA.zip

4. Set up user (jboss) profile.
# su - jboss
$ vi .bash_profile
SHIFT + G and type

JAVA_HOME=/usr/java/jdk1.6....
Jbin=/server/jboss-eap6/bin
export JAVA_HOME Jbin

wq!

5 Installing the JBOSS service
Go to EAP_HOME/bin/init.d directory and modify jboss-as.conf file as following

# General configuration for the init.d scripts,

JBOSS_USER=jboss
JBOSS_HOME=/servers/jboss-eap6/

STARTUP_WAIT=30

SHUTDOWN_WAIT=30

JBOSS_CONSOLE_LOG=/var/log/jboss-as/console.log


6. Now, create a dir /etc/jboss-as and copy the config file above you just modified.
# mkdir /etc/jboss-as/
# cp jboss-as.conf /etc/jboss-as/
# cp jboss-as-standalone.sh /etc/init.d

7. Start the jboss service
# service jboss-as-standalone start
# ps -aef | grep jboss
# netstat -an | more

7. Now, go to the browser and check it.
http://localhost:8080

You should be able to see the welcome screen.

8. Now, go to /servers/jboss-eap6/bin and run add-user.sh script. It will prompt you to add user. Go to Administration Console and enter the username and pw.

You can now, simply play around with different menus..

Tuesday, February 3, 2015

Create asm disk

# fdisk /dev/sdb
n
p
1
enter
t
8e
w
# fdisk -l  /dev/sdb
/dev/sdb1
# /etc/init.d/oracleasm
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
# /etc/init.d/oracleasm listdisks
ASMDISK1
ASMDISK2
# /etc/init.d/oracleasm createdisk ASMDISK3 /dev/sdb1
Marking disk "ASMDISK3" as an ASM disk:                    [  OK  ]
# /etc/init.d/oracleasm listdisks
ASMDISK1
ASMDISK2
ASMDISK3
#
# /etc/init.d/oracleasm scandisks
# /etc/init.d/oracleasm listdisks

# /etc/init.d/oracleasm createdisk ASMDISK150 /dev/mapper/ASMDISK150
# /etc/init.d/oracleasm listdisks
# dd if=/dev/mapper/ASMDISK50R10 bs=1024 count=1 | od –c

Find ASM disk size
# lvs
# fdisk -l
# multipath -ll | more
# multipath -ll | grep -A 1 ASMDISK
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//'
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//' | grep ASM
# multipath -ll | grep -A 1 ASMDISK | awk '{l1=$0;getline;print l1 " " $0}' | awk '{print $1 " " $5}' | sed -e 's/\[features=1//' | grep ASM
ASMDISK18 [size=101G]
ASMDISK20 [size=101G]
ASMDISK17 [size=101G]
ASMDISK16 [size=101G]
ASMDISK14 [size=101G]
ASMDISK12 [size=101G]
ASMDISK11 [size=101G]
ASMDISK10 [size=101G]
ASMDISK06 [size=101G]
ASMDISK05 [size=101G]
ASMDISK19 [size=101G]
ASMDISK21 [size=101G]
#
===============
Oracle ASM log
===============
To send log to oracle to further analyse the issue
As an admin/root, perform the following. :
ssh oracledbserver 
# script /tmp/asm_details.txt
# hostname
-- oracledbserver:/opt/oracle/diag/asm/+asm/+ASM2/trace>fgrep + /etc/oratab
+ASM2:/opt/grid:N
# . oraenv
-- Type ASM2 depending on the following output
# lsmod|grep oracleasm
# modinfo oracleasm
# /etc/init.d/oracleasm listdisks
# /etc/init.d/oracleasm status
# /sbin/blkid | grep oracleasm
# /etc/init.d/oracleasm listdisks | xargs /etc/init.d/oracleasm querydisk -d
# /usr/sbin/oracleasm-discover
# exit


Discovered disk: ORCL:ASMSYS02 [4224000 blocks (2162688000 bytes), maxio 256]
Discovered disk: ORCL:ASMSYS03 [4224000 blocks (2162688000 bytes), maxio 256]
# cd /opt/oracle/diag/asm/+asm/+ASM2/trace
# . oraenv
ORACLE_SID = [root] ?
# ps -ef | grep -i pmon
oracle    1726     1  0 10:01 ?        00:00:00 asm_pmon_+ASM2
root      3437 28388  0 12:06 pts/11   00:00:00 grep -i pmon
oracle   12197     1  0 10:16 ?        00:00:02 ora_pmon_ECVPDB2
oracle   15498     1  0 10:18 ?        00:00:02 ora_pmon_ARRPDB2
oracle   16272     1  0 10:19 ?        00:00:01 ora_pmon_ADVOESP2
# . oraenv
ORACLE_SID = [root] ? +ASM2

 

Sunday, February 1, 2015

Configure autohome using autofs

On server side

1. Export nfs share for the client
# cat /etc/exports
/opt/share                        *(rw,sync)
/opt/archive kuldeep(rw,sync)
/opt/archive ramsing(rw,sync)
[root@mohan share]# service nfs restart
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Shutting down RPC idmapd:                                  [  OK  ]
Starting NFS services:  exportfs: Failed to resolve kuldeep
exportfs: Failed to resolve kuldeep
                                                           [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting RPC idmapd:        

On client side

1. Install autofs package
# yum search autofs
# yum install autofs

2. Add entry to auto.master
# cat /etc/auto.master
/export/home    /etc/auto.users

3. Add/specify nfs share info
# cat /etc/auto.users
ram -rw 192.168.5.33:/opt/share/ram
# * -rw 192.168.5.33:/opt/share/&

4. Restart the autofs service
# service autofs restart

5. Verify if autofs is working
# cd /export/home/ram

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              18G  7.1G  9.5G  43% /
tmpfs                 495M  228K  495M   1% /dev/shm
/dev/sda1             283M   28M  240M  11% /boot
/dev/sr1              182M  182M     0 100% /media/CentOS
/dev/sr0              4.4G  4.4G     0 100% /media/CentOS_6.6_Final
192.168.5.33:/opt/share/ram
                       18G   13G  3.7G  79% /export/home/ram    ==>> this output confirms that autofs is working


Useradd to a secondary group and schedule a job

add a new user with id of 520 to the oracle group. Schedule a job to run at 11:20 PM every day which sends an out current filesystem.

crontab -e
20 23 * * * /bin/df -h | mailx -s "Filesystem info" jay



[root@mohan Desktop]# useradd jay
uid=510(jay) gid=511(jay) groups=511(jay)
[root@mohan Desktop]# usermod -aG oracle jay
[root@mohan Desktop]# id jay
uid=510(jay) gid=511(jay) groups=511(jay),510(oracle)
[root@mohan Desktop]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              18G   13G  3.7G  78% /
tmpfs                 495M  224K  495M   1% /dev/shm
/dev/sda1             283M   54M  215M  20% /boot
/dev/mapper/outLuks   475M  2.3M  448M   1% /opt/outLuks
/dev/mapper/datavg-mylv
                      362M  2.1M  341M   1% /opt/datalv
/dev/sr1              4.4G  4.4G     0 100% /media/CentOS_6.6_Final
/dev/sr0              182M  182M     0 100% /media/CentOS
[root@mohan Desktop]# df -h | mailx -s "Filesystem info" jay
[root@mohan Desktop]# su - jay
[jay@mohan ~]$ mail
Heirloom Mail version 12.4 7/29/08.  Type ? for help.
"/var/spool/mail/jay": 1 message 1 new
>N  1 root                  Sun Feb  1 05:51  26/1056  "Filesysteminfo"
& 1
Message  1:
From root@mohan.expanor.local  Sun Feb  1 05:51:43 2015
Return-Path: <root@mohan.expanor.local>
X-Original-To: jay
Delivered-To: jay@mohan.expanor.local
Date: Sun, 01 Feb 2015 05:51:37 -0800
To: jay@mohan.expanor.local
Subject: Filesysteminfo
User-Agent: Heirloom mailx 12.4 7/29/08
Content-Type: text/plain; charset=us-ascii
From: root@mohan.expanor.local (root)
Status: R

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              18G   13G  3.7G  78% /
tmpfs                 495M  224K  495M   1% /dev/shm
/dev/sda1             283M   54M  215M  20% /boot
/dev/mapper/outLuks   475M  2.3M  448M   1% /opt/outLuks
/dev/mapper/datavg-mylv
                      362M  2.1M  341M   1% /opt/datalv
/dev/sr1              4.4G  4.4G     0 100% /media/CentOS_6.6_Final
/dev/sr0              182M  182M     0 100% /media/CentOS

& q