Tuesday, February 24, 2009

Linux SA Notes

ADD STATIC ROUTE IN LINUX
# Add static route to netbackup subnet
route add -net 172.24.16.0 netmask 255.255.252.0 gw 172.24.69.1

CHECK INTERFACE STATUS
# mii-tool
eth0: 100 Mbit, full duplex, link ok
eth1: no autonegotiation, 100baseTx-HD, link ok
eth2: 100 Mbit, full duplex, link ok
eth3: no link
eth4: 100 Mbit, full duplex, no link
eth5: no link

# ethtool


CHECK STATUS OF INTERFACE ON BOND
# cat /proc/net/bonding/bond0
# cat /etc/modprobe.conf


NTP

- stop ntpd
# service ntpd stop
# ntpdate -d hostname
# vi /etc/ntp/step-tickers (to include all the ntp servers) cross check with tokrs00001
# service ntpd start
# ntpq –pn

NIS

NIS client setup
# vi /etc/sysconfig/network
NISDOMAIN= sea.rbsfm.com
# vi /etc/yp.conf
domain sea.rbsfm.com server hkg8082xus
domain sea.rbsfm.com server hkg1121xus
domain sea.rbsfm.com server hkg0024ous
domain sea.rbsfm.com server hkg0025ous
# vi /etc/hosts
#NIS servers
175.3.208.23 hkg0023ous
175.3.220.82 hkg8082xus
- check /etc/nsswitch.conf
Passwd: files nis
Shadow: files nis
Group: files nis
- make sure portmap is running
# service portmap start
# chkconfig portmap on
- start ypbind
# service ypbind start
# chkconfig ypbind on
- test it
# ypcat passwd



MOUNT CDROM

# mount -t iso9660 -o ro /dev/cdrom /mnt (or any mount point)
To check whether the driver is loaded properly, type:
# lsmod

MOUNT USB
# fdisk -l
# mount /dev/sdbl1 /mnt

EMCGRAB for Linux
# mount lon0583xus:/apps/packages/ /apps
# cd /apps/EMC/EMC_Grabs/Linux
# mkdir -p /tmp/emc
# cp emcgrab_Linux_v3.9_1.tar /tmp/emc
# cd /tmp/emc
# tar xvf emcgrab_Linux_v3.9_1.tar
# cd emcgrab
# ./emcgrab.sh

CHANGE FILE ATTRIBUTE
# chattr +i /etc/hosts.allow
# chattr -i /etc/hosts.allow (to allow to save)


GET CPU INFO
# egrep "processor|MHz|model name" /proc/cpuinfo

GET SHARED MEMORY AND SEMEPHORES
# sysctl -a | grep shm >> for shared memory

# sysctl -a | grep -i sem >> for semephore

CHECK INCOMING NETWORK PACKETS
# lsof -i | grep 9495
# netstat -an | grep 9495

CHECK ADAPTER
# lspci|grep -i ql

CHECK RUNNING PROCESS NOT OWNED BY ROOT
# ps -ef | grep -iv root

HD CANNOT BE DETECTED
- reboot machine
- press F8 to go to Smart Array configuration menu
- create a new raid
- exit to reboot
- fdisk -l (list current partitions)
- create a new partition
# fdisk /dev/cciss/c0d2 (format to create new partition)
- create filesystem on the new partition
# mke2fs -j /dev/cciss/c0d2
- mount the partition
# mount -t ext3 /dev/cciss/c0d2 /export1

CHECK LIST OF GDS PRINTERS
# ypcat -k printers.conf.byname|grep sin


ADD A NEW GDS PRINTER
-check if a similar printer exist
# ypcat -k printers.conf.byname|grep sin

-check if there are running printer jobs
# lpstat -o (sin2111xxp)

-if there is a running job, cancel it
# cancel sin2111xxp-206

-go to /opt/hpnpl
# cd /opt/hpnpl
# ./hppi
- select 1 for Spooler Administration
- select 1 to add printer

RSYNC
#rsync -av -e ssh lon0261xus:/var/satellite/esxbuild /export1/satellite/ --progress –stats

