Tuesday, March 10, 2009

HPUX Tips

Some HPUX Tips Collected from different itrc threads from HP.


Command to show top ten CPU users on the system

# UNIX95= ps -e -o "vsz pcpu ruser pid stime time state args" sort -rn head -10


To get Yesterday

perl -e '$yesterday = localtime(time-24*60*60),print "$yesterday\n"'
perl -e '$yesterday = localtime(time-86400),print "$yesterday\n"'
perl -le 'print scalar localtime time - 86400'


Disk related Stuff

######### To find out from which disks OS booted From #########
#echo boot_string/s adb /stand/vmunix /dev/kmem

######### To find out if there are Stale in LVs #########
# /usr/sbin/vgdisplay -v awk '/LV Name/ { print $3 }' xargs /usr/sbin/lvdisplay -v grep -i -e "lv name" -e "lv status" -e stale -e '?'

######### To find out timestamp when the kernel was built/linked #########
# echo "linkstamp?s" adb /stand/vmunix

######### To get the LVM PVID and VGID from a disk #########
To get the LVM PVID and VGID from a disk. Please note that each unique ID consists of 2 longs (2 x 4 Bytes). The 1st long is a host ID (uname -i) and 2nd long is a timestamp. So the PVID tells you when some issued a pvcreate from what machine. The VGID does the same for the vgcreate.
PVID e.g::
# echo "0d8200?UY" adb /dev/dsk/c0t6d0
2008: 2010702141 2002 Jan 2 10:31:16
VGID e.g.:
# echo "0d8208?UY" adb /dev/dsk/c0t6d0
2010: 2010702141 2002 Jan 2 07:29:06

######### To get free space (Size in MB ) on all Volume Groups in a system #########
/usr/sbin/vgdisplay egrep -i 'VG NamePE SizeFree PE' awk 'BEGIN {print "VGname Free_space(MB)"} {a=$NF;getline;b=$NF;getline;c=$NF;print a,b*c}'

######### To get man pages in printable format #########
# man ls col –b ssp expand


CSTM/STM Stuff

####CPU boards:####
echo "selclass qualifier cpu;info;wait;infolog" /usr/sbin/cstm

####LAN cards:####
echo "selclass qualifier lan;info;wait;infolog" /usr/sbin/cstm

####Memory:####
echo "selclass qualifier memory;info;wait;infolog" /usr/sbin/cstm


####Disks:####
#echo "selclass qualifier disk;info;wait;infolog" /usr/sbin/cstm
#echo "selclass qualifier cpu;info;wait;infolog"cstm > /tmp/cpu.info
#echo "sel path system\ninfolog\nexit"cstmgrep "System Serial Number"
# echo "selclass type disk;info;wait;infolog" /usr/sbin/cstm grep "Serial Number"

How to check if largefiles are set

# mkfs -F vxfs -m /dev/vgxx/lvolx
# fsadm -F hfs /dev/vgxx/lvolx (hfs filesystem)
# fsadm -F vxfs /mountpoint


moving disk across system
( Old Method for LVM1.0) my old page ;-)

vgchange -a n /dev/vgXX
vgexport -p -v -m plan_map /dev/vgXX (Preview)
vgexport -v -m plan_map /dev/vgXX
add the disk
ioscan -fnC disk
cd /
mkdir /dev/vgXX
cd /dev/vgXX
mknod /dev/vgXX/group c 64 0xNN0000
vgimport -p -v -m plan_map /dev/vgXX /dev/dsk/c0t0d0…..(Preview)
vgimport -v -m plan_map /dev/vgXX /dev/dsk/c0t0d0…..






One Liner

######Remove control-M's from a windows text file.######
cat $1 tr -d "\015"

######To strip out unprintable characters from a file.######
#cat myfile tr -Acd "[[:print:]][\012]" > newfile

######Remove control-M's from a windows text file.######
cat $1 tr -d "\015"

######Error Code Library.######
/usr/include/sys/errno.h

######Shows LV Status and Stale PEs on LV######
# /usr/sbin/vgdisplay -v awk '/LV Name/ { print $3 }' xargs /usr/sbin/lvdisplay -v \ grep -i -e "lv name" -e "lv status" -e stale -e '?'

######CPU Speed.######
#echo itick_per_usec/D adb -k /stand/vmunix /dev/kmem

######you can check the fs_async paramater with.######
echo "fs_async/D" adb -k /stand/vmunix /dev/kmem

######Shows OS install date######
#swlist -a install_date -l product grep -i os-core

######From which Disk system BootED.######
# echo "linkstamp?s" adb /stand/vmunix

######lsof ######
# # lsof +aL1 /tom

######Man Page Reformat.######
# # man ls col –b ssp expand

