Kamis, 07 November 2013

Solaris System Administrator 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 

Go to ok prompt from ILOM of Sun T5120

Follow below procedure to get to "ok" prompt from ILOM.

1. ssh to ILOM hostname


2. From the ILOM prompt , type the below.

--> set /HOST send_break_action=break

--> start /SP/console to get to the ok prompt.


Manual system reset from the ILOM prompt.

--> set /HOST/bootmode script="setenv auto-boot? false"

--> reset /SYS