CHECK BIOS
# hpasmcli -s "show server"

CHECK FANS and REDUNDANT PSUs
# hplog -f
# hplog –p

CHECK HP SIM
# hplog -v

REDUCE LINUX CACHED MEMORY

# grep ^Cached: /proc/meminfo

# dd if=/dev/zero bs=1024k count= of=dummy.tmp

# grep ^Cached: /proc/meminfo


ERROR/s Encountered


ERROR: Unable to communicate with the RILOE II/iLO.

RESOLUTION:
To restore communication with the HP Lights-Out Online Configuration Utility for Linux, perform the following:

Stop the HP SNMP Agents (hp-snmp-agents) by typing the following command:
# /etc/init.d/hp-snmp-agents stop

Restart HP ProLiant Channel Interface Device Driver for iLO / iLO 2 (hp-ilo) by typing the following command:
# /etc/init.d/hp-ilo restart

Start the HP SNMP Agents (hp-snmp-agents) by typing the following command:
#/etc/init.d/hp-snmp-agents start

ERROR: User does not exist (NIS related error)

RESOLUTION:
Put (+) in from of userid in /etc/passwd and /etc/shadow files
e.g. on /etc/passwd
+@all-all-users-tc-default-users
+bradmark
+@all-all-users-tc-oracle-dba

Solaris SA Notes

ADD STATIC ROUTE IN UNIX SOLARIS
#route add net 28.133.0.0/18 172.24.105.1
-add the route accross reboot-
#vi /etc/rc2.d/S69static_routes

ODS

# metastat|grep -i maint
# metastat -p (to check the controller where metadevices are originally mounted)
# format (to check the current controller)
# metastat |grep -i replace (to check the metadevices to be replaced)
(and then do the replacement)
# metareplace d0 c2t0d0s0 c1t0d0s0 (note that c1 is the new controller)
# metadb -a -c3 /dev/dsk/c1t0d0s3 (create meta database for the new controller c1)
# metastat | grep resync
# while true
>do
>metastat | grep resync
>sleep 1
>done


RSH

Enable rsh in Solaris 10
# svcadm enable svc:/network/login:rlogin
# svcadm enable svc:/network/login:rlogin

Enable rsh in solaris 8
# vi /etc/inetd.conf
- uncomment
shell stream tcp nowait root /usr/sbin/in.rshd in.rshd
- restart inetd daemon
# pkill -HUP inetd

AUTOFS

- check the files /etc/auto_master and /etc/auto.dumps file
- once changes made, u need to do 'automount -v' to pickup the config files
- on the client share the filesystem
# share -F nfs -o ro /dumps
- edit /etc/dfs/dfstab
# share -F nfs -o ro /dumps
- restart nfs
# svcadm restart nfs/server
# dfshares or exportfs (to verify nfs shares)

NFS

- mount the dir
# mount -F nfs hkgfiler2:/remedy /opt/ar/directa

- edit /etc/vfstab to mount it upon boot up
hkgfiler2:/remedy - /opt/ar/directa nfs yes rw,soft



NTP

# svcadm disable ntp
# cp /etc/inet/ntp.client /etc/inet/ntp.conf (and type-in ntp servers)
e.g.

server hkgba00001
server hkgba00002

#ntpdate -d
#svcadm enable svc:/network/ntp

DU

Check for Top directory users
# du -sk /export/home/* | sort –nr

TAR

Un-tar tar.gz file IN SOLARIS
gunzip -c file_name.tar.gz |tar xvf –
or

# gzip -d snap_sol10.tar.gz
# tar xf snap_sol10.tar


Create tar file
tar cvf dir.tar

Create create .gz
#gzip dir.tar


HBA

Check HBA info:
# fcinfo hba-port

NIC

Check network interface
# cat /etc/path_to_inst
# grep bge path_to_inst
"/pci@1f,700000/network@2" 0 "bge"
"/pci@1f,700000/network@2,1" 1 "bge"
"/pci@1d,700000/network@2" 2 "bge"
"/pci@1d,700000/network@2,1" 3 "bge"

