Tuesday, October 21, 2014

Some file system info

# more gather_vfstab_zone_xml.sh
#!/bin/ksh
cd /etc
grep FS /etc/vfstab | awk '{ print $3","$1","$2 }' | egrep -v mount > /var/tmp/servername_FS_list
#
Create zfs fs
# zfs create -o mountpoint=/opt/app -o quota=100g MyPool01/FS_OPT_APP

To remove disk from vxvm,
# vxdg -g datadg rmdisk emcdsk03 emcdsk04

To find the particular port on Solaris server  -- copied, forgot the source, big credit to the owner...

#! /bin/sh

if [ $# -ne 1 ]; then
  echo "Usage: $0 "
  exit 1
fi
listen=$1

# PATH=$PATH:/usr/bin:/bin
# export PATH

#
# skip process 0
#
cd /proc
for i in [1-9][0-9]*
do
  pfiles $i | nawk -v listen=$listen '
    BEGIN {
      found=0
    }
    NR==1 {
      process=$0
    }
    /sockname/ && $NF == listen {
      getline
      if ( ! /peername/ ) {
        found=1
        exit
      }
    }
    END {
      if ( found == 1 ) {
        printf("%s\n",process)
      }
    }'
done

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

# cat port_proc.sh
#!/bin/bash
 # is the port we are looking for

if [ $# -lt 1 ]
 then
 echo "Please provide a port number parameter for this script"
 echo "e.g. %content 2051"
 exit
 fi

echo "Greping for your port, please be patient (CTRL+C breaks) . "

for i in `ls /proc`
 do
 pfiles $i | grep AF_INET | grep $1
 if [ $? -eq 0 ]
 then
 echo Is owned by pid $i
 echo "-----------------"
 fi
 done

# sh port_proc.sh 2051
Greping for your port, please be patient (CTRL+C breaks) .
pfiles: cannot examine 1291: no such process

Is owned by pid 6692


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

SAN HBA wwn info

#!/bin/ksh
for i in `ls -ld /sys/class/scsi_host/host* | awk '{print $9}' | cut -d"/" -f5`
do
echo "----------------------------------------"
echo "SAN (HBA) Card $i information"; echo "----------------------------------------"
systool -c fc_host $i -v | egrep "node_name|port_name|port_state|speed "; echo ""
done

#

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

#!/bin/ksh
echo | format >/tmp/format.disks
cd /tmp
for i in `grep c1t2 /tmp/format.disks | awk '{print $2}' | sed '/^$/d'`
# for i in `grep emcp /tmp/format.emc | awk '{print $2}' | sed '/^$/d'`
do
    SIZE=`echo ver | format $i | grep '2    backup'    | awk '{print $7'}`
echo "$i =$SIZE"
done


No comments:

Post a Comment