######Use adb to query the kernel for the size of physical memory.######
# echo phys_mem_pages/2d adb /stand/vmunix /dev/kmem ( For 11.23)
# echo phys_mem_pages/D adb -k /stand/vmunix /dev/mem (For 11.11)
# echo physmem/D adb -k /stand/vmunix /dev/mem (For 10.x) b. multiply output of adb by 4096 to get the size of RAM.

# To see large file support f_flag: 16 large files are activated f_flag: 0 large files are inactive # /usr/sbin/fstyp -v /dev/vgxx/lvolxgrep f_flag

########## Script to get CSTM version from multiple servers ######
# echo "selclass qualifier cpu;infolog" /usr/sbin/cstm grep Version
# remsh 'echo "exit" /usr/sbin/cstm grep "Version "'
# remsh remotesys '/usr/sbin/cstm < /dev/null' grep "^Version"

Create a new software depot for patches
Creating a separate software depot for your patches is useful, when space is tight and patches have dependencies.
Assuming you have two patches PHNE_20000 and PHNE_20001. unshare all two patches by typing the following commands.
sh PHNE_20000
sh PHNE_20001
Next, we have to create a new software depot on the directory
/newdir/depot
mkdir /newdir/depot
swpackage -s PHNE_20000.depot -d /newdir/depot
Register your new depot on the sd-ux.
swreg -l depot /newdir/depot
Copy the next patch to the newly created software depot.
swcopy -s `pwd`/PHNE_20001.depot PHNE_20001 @ /newdir/depot
You are now ready to install your patches
swinstall -s /newdir/depot




And Villagers were
happy ever after....

Enable XDMCP Connection to Redhat Linux Machines:

By Default XDMCP Connections are disabled on RedHat Linux.

Follow the url to see the steps to enable the xdmcp connection:

http://www.geocities.com/parwatraj/xdmcp.htm

Firmware upgrade - HP rp3410

Follow the steps to upgrade firmware , Here we have taken an example of model HP rp3410




Click on "Download drivers, software and firmware" on the left hand side of the page
Enter the Model of the HP Server you're going to upgrade.

# model



Follow the screen and select the HP Server Model.


Follow the screen and select the correct Operating System Version...






Select the appropriate catagory to download the software for firmware upgrade.
You'll find the description for all the catagories which includes Type of S/w, version, OS, systems where you can apply the firmware upgrade , installation readme instructions and a lot more.
_____________________________________________________________
Installation instructions:
A) Clear the system event logs
1. Establish a telnet session with the MP.
2. Logon to the MP using the Admin password.
3. Type SL to enter the Show Logs menu.
4. At the "Enter menu item or [Ctrl-B] to Quit:" prompt type "c"
5. At the "Are you sure you want to clear all logs? (Y/[N]):" prompt type "y"
5. The following should be displayed:
-> Logs have been cleared.
b) Unpacking the firmware on an HP-UX system:
1. FTP PF_CEVERMPE0315.tar.gz to an empty directory on an FTP server.
2. Use 'gunzip' to unzip the patch: # gunzip PF_CEVERMPE0315.tar.gz
3. Use the 'tar' command to extract the firmware files: # tar -xvf PF_CEVERMPE0315.tar
x Resources.out, 1109367 bytes, 2167 tape blocks
x E0315.bin, 3281836 bytes, 6410 tape blocks
x mp_upg.cnf, 202 bytes, 1 tape blocks
x version.dat, 16 bytes, 1 tape blocks
4. Verify the checksum of the firmware files using the 'cksum' command. Results of the command should be equal to the shown output: # cksum
1981893873 1109367 Resources.out
1868532509 3281836 E0315.bin
1633706411 202 mp_upg.cnf
439768612 16 version.dat
5. Proceed to "Test the network connection to the FTP server" instructions
----------------------------------------------------
Test the network connection to the FTP server:

1. Establish a telnet session with the Management Processor.
2. Logon to the Management Processor using the Admin password.
3. Type ^Ecf to get console write access.
4. Type ^b to enter the Management Processor.
5. Ping the LAN where the MP files are located via the XD command item #3
(LAN access PING).
MP:CM> xd
XD
Diagnostics Menu:
Non destructive tests: P - Parameter checksum
I - I2C access (get BMC Device ID record)
L - LAN access (PING)
M - Modem selftests
Destructive tests:
R - Restart MP
Enter menu item or [Q] to Quit: L
L
Enter IP Address: xxx.xxx.xxx.xxx
6. Reset the MP via the XD command (use the R option). This will free up any unallocated memory for the MP update. -> Choice: r
r
The MP is now being reset...
6. Proceed to “Installing E.03.15 MP Firmware" instructions
--------------------------------------------------------------
Follow the URL to see the complete log file of Firmware upgrade on rp3410 running 11.11.








Monday, March 9, 2009

Raid Levels - Not Mine



( Click on the image to enlarge )
Surely this image is not owned by me, but I find it good to understand the different RAID Levels.


For serious reading about RAID; you may find good info on http://en.wikipedia.org/wiki/Redundant_array_of_independent_disks