Change network interface to auto neg “on”
# vi /platform/sun4u/kernel/drv/bge.conf

Check for network collision
# netstat –i

EEPROM

Disable system check during reboot
# eeprom diag-switch? False


PKGADD

To add a package
# pkgadd –d .

REXEC

Disable rexec in Solaris 8
# vi /etc/inetd.conf
- comment out
exec stream tcp nowait root /usr/sbin/tcpd in.rexecd
exec stream tcp6 nowait root /usr/sbin/tcpd in.rexecd

- then restart inetd daemon
# pkill -HUP inetd

SWAP

- create local swap area - in kilobytes(k), blocks(b) or megabytes (m)
# mkfile 1024m /new_swap (create 1GB swap)
- activate the swap area
# swap –a /new_swap
- verify
# swap –l

LOCALE

- set system-wide locale
# vi /etc/TIMEZONE

- set user locale
# vi .profile

LVM (Logical Volume Management)

- install lvm software
- partition disks
# fdisk partition (e.g. /dev/sdb1)

- create physical volumes
# pvcreate /dev/sdb1
# pvcreate /dev/sdc1
# pvcreate /dev/sdd1
# pvscan

- create volume group and make it available
# vgcreate /dev/sdb1 /dev/sdc1 /dev/sdd1
# vgchange –a y
# vgdisplay
# lvcreate –-size 3493G –-name
# lvdisplay
# mount /dev/

- rename a logical volume group
# vgdisplay –v
# vgchange –a n /dev/
# vgrename /dev/ /dev/
# vgchange –a y /dev/
# vgdisplay –v
# vgdisplay –v ext

- rename a logical volume
# lvdisplay /dev/ext/
# lvrename /dev/ext/ /dev/ext/
# lvdisplay /dev/ext/

- make a filesystem on the disk
# mkfs.xfs –f /dev/fhome/fanhome
# mount /dev/fhome/fanhome /home
# mount –t xfs /dev/ext/nfsdata /mnt

- add a new drive to a volume group
# vgdisplay –v (check active disks)
# fdisk to create partition
# umount /bak/backups (filesystem to extend)
# pvcreate /dev/sdf1 (prepare new partition)
# vgextend bak /dev/sdf1
# lvresize –-size 5.999T /dev/shome/home (increase size)
# mount /dev/bak/backups /bak/backups
# xfs_growfs /bak/backups


ERROR/s Encountered

Error: SOLARIS box running slow

Resolution:
# mpstat 5 5 (check usr,sys usage)
# prstat -s cpu -n 5 (list by cpu usage and top 5 processes)
# prstat -s cpu -a -n 5 (list usage per user)


Error: Veritas config daemon vxconfigd not running

Resolution:
# modinfo|grep vx
If DMP is enabled the /etc/system will have the force load entries and the driver "vxdmp"
# grep vxdmp /etc/system
forceload: drv/vxdmp

# vxdctl mode
mode: enabled

Next, run vxinstall or do a vxconfigd -k -m enable

Error: Timed out while waiting for NIS to come up

Resolution:

- logon to console
- do a “send brk” to get to “ok prompt”
- boot to single user mode
Ok> boot –s
- temporarily disable RPC service or remove /etc/defaultdomain to prevent NIS from starting at system boot
# mv /etc/rc2.d/S71rpc /etc/rc2.d/NOS71rpc or
# rm /etc/defaultdomain
# or exit to continue booting to default runlevel




Error: “Umount: I/O error” or “umount: cannot unmount /mount_point”

Resolution:

# fuser –c /file_system
# kill -9 process_id (from the above fuser command)
# lsof +D /file_system
# umount –f /file_system
# mount | grep /file_sytem

Error: No directory – logged on with (/) directory

Resolution:

- restart autofs
# /etc/init.d/autofs stop; /etc/init.d/autofs start
- re-login


Error: Media Error (hard disk with bad sectors)

Resolution:

# format
- select the disk to read test
> anal (select analyze)
> read