31 Mayıs 2012 Perşembe

Unix komutları -5


Crash Dump

Solaris
Red Hat
Ubuntu/Debian
HP
AIX
Crash Dump
dumpadm -d <device>
crash (used to analyse crash dumps)
adb (used to analyse crash dumps)
diskdump
netdump
kdump (part of kexec rpm)
/etc/kdump.conf (select where you want the dump to go) 
service kdump start
chkconfig kdump on

## to crash the system
echo "c" > /proc/sysrq-trigger
crash (used to analyse crash dumps)
diskdump
netdump
kdump (part of kexec rpm)
/etc/kdump.conf (select where you want the dump to go) 
service kdump start
chkconfig kdump on

## to crash the system
echo "c" > /proc/sysrq-trigger
crash (used to analyse crash dumps)
edit /stand/system
add either:
dump
 2/0/1.5.0
dump lvol
dump none
# crash config file
/etc/rc.config.d/savecrash

sysdumpdev -l (list dump destination)
sysdumpdev -e (estimates dumpsize)
sysdumpdev -L (info)
sysdumpstart -p (start dump primary)
sysdumpstart -s (start dump secondary)

# set the dump device permanently
 
sysdumpdev -p <dump device> -P
 

# analyse dump file
echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0
Performance Monitoring and Diagnostics

Solaris
Red Hat
Ubuntu/Debian
HP
AIX
CPU
top (sunfreeware)
prstat
 
sar
mpstat
w          (load average)
uptime   (load average)
 
ps
vmstat
top
sar
mpstat
w          (load average)
uptime   (load average)
 
ps
vmstat
procinfo
oprofile
cat /proc/cpuinfo
top
sar
mpstat
w          (load average)
uptime   (load average)
 
ps
vmstat
procinfo
cat /proc/cpuinfo
top
sar
w          (load average)
uptime   (load average)
 
ps
vmstat
glance
sam
topas -P
topas -L  (logical partitions)
 
mpstat
sar -c
 
w          (load average)
uptime   (load average)
 
lparstat
ps
iostat -tT 1
tprof
curt
 
Memory
prstat
vmstat
top
sar
free
vmstat
top
procinfo
slabtop
sar
cat /proc/meminfo
 
free
vmstat
top
procinfo
slabtop
sar
cat /proc/meminfo
top
vmstat
sar
sam
glance
topas
vmstat
sar -b
svmon
ps
ipcs -a
lockstat (version 4)
 
rmss
 
Network I/O
ndd
netstat
lsof
snoop
route
ethtool
mii-tool
netstat
lsof
tcpdump
 
ip
iptraf
ethtool
mii-tool
netstat
lsof
tcpdump
 
ip
iptraf
netstat
lanadmin
sam
glance
 
[ent|tok|fddi|atm]stat
netstat
netpmon (trcstop to stop trace)
Disk I/O
sar -d
iostat
vmstat
lsof
sar -d
iostat
vmstat
lsof
sar -d
iostat
vmstat
lsof
iostat
sar
sam
 
glance
topas -D   (disk)
topas -F   (filesystem)
 
iostat
sar -D
 
fcstat (fibre)
lvmstat
filemon (trcstop to stop)
 
fileplace

# disk stat history
 
chdev -l sys0 -a iostat=true
lsattr -HEl sys0 -a iostat
Application
truss -p <pid>
strace -p <pid>
strace -p <pid>
download and install tusc
tusc -p <pid>
topas
truss
sar
 
probevue
tprof
svmon -P <pid>
NFS
nfsstat
nfsstat
nfsstat
nfsstat
nfsstat
Kernel Modules and Parameters

Solaris
Red Hat
Ubuntu/Debian
HP
AIX
display loaded modules
modinfo
cat /proc/modules (more detailed) 
lsmod
Location: 
/lib/modules/`uname -r`/kernel/drivers

Config:
/etc/modprobe.conf
/etc/modprobe.d
cat /proc/modules (more detailed) 
lsmod
Location: 
/lib/modules/`uname -r`/kernel/drivers

Config:
/etc/modprobe.d/options
/etc/modprobe.d
kmadmin -k 
genkex
load modules
modload -p drv/<module name> 
modprobe <module>
insmod
modprobe <module>
insmod
kmadmin -L <module name>
n/a
unload modules
modunload -i <module number>
modprobe -r <module>
rmmod
modprobe -r <module>
rmmod
kmadmin -U <module name> 
kmadmin -u <module id>
n/a
set kernel parameters (tuning)
/etc/system (edit and reboot)
/etc/sysctl.conf (edit and update then reboot)
sysctl -p <filename>
sysctl -w param=value 

No reboot (dynamically):
echo "250 32000 100 28" > /proc/sys/kernel/sem
echo "536870912" > /proc/sys/kernel/shmmax
echo "4096" > /proc/sys/kernel/shmmni
echo "2097152" > /proc/sys/kernel/shmall
etc.............................................
/etc/sysctl.conf (edit and update then reboot)
sysctl -p <filename>
sysctl -w param=value 

No reboot (dynamically):
echo "250 32000 100 28" > /proc/sys/kernel/sem
echo "536870912" > /proc/sys/kernel/shmmax
echo "4096" > /proc/sys/kernel/shmmni
echo "2097152" > /proc/sys/kernel/shmall
etc.............................................
kcweb (11i) 
kctune (11i only)
rebuild kernel (< 11i see below)
chdev -l sys0 -a <parameter>=<value>
no -a          (network)
vmo -a        (virtual memory)
 
nfso -a        (NFS)
ioo -a         (Input/Ouput)
raso -a        (reliability, availability, serviceability)
 
schedo -a   (processor scheduler)
 

vi /etc/security/limits
cd /etc/tunables
tunchange, tundefault, tunsave, tunrestore, tuncheck 

Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted
display kernel parameters
cat /etc/system
sysdef -i
sysctl -a
cat /etc/sysctl.conf

cat /proc/sys/kernel/sem
cat /proc/sys/kernel/shmmax
etc...................................
sysctl -a
cat /etc/sysctl.conf

cat /proc/sys/kernel/sem
cat /proc/sys/kernel/shmmax
etc...................................
kctune (11i only)
sysdef
kmtune
kmsystem
/usr/sam/lbin/getkinfo -f /stand/vmunix -o /tmp/kernel.data
lsattr -EHl sys0 

Note: only a few kernel parameters can be changed
build kernel
edit and update file then reboot:
/etc/system
cd /usr/src/linux-2.5
edit Makefile (change EXTRAVERSION)
make mrproper
backup .config
make xconfig
make dep
make bzImage
make modules
move new kernel
make modules_install
change lilo/grub config file
reboot

cd /stand/build
/usr/lbin/sysadm/system_prep -v -s system
edit system file
/usr/sbin/mk_kernel -s ./system
mv /stand/system /stand/system.old
mv /stand/vmunix /stand/vmunix.old
mv /stand/build/system /stand
mv /stand/build/vmunix_test /stand/vmunix
reboot
chdev -l sys0 -a <parameter>=<value>

Note: most parameters are dynamically changed in AIX , for example memory segments are dynamically adjusted
interprocess communication
ipcs -a
ipcs -a
ipcs -a
ipcs -a
ipcs -a
Services

Solaris 10
Red Hat
Ubuntu/Debian
HP
AIX
display services
svcs -a
inetadm -l
service --status-all
There is no services or chkconfig command use the old fashioned way /etc/init.d/<service>
There is no services or chkconfig command 
use the old fashioned way /sbin/init.d/<service>
lssrc -a
start services
svcadm enable nfs
service nfs start
startsrc -s <subsystem>
startsrc -g <group>
stop services
svcadm disable nfs
service nfs stop
stopsrc -s <subsystem>
stopsrc -g <group>
reload service
svcadm refresh nfs
service nfs reload
refresh -s <subsystem>
restart service
svcadm restart nfs
service nfs restart
stopsrc -s <subsystem> 
startsrc -s <subsystem>
service status
svcs nfs
service nfs staus
lssrc -a
service dependencies
svcs -d network
n/a
n/a
service dependants
svcs -D network
n/a
n/a
service logging, etc
/var/svc/log
/var/svc/manifest
/lib/svc/method
n/a
/var/adm/ras
/etc/syslog.conf
 
/etc/rc.tcpip
change service startup
n/a
chkconfig --levels 2345 nfs on
n/a
Add a new service
n/a
# Create your stop/start
# script in /etc/init.d

chkconfig --add <script>

Patching / Software

Solaris
Red Hat
Ubuntu/Debian
HP
AIX
display installed patches
showrev -p
patchadd -p


swlist -l bundle 
swlist -l product
swlist -l patch
instfix -ia
adding patch
patchadd
patchadd -M <dir> (multiple patches)
patch -p1 <patch>

zcat patch46.gz | patch -p1

Note: -p = # of path stripping


swcopy (install patch into depot)
swinstall (install patch from depot)
Note: the swagentd daemon must be running
instfix -k
removing patch
patchrm
patch -R -p1 <patch>

swremove
installp -r
display installed packages
pkginfo (all packages)
pkginfo -l (single package)
pkgchk -l -p <file> (file belongs)
rpm -qa (all packages)
rpm -q (single package)
rpm -qf (file belongs)
rpm -qi <package> (very detailed)
dpkg -l
dpkg -S <search string> (search)
dpkg -S <filename> (file belongs)
 
dpkg -s <package> (status)
dpkg -p <package> (detailed)
 
swlist -l bundle <bundle> 
swlist -l product <product>
 

## check a package
swlist -s <full_path/software>
lslpp -L all (all filesets)
lslpp -L <package> (single fileset)
 
lslpp -w <file> (file belongs)
lslpp -ha (history of filesets)
rpm -qa (all packages)
rpm -q (single package)
rpm -qf (file belongs)
rpm -qi <package> (very detailed)
 

oslevel -g (install packkages above os level)

whereis <filename>
 
which_fileset <filename>
adding package
pkgadd
rpm -Uhv (updates/installs if not already)
rpm -ihv (install)
dpkg -i <package>
swinstall
swinstall -s <full_path/software>
installp -a
installp -c (cleanup after failed install)
rpm -i
geninstall (generic installer: installp, RPM, etc)
removing packages
pkgrm
rpm -e <package>
dpkg -r <package> (do not remove config files)
dpkg -P <package> (remove config files)
swremove
installp -u (commited packages) 
installp -r (applied packages)

rpm -e <package>
geninstall -u <package>
verify package
pkginfo -l
pkginfo -p
rpm -V <package>
n/a
swverity <fileset> (see /var/adm/sw/swagent.log)
lppchk -v 

rpm -V <package>
List files in package
pkgchk -l <package> | grep -i pathname
rpm -ql <package>
dpkg -L <package> (list files)
swlist -l file <product>
lslpp -f <fileset>
rpm -ql <package>
Package directory
/var/sadm
/var/lib/rpm
/var/lib/dpkg/info
/var/adm/sw
/usr/lpp
/var/lib/rpm
List libraries required for binary program
ldd <file>
ldd <file>
ldd <file>
chatr <file>
ldd <file>

0 yorum:

Yorum Gönder