Monday, July 6, 2009

File system full - what to look for : SUN

Generic info for SUN servers -
There are several reasons why a filesystem gets full. An important thing to consider is how you set up your filesystems during installation,;you need to take care how much space is used for each filesystem and think ahead.
With forward thinking it is less likely that your filesystems will get full, but will not prevent a filesystem getting full. This document will show the most common reasons why a filesystem may become full and how to handle them.Resolution Top
Below is written mainly to deal with the OS filesystems (such as root, var and usr), but it can be utilized to troubleshoot other filesystems. There are many ways of finding what's filling up a filesystem, which can sometimes be a difficult process. One problem is that a filesystem can be filled up by one or few very large files (which is generally easy to find) or by thousands of smaller files (which can be difficult to find and pinpoint the cause).
First you need to figure out which files are filling up your filesystem.

A very useful way to list the size of files in a filesystem is with the du command.
The following example lists files from largest to smallest on the root filesystem:
$ du -akd / sort -nr more
or
$ du -akd / sort -nr > /tmp/du.out

The latter will give you a file you can review at your convenience.
The -d option of the du command keeps du from crossing partition boundaries.
The “-a” option tells du to report file sizes (without this option du just reports the amount of space used in each directory. The “-k” option means that du will report in terms of kilobytes rather than 512-byte blocks. On Solaris 9 or later replace “k” with “h” if you prefer “human-readable” output, that is output in terms of kilobytes, megabytes or gigabytes depending on the number reported.
The -nr option of sort puts the files in reverse numerical order.
Of course, this can be used on filesystems other than root, just substitute the required path for “/” in the "du" command.

The command “du -skd /” summarizes the amount of kilobytes used for a filesystem, in the given case for the root filesystem. If this is different from what is reported by the df -k command, one may check the InfoDocs 4083 and 17720 for further explanation and troubleshooting tips.

One common problem with df showing more usage than du is existing data or files in directories that are used as mount points.
INFODOC 4083 covers this, but the basic solution is given again here for convenience.
Unmount any mounted filesystems and check the mount point directories for files. Remove the files, or move them if you think you need them, and mount the filesystems again.
For the /tmp filesystem, you will have to boot the system into single-user mode to access the /tmp directory without having swap mounted over it.
For /var and /usr, you will have to boot the system from cdrom, mount the root filesystem, and then check the /var and /usr directories under the mounted root filesystem. These should normally be empty when /var or /usr is not mounted.

Another good way to search for files is to use the command '/usr/bin/find'. There is a good document how to use the find command, see infodoc 13678
Standard filesystems to look at first will be:
Filesystem
Checks
/tmp
If /tmp is full or contains large files, a reboot will clean this directory. A default Solaris installation shares the diskspace for /tmp and swap as you can see in the output of the df command.
Note: /tmp is not cleaned at boot time if /tmp is configured as a separate filesystem.
/dev
Large files may appear here when trying to write to a device using the incorrect device name. For example /dev/rmt/o (letter 'o') instead of /dev/rmt/0 (digit 'zero' for a tape drive. This is a very common problem if the machine does not have a tape drive attached and someone uses a tape command like tar or ufsdump. That will just create a large file in /dev/rmt/. So be sure to check the /dev directory for actual links not files.
/
Look for core files. Check /.wastebasket and /lost+found directory for large files. Check for a .CPR file in root, this is put there by power suspend/resume software.
/var
Third party packages sometimes leave tar files in /var/sadm/pkg directory.
If /var is full (and is a separate filesystem) or /var directory is the one we determined is using up most space in root, check the following.
Clearing out (but NOT deleting; the files should be truncated to zero length) the following files might gain you some space. Use caution here because you will lose various log information. For example, the utmp[x] and wtmp[x] files contain user access and accounting information:
/var/cron/log
/var/spool/lp/logs
/var/adm/utmp
/var/adm/utmpx
/var/adm/wtmp
/var/adm/wtmpx
/var/log/syslog*
/var/adm/messages.*
NOTE: if you zero out the utmp, utmpx, wtmp or wtmpx files, you should reboot your machine.

To zero out a file:
# cat /dev/null > filename
NOTE: For Solaris[TM] 9 or greater, see logadm(1M) for a useful tool to manage log files.
Check /var/saf - check for _log and in tcp and zsmon directories. There will be _log files - you can zero them out with "cat /dev/null > filename". If your system is being used as a printer host, check /var/lp/logs for files, they can be removed if they have been printed or left over from system crashes or printer problems. Check /var/preserve. Check /var/spool/* directory. Subdirectories like "lp" or "mqueue" are used for spooling. Check /var/crash for any system cores. Also check /var/tmp for files not needed; /var/tmp is not cleaned up with a reboot.
A word of caution regarding the /var/sadm directory. This directory contains package and patch information and generally should not be touched.

Also it could be that you are running out of inodes and are getting the message “file system full”. In this case recreate a partition with more inodes. The basic steps are:

Remove unneeded files.*
Backup the partition.*
recreate using newfs -i nbpi /dev/ where nbpi is chosen smaller then the default for the disk size, and rfsname is the raw filesystem; e.g. /dev/rdsk/cNtNdNsN. See man newfs(1M) for more information.*

Restore information back to the partition.
In the course of normal system operation, the root and usr filesystems (or directories) are mostly static (do not grow over time). /var however, does grow over time (because it contains log files, package database, print and mail spoolers, etc.). The name “var” is in fact an abbreviation for “varying” or “variable” as the “/var” filesystem is intended for files which vary in size and content over time (see the filesystem(5) manual page for more details about this). It is good system administration practice to monitor log files to make sure they don't get too large.
If a filesystem suddenly fills up, that could have been caused by installing a new piece of software into a wrong directory.
Check any lost+found directory on any filesystem that is full.
Another approach would be to list files by their modification date (if the date of when the filesystem filled up is known).
# ls -lRt / more will list all the files and sort them by the modification dates.

It could also be that all of these action does not give the solution and the problem is actually that the filesystem is too small.

To check inode usage - df -F ufs -o iTo check how a filesystem was created - mkfs -m /dev/rdsk/cXtXdXsX

::ciao.

Friday, June 26, 2009

Michael Jackson : 1958 - 2009


Rest in peace and I hope that you are moonwalking wherever you are.
Thank you for the music.

Friday, June 19, 2009

Is a system in trusted mode? : hp-ux

How do you tell if a system is in trusted mode or not?

Try looking at these two:

#man iscomsec

#/usr/lbin/getprdef -r


:cheers!

Thursday, June 18, 2009

Wednesday, June 17, 2009

Limiting the size of core dumps : hp-ux

To completely suppress core dumps:

Bourne-style shells: "ulimit -c 0"
C-style shells: "limit coredumpsize 0"

If you want to limit dumps to a specific size, specify a number instead of 0, in blocks for Bourne-style shells, or kilobytes for C-style shells.

:-)

Wednesday, May 20, 2009

Test ftp data transfer rate without actual transfererring

ftp targethost
username/passwd...
bin
hash
put "dd if=/dev/zero bs=32k count=1000" /dev/null


: ciao..

Sunday, May 17, 2009

Employers still grapple over IT pay, skills

Despite recent changes in the global economy, the cost of hiring quality IT staff remains a challenge for employers, say human resource experts.

According to Sommer Owens, manager of IT contract division at Robert Walters Hong Kong, IT salaries in the Chinese territory have been holding steady, but some employees are prepared to lower their pay expectations.

"Candidates who have been caught up in corporate restructuring are willing to accept a lower salary than they were previously getting to stay competitive in...[the] market," Owens said in an e-mail interview.

However, E. Balaji, CEO of India-based recruitment agency Ma Foi Management Consultants, noted that while it is true the bargaining power has swung in favor of employers, the expanding workers pool and lowering salaries relate more to generic IT skills.

A year ago, Balaji explained in an e-mail, most prospective candidates had more than one job offer and candidates were aggressively negotiating salaries and benefits, thereby pushing up the cost of quality talent. "With the current slowdown, this has subsided," he said, adding that the economic downturn has provided cash-rich companies with the opportunity to recruit quality talent at optimal cost.

"[However], for specific levels of expertise and niche skills, potential candidates in a company are generally 'ring-fenced'. Hopes of attracting them at less attractive terms may not materialize," he noted.

Yeo Gek Cheng, director of IT and telecommunications at Hudson Singapore, said the perception that employers now have a wider pool of candidates from which to choose "cannot be further from the truth", particularly for mid- to senior hires who are strong in their field.

"Those who are gainfully employed are unwilling to move due to the perceived risk of changing jobs now," Yeo told ZDNet Asia in an e-mail, adding that employees' annual salary increments have also remained unchanged.

While businesses still face a challenge recruiting candidates, this is less of an issue now as there are fewer job offers available to IT professionals, she said. Yeo noted that the lack of candidates in Asia cannot be resolved simply by an economic downturn. "What is a tight labor pool remains tight," she added.

Agreeing, Owens said some IT skills are still in short supply.

by Sol E. Solomon, ZDNet Asia

read more -->http://www.zdnetasia.com/news/business/0,39044229,62054088,00.htm

Terminate a socket without terminating a process:HP-UX

PROBLEM

Terminate a socket without terminating a process

RESOLUTION

Refer to man page on ndd:

#man 1m ndd

ndd -h supported (will display supported ndd parameters)
ndd -h unsupported (will display unsupported ndd parameters)

Here is an example using the tcp_discon parameter:

#ndd -get /dev/tcp tcp_discon number

NOTE: This number is obtained by running the following command:

#ndd -get /dev/tcp tcp_status

The tcp_status will give you a long list of connected sockets. Find the one
that needs to be killed (use netstat -a (if you have the name of the
host, use the -n option if you have the IP of the host you are looking
for) and then compare to ouput of the -get command below to find the
hostname or the ip). Then use the number on the far left of the output
(LEADING ZEROS must be removed from the number) and prepend it with a 0x to
show its hex.

Example of commands:

* #ndd -get /dev/tcp tcp_status
* #ndd -set /dev/tcp tcp_discon 0x010203404

If using the tcp_discon_by_addr variable convert the ip address into the
hexadecimal representation.

#ndd -set /dev/tcp tcp_discon_by_addr [hex number]

Where '[hex number]' is the one that needs to be killed.

:ciao..

Wednesday, May 6, 2009

Crontab : HP-UX

Many times admins forget the field order of the crontab file
and alway reference the man pages over-and-over.

Make your life easy. Just put the field definitions in your crontab file
and comment (#) the lines out so the crontab file ignores it.

# minute (0-59),
# | hour (0-23),
# | | day of the month (1-31),
# | | | month of the year (1-12),
# | | | | day of the week (0-6 with 0=Sunday).
# | | | | | commands
3 2 * * 0,6 /some/command/to/run
3 2 * * 1-5 /another/command/to/run

export EDITOR=vi ;to specify a editor to open crontab file.

crontab -e Edit your crontab file, or create one if it doesn't already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)


Here are some examples.

0 0 * * * -- midnight every day
0 0 * * 1-5 -- midnight every weekday
0 0 1,15 * * -- midnight on 1st and 15th of month
0 0 1 * 5 -- midnight on 1st of month and every Friday

Crontab example:

A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.

30 18 * * * rm /home/someuser/tmp/*


Cheers !!!

Sunday, May 3, 2009

Pacquiao Blows Out Hatton in Two


Sun, 03 May 2009...It was two rounds of brutal action and a two round blowout for Filipino sensation Manny “The Pacman” Pacquiao as he walked through, around, and all over Ricky “The Hitman” Hatton (45-2 with 32 KOs).


Saturday, May 2, 2009

HP-UX How can I disable non-root logins?

Add the following to /etc/profile, then 'touch /etc/nologin'; this will disable all new logins, except by root:

uid=`id -u`
if [ -f /etc/nologin -a $uid -ne 0 ]; then
echo "Sorry, no logins allowed; try later!"
sleep 5
exit 0
fi

::gudluck!

Friday, May 1, 2009

Root Lost Password : HP-UX... ;)

... but... what if your system is trusted mode???
..you can use some steps of this procedure if you want re-stablish a password than can not be set by cyclic problems...

The steps to reactivate the root account:
1. Boot the system in to single user mode.
2. Mount /usr file systems.# mount /usr
Note: The file system might need file system check (fsck) before mounting.
3. Systems that are not using Trusted System security skip to step #4.For Trusted Systems (presence of a /tcb directory), follow these additionalsteps:
a) Use the following command to reactivate the 'root' account:# /usr/lbin/modprpw -k root
b) Use the 'modprpw' command to null the password, so that the passwd commanddoes not prompt for the old password.
10.x# /usr/lbin/modprpw -w "" root
11.x# /usr/sam/lbin/usermod.sam -F -p "" root
NOTE: To untrust the system, use: tsconvert -r
4. Change the root account password.# passwd root
5. Boot the system in to multi user mode.

fyi la....

Wednesday, April 29, 2009

HP-UX : Extract one file from a make_tape_Recovery

To check the contents of the recovery tape ( assuming the tar archive and 0m/n as device file )
# mt -f /dev/rmt/0mn rew
# mt -f /dev/rmt/0mn fsf 1
# tar tvf /dev/rmt/0m

To extract a file from the archive
# mt -f /dev/rmt/0mn rew
# mt -f /dev/rmt/0mn fsf 1
# tar xvf /dev/rmt/0m

:: Don't try this at work :-)


Wednesday, April 22, 2009

HP-UX File Processing

:: Viewing contents of a file

The cat (concatenate) command can be used to view the contents of a file.

% cat friends
Sally Johnson 123 Ellesmere Lane Athens GA 12876 (413)345-8976
Bob Beamon 913 Mockingbird Lane Annapolis MD 17701 (201)962-8765
Kim Smith 234 Working Street Hollywood CA 18765 (678)987-9876
%
You will find on large files that the output of cat will not fit on your screen. The output will scroll across the screen and you will not be able to view the information. The more command is used to display file information in screen sized chunks. If the file is more than one screen long the word -More- followed by the percentage of the file displayed is placed at the bottom of the screen. Press the SpaceBar to see the next screen of the file or press q or to quit. It is better to use more if your output is going directly to the screen and to use cat if your output is going to a file or pipe.

::Pattern Searching

The grep (global regular expression print) command is used to search for a particular word or phrase in a file. The format of the grep command is:

grep [options] string file(s)

Where string is the word, phrase or regular expression you want to find, and file is the file to be searched. Lets find all lines that contain the string Sally in our friends file.

% grep Sally friends
Sally Johnson 123 Ellesmere Lane Athens GA 12876 (413)345-8976
Sally Miller 510 Epping Way Hobe Sound FL 33455 (654)546-4526
%
To find a pattern that is more than one word long, enclose the string within single or double quotation marks.

% grep 'Sally Miller' friends
Sally Miller 510 Epping Way Hobe Sound FL 33455 (654)546-4526
%
So far we have seen how grep prints all lines which contain the given character string. The -v (invert) option instructs grep to print all lines except those which match the string. This is usefull when you want to remove lines from a file. Lets find all the lines in a file that do not contain the string Sally and place the output into the friends.new file.

% grep -v 'Sally' > friends.new
% more friends.new
Bob Beamon 913 Mockingbird Lane Annapolis MD 17701 (201)962-8765
Kim Smith 234 Working Street Hollywood CA 18765 (678)987-9876
Eddy Murphy 210 W. Hollywood Los Angles CA 90210 (876)238-9987
%
The grep command can be used with regular expressions to match a pattern.
% grep '26$' friends
Sally Miller 510 Epping Way Hobe Sound FL 33455 (654)546-4526
%
This will find all the lines that end in "26".

The grep command can search for a string in groups of files. When it finds a pattern that matches in more that one file, it prints the name of the file, followed by a colon before the line matching the pattern. The -i (ignore) option to grep will ignore the case.

% grep -i bob *
friends:Bob Beamon 913 Mockingbird Lane Annapolis MD 17701 (201)962-8765
friends.new:Bob Beamon 913 Mockingbird Lane Annapolis MD 17701 (201)962-8765
%

:: Comparisons between files

The cmp (compare) command is used to compare any two files, including executable files. The diff (differential file operator) command is used to display the differences between text files or directories. The order of the diff command is important. The format of the diff command is:

diff [options] old_file new_file diff [options] old_dir new_dir

The diff command will display a listing of the editing actions that need to be performed on the old file to change it into the new file. The three ways in which diff indicated changes to a file are a (lines are added), c (lines are changed) and d(lines are deleted). Lets find the difference between the friends and the friends.new files.

% diff friends friends.new
1d0
< Sally Johnson 123 Ellesmere Lane Athens GA 12876 (413)345-8976
4d2
< Sally Miller 510 Epping Way Hobe Sound FL 33455 (654)546-4526
%
This tells us that deletions need to be made to the friends file to get the friend.new file. The 1d0 tells us that line 1 of the friend file has to be deleted, and the 4d2 tells us that line 4 of the friend file has to be deleted.

The output of diff can be sent to the ed command to convert the first file into the second. In fact, the using diff with the -e option will produce output suitable for input to the ed command.

% diff -e friends friends.new > ed.script
% ( cat ed.script ; echo w ) | ed friends
415
249
% diff friends friends.new
%
If you eliminated the echo w command, ed would read the input from the cat ed.script, perform the operation and then exit. With the echo w command you are telling ed to write to the file friends. The semicolon between the cat ed.script and echo w tells the shell that these are separate commands.

:: Counting things in a file

The wc (word count) command counts the number of lines, words, and characters in a file. This is especially usefull for counting the number of lines of source code in a program orthe number of words in a document.

% wc friends
3 28 249 friends
%
The first number indicates the number of lines, followed by the number of words and the number of characters(including newlines).

:: Modifying character strings

The sed (stream editor) command reads lines, one by one, from an input file and applies a set of editing commands to the lines. The sed command is like grep except that it allows you to make changes to file. The format of the sed command is:

sed [options] action/string/newstring file(s)

% sed "s/(201)962-8765/(201)962-9999/" friends
Bob Beamon 913 Mockingbird Lane Annapolis MD 17701 (201)962-9999
Kim Smith 234 Working Street Hollywood CA 18765 (678)987-9876
Eddy Murphy 210 W. Hollywood Los Angles CA 90210 (876)238-9987
%
The s (substitute) option tells sed to substitute. We have changed the phone number. If we wanted to save these changes we would redirect the output to a file.

The sed command also accepts regular expressions.

% sed '/^$/d' hello.cc
#include
main() {
cout << "Hello, cruel world! \n";
}
%
The d option is tells sed to delete. In this case we are using a regular expression to tell sed to remove all blank lines from our hello.cc file.

:: Sorting data in files

The sort command is used to sort the contents of a file into alphabetic or numerical order.

% sort +1 friends
Bob Beamon 913 Mockingbird Lane Annapolis MD 17701 (201)962-8765
Eddy Murphy 210 W. Hollywood Los Angles CA 90210 (876)238-9987
Kim Smith 234 Working Street Hollywood CA 18765 (678)987-9876
%
The +1 option tells sort to use the second field of the sort key rather than the beginning of the line. Fields are separated by whitespace, however you can use the -t option to separate by any character. The -n options tells sort to sort a numeric key, otherwise it will sort by the corresponding ASCii values.

Another command that is usefull when you are sorting is the uniq command. The uniq command will write only one instance of each line, whereas the sort will print every line. Usually the output of the sort command is piped to the uniq command.


::enjoy life...

Monday, April 20, 2009

Patch Cleanup HP-UX

There is a utility under /usr/sbin and it is called 'cleanup'. It provides the following functionality for 10.X patch management:

/usr/sbin/cleanup
Remove superseded patches from the system to reclaim space in /var.
Queries the user re trimming SD logfiles as well.

/usr/sbin/cleanup -F
Forces the removal of ALL Patch backups to reclaim space in /var (you cannot back out a patch out after this).

/usr/sbin/cleanup -t
Trim SD logfiles /var/adm/sw*.log to the most recent 5 entries.

/usr/sbin/cleanup -i
Remove overwritten patch entries from the SDUX IPD.

/usr/sbin/cleanup -d [absolute path to software depot]
Removes superseded patches from a software depot.

:: :-)

Saturday, April 18, 2009

change IP's Addresses of cluster servers.

I followed these steps when I had change IP Address of my cluster servers.

Before you change the IP Address of your Server you must have all new ip's
when you want to go ahead.(of course..:-))
ex. Server ip and package ip.

Take backup of these directory and files

1./etc/cmcluster
2./etc/hosts
3./etc/rc.config.d/netconf

modify these files
1./etc/hosts # modify ipaddress
2./etc/rc.config.d/netconf # modify ipaddress and subnet
3./etc/cmcluster/cluster.conf # modify HEARTBEAT_IP

4./etc/cmcluster/packge/cipackage.conf # change SUBNET XX.XX.XX.XX
5./etc/cmcluster/packge/dbpackage.conf # change SUBNET XX.XX.XX.XX

6./etc/cmcluster/packge/cipackage.cntl # change IP[0]=XX.XX.XX.XX
change SUBNET[0]=XX.XX.XX.XX

7./etc/cmcluster/packge/cipackage.cntl # change IP[0]=XX.XX.XX.XX
change SUBNET[0]=XX.XX.XX.XX

8.rcp cluster.conf into /etc/cmcluster
rcp cluster.conf into other node same location

9.rcp these conf,cntl and config file into /etc/cmcluster/packge/
rcp ciVRP.conf,dbVRP.conf,ciVRP.cntl,dbVRP.cntl

10. restart the net for new ip
/sbin/init.d/net stop
/sbin/inti.d/net start

check all ipaddress which we have changed and check with linkloop also

11.cmcheckconf -v -C /etc/cmcluster/cluster.conf -P cipackage.conf -P dbpackage.conf
it should come with no error then go for the next step

12.cmapplyconf -v -C /etc/cmcluster/cluster.conf -P cipackage.conf -P dbpackage.conf

warning : ninenok is not liable if its not working for you!
pls. pray before doing this.

F.


Been busy the past months and now I'm back again..Thanks for visiting my blog, and rest assured I'll share whatever stuff I can dig with relation to unix, etc.

Treat your password like your toothbrush. Don't let anybody else use it, and get a new one every six months. ~Clifford Stoll

Thursday, February 19, 2009

HP-UX: How Do I configure routing or add route?

You can use route command to configure routing. Syntax is as follows:
route add net {network-address} netmask {subnet} {router-address}

Let us assume your router address is 192.168.1.254 and network ID is 192.168.1.0/24, then you can type route command as follows:
# route add net 192.168.1.0 netmask 255.255.255.0 192.168.1.254

OR

To add a default route:
# route add default 192.168.1.254

Verify that (display) routing table is updated (display routing table):
# netstat -nr

Test it i.e. try to ping or send nslookup request:
# ping mycorp.com

To flush all routing entries use command:
# route -f

However if I reboot HPUX box then above routing entries gets removed. To pick up your setting upon each reboot your need to configure Routes in HPUX networking configuration file - /etc/rc.config.d/netconf. To add default router/gateway 192.168.1.254:
# vi /etc/rc.config.d/netconf

Add or modify following entries

ROUTE_DESTINATION[0]="default"
ROUTE_MASK[0]=""
ROUTE_GATEWAY[0]="192.168.1.254"
ROUTE_COUNT[0]="1"
ROUTE_ARGS[0]=""

Reboot HP-UX system/server to take effect
# shutdown -ry 0

Wednesday, February 11, 2009

Finding file and directories : HP-UX

The find command recursively descends a directory locating all the files that meet the criteria given on the command line. Without any options the find command will take no action on the files it finds, so the -print option is used to write the found files to standard output. The format of the find command is:

find path_name_list [options]

Where path_name_list is one or more directories.

% find . -name Makefile -print
/home/huron2/admin/scot/tutorial/Makefile
%
The . is a directory abbreviation for the current directory. The -name option specifies that only files with the given name should be found. The name option can include wildcard character:
% find . -name "core*" -size +3 -mtime +7 -exec rm -i {} \; -print
/home/huron2/admin/scot/core: ? (y/n) y
/home/huron2/admin/scot/core
%
==>Some Options to Find
--------------------------------------------------------------------
-name file Find files named file

-size n Find files that contain size...
n exactly n blocks (1 block = 512 bytes)
+n more than n blocks
-n less than n blocks

-mtime n Find files that were modified
n exactly n days ago
+n more than n days ago
-n less than n days ago

-exec cmd Execute command cmd on each file

-type type Find files that match the type
f ordinary file
d directory
b block device
c character device
p named pipe
--------------------------------------------------------------------
Actions can be taken when files are found by using the -exec option. The -exec option uses the {} (left curly-brace right curly-brace) syntax to specify the current file that find has found. The exec command ends with the \; syntax. If we did not have the print option at the end we would not get a confirmation the file had been removed.

...ciao...

Tuesday, February 10, 2009

How do I start hpux network service?

Use following command to start HP-UX network service:

/etc/init.d/net start
OR
/sbin/init.d/net start
Please note that your network configuration file is /etc/rc.config.d/netconf . Here is my sample /etc/rc.config.d/netconf file:

# cat /etc/rc.config.d/netconf
Output:
HOSTNAME=deephpux < --change hostname here OPERATING_SYSTEM=HP-UX LOOPBACK_ADDRESS=127.0.0.1 INTERFACE_NAME[0]=lan0 IP_ADDRESS[0]=192.168.1.100 <--change IP address here SUBNET_MASK[0]=255.255.255.0 <--change subnet mask here BROADCAST_ADDRESS[0]="" DHCP_ENABLE[0]="0" <--Do you wanna DHCP? set 1 to use DHCP

You can also set IP address using ifconfig command:
# ifconfig lan0 192.168.1.200 netmask 255.255.255.0 up

See or get current IP address information with ifconfig command:
# ifconfig lan0

......Life is short, enjoy every moment!

Sunday, February 8, 2009

LVM for HP-UX

The following are an overview of how to
create volumes in LVM for HP-UX.

1) Add your disks, and verify their device
names. The the command:

# ioscan -fnC disk

2) Next, place the disks you wish to use for
volumes under LVM control. This
is done by converting a disk into
a "Physical Volume" (pv). The command
used is:

# pvcreate

example: #pvcreate /dev/rdsk/c1t0d0

Note: You can use the "-f" option
to "force" the creation, which keeps
LVM for asking for verification...
the "Would you like to proceed? (y/n)"

3) Now, create a device path for the volume group.
Do this by creating a directory in /dev
by the name of the volume group.

# mkdir /dev/

example: # mkdir /dev/vg01

4) Then create a "group node" in that directory.
The process looks like this:

# mknod /dev//group c 64

example: # mknod /dev/vg01/group c 64 0x030000

Note: The minor number follows the following patern:
0x030000
0x040000
0x050000
.....

5) You can now create your Volume Group (vg) to which
the Physical Volumes will be assigned. A VG
is similar to a Disk Group in Veritas. The
format is:

# vgcreate /dev/ ....

example: # vgcreate /dev/vg01 /dev/dsk/c1t0d0

Note: The PV DevPaths don't use a partition
designation (sX). You can specify as many PV's
to add to a VG as you like on this one line.

6) Next create a Logical Volume (lv). This is the "volume"
itself, which will contain the file system.

# lvcreate /dev/

example: # lvcreate /dev/vg01

Note: This will create a 0 length volume. It
will also create two new files in the vg dev
directory: lvol1 and rlvol1. Being: Logical
Volume 1, and Raw Logical Volume 1. You can
have multiple LV's per VG.

Note(2): lvcreate with no options will create
a concat volume. To create striped volumes,
use the options:
-i This is the Vx equiv to column numbers.
-I This is the Vx equiv to a stripe width in kb.
-m Number of mirrors. Can be "1" or "2".
-L The size of the new volume in megabytes.

7) Now you can extend to Logical Volume to the length
you desire. To extend to it's max, do the
following:

a) Run the command: # vgdisplay
example: # vgdisplay /dev/vg01

b) Look for the two lines: "Total PE" and "PE Size"
PE stands for "Physical Extent". If you
multiply the number of "Total PE" by
"PE Size" you will get the total size of
the disk that is usable, usually in megabytes.

NOTE: LVM breaks PV's into Physical Extents.
These are like blocks in LVM. PE Size is
the size of each PE. Total PE is the
number of PE's avalible to the volume group.
The "PE Size" is variable, default is "4M"
but it can be reset to any desired size,
during VG creation. The options avable to
"vgcreate" are:
-e Max Num of PE's for this VG. Default: 1016
Max PE cannot exceed: 65535
-l Max Num of LV's for this VG. Default: 255
-p Max Num of PV's for this VG. Default: 16
Max PV cannot exceed: 255
-s Size of each PE for this VG. Default: 4
PE Size must be a power of 2.
-x Can the VG be grown? Default: y

c) With the number you got by multiplying "Total PE" by "PE Size"
you have the total lenth of the VG. To make all disks
in the VG be used by 1 LV, and to use all the space,
extend the Logical Volume with the command:

# lvextend -L

example: # lvextend -L 3200 /dev/vg01/lvol1

This would extend VG01's LV 1 out to (NOT by) 3.2G.
Remember the size is defaulted to Megabytes.

8) You can now create your filesystem with:

# newfs -F

example: # newfs -F vxfs /dev/vg01/rlvol1

9) Now mount the filesystem like usual:

# mount /dev/vg01/lvol1 /mydatavolume

Done!

Friday, February 6, 2009

HP-UX LVM listing

- Monitor LVM with the following commands:
bdf : Similar to a Solaris style "df -k" output.
pvdisplay :Display PV Information
vgdisplay :Display VG Information
lvdisplay :Display LV Information

- Remove LVM Objects with the commands:
pvremove: Removes a PV Device (ie: /dev/dsk/c0t1..)
vgreduce : Remove a PV from a VG Binding
use as: vgreduce /dev/vg01 /dev/dsk/c0t1d0
vgremove : Removes a VG, only done when there
is only ONE disk left in the VG.
lvremove Removes a LV.

To remove a complete volume you must unmount the fs, then
remove the LV, then reduce the VG to all but one disk. Then
remove the VG. Then you only need to remove each PV untill
you have normal disks again, not under LVM control.

- Here's a list of commands:


----VG-----
vgcfgbackup
vgchange
vgcreate
vgexport
vgimport
vgremove
vgcfgrestore
vgchgid
vgdisplay
vgextend
vgreduce
vgscan

---LV----
lvchange
lvdisplay
lvlnboot
lvreduce
lvrmboot
lvcreate
lvextend
lvmmigrate
lvremove

---PV----
pvchange
pvck
pvcreate
pvdisplay
pvmove
pvremove

- There are 3 LVM Objects:

----------------------------
| Logical Volume |
----------------------------
\/ \/ \/ \/
----------------------------
| Volume Group |
----------------------------
\/ \/ \/ \/
----------------------------
| Physical Volume |
----------------------------

or: Disks are used to create PV's,
which we group into VG's, from
which we create LV's which
contains the filesystem we use.

..:-)

Thursday, February 5, 2009

How To Write First UNIX Korn Shell Script Program

Korn shell scripting under UNIX / Linux can be used to automate lots of stuff. It easy to write a shell script. You must know how to use a text editor such as vi to write a script.

Write a shell program to print knowledge is power on screen. Type the following command to open file:

#vi hello.ksh

The first line should be as follows:

#!/bin/ksh

It is called a shebang. It consists of a number sign and an exclamation point character (#!), followed by the full path to the interpreter such as /bin/ksh. All scripts under UNIX execute using the interpreter specified on a first line.
Next append code as follows:

# A shell script to print message
# Written by Ninenok - Feb/5/2008
print "Knowledge is power"

Save and close the file. At the end your script should look like as follows:

#!/bin/ksh
# A shell script to print message
# Written by Ninenok - Feb/5/2008
# ------------------------------
print "Knowledge is power"

Set executable permission

Type the following command to set executable permission:
chmod +x hello.ksh

Run your korn shell script

Type the following command:
./hello.ksh

Sample output:

Knowledge is power

---------------------
..enjoy..:-)

Tuesday, February 3, 2009

add a remote line printer to HP-UX

The easiest way is using SAM (SMH on 11.31).

#sam
Select
1.Printers and Plotters,
2.LP Spooler
3.Printers and Plotters
4.Add Remote Printer/plotter from the action menu.

--ciao.....

Monday, February 2, 2009

Delete Files Older Than x Days

The find utility on hp-ux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We'll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them.

Command Syntax

find /path/to/files* -mtime +5 -exec rm {} \;

Note that there are spaces between rm, {}, and \;

Explanation

  • The first argument is the path to the files. This can be a path, a directory, or a wildcard as in the example above. I would recommend using the full path, and make sure that you run the command without the exec rm to make sure you are getting the right results.
  • The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.
  • The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command.

This should work on Ubuntu, Suse, Redhat, or pretty much any version of linux.

Thursday, January 29, 2009

HP-UX--> INIT: Timout Reached - Error in writing to wtmp or wtmps file

It can be:

/tmp or /var is full

or wtmp is corrupt:

1.Boot the server in single user mode
2.Delete /var/adm/wtmp
3.touch /var/adm/wtmp
4.Boot the server using init 3

...yes we can!

Wednesday, January 28, 2009

Are you going to finish strong?

Nick Vujicic has no arms or legs but has come to terms with his lot in life and he delivers an inspirational speech to these school kids that they will probably never forget.

This is a truly a source of inspiration teaching to live life at its best standards in spite of all difficulties. God bless us all.

Inspirational clip: http://www.youtube.com/watch?v=MnlhZyW959k

Tuesday, January 27, 2009

HP-UX : find big files in a directory

1) Find big files in a directory:

# find /dir_path -xdev -size +10000 -exec ll {} \; > /tmp/bigfiles

2) Find new files in a directory:

# find /dir_path -xdev -type f -mtime -2 -exec ll {} \; /tmp/newfiles

3) copy entire file system / directory to new location:

# find /source_dir_path -depth | cpio -pdlmuva /dest_path

..:-)


Monday, January 26, 2009

Basic network commands in HP-UX

FILES

* /etc/hosts - Hosts configuration file (resolve hosts and IPs)
* /etc/rc.config.d/netconf – IP address, routeing address and hostname stored in this file

SCRIPTS

* /etc/init.d/net start – Use to start, stop network service

HPUX Commands
(a) Display lan interface info:
# lanscan

(b) All in one lan configuration utility (lan0 is first Ethernet interface) to configure and view the system IP address:
# ifconfig lan0 - Display IP info such as IP address netmask etc.
# ifconfig lan0 up - Up network interface (allow traffic)
# ifconfig lan0 down - Down network interactive (deny traffc)
# ifconfig lan0 192.168.1.1 netmask 255.255.255.0 up - Setup/change IP adddress

(c) Displaying host name
# hostname

(d) Arp administration (cache)
# arp -a

(e) Display routing table/info:
# netstat -nr

(f) Define new route:
# route add default 192.168.1.254 1

(g) HP’s LAN diagnostic tool
# lanadmin

(h) Test a remote host connectivity
ping host.mycorp.com

(i) Setup various lan properties, dns client, NIS client configuration etc using GUI tool:
# sam
# set_parms

(j) Check dns connectivity:
$ nslookup www.google.co.uk

How to see the top 10 CPU users in HP-UX

try to type this :

UNIX95= ps -e -o pcpu -o ruser -o args|sort -nr|grep -v %CPU|head ???10


Note: pls. don't try this at home.

Sunday, January 25, 2009

Gong Xi Fa Cai 恭喜发财


The most common Chinese ways of saying Happy New Year are Gong Xi Fa Cai (Mandarin) and Gong Hey Fat Choy (Cantonese). Even though the pronunciations are a little different, both are written the same way.

Gong Xi is congratulations or respectfully wishing one joy.
Fa Cai is to become rich or to make money.

Thus, Gong Xi Fa Cai means wishing you to be prosperous in the coming year.

Happy Chinese New Year!

Saturday, January 24, 2009

Sentosa Flowers 2009


Celebrating the season of Spring and ushering in the Year of the Ox with a kaleidoscope of fresh blooms at the annual floral extravaganza. Magnificent displays of unique flowers and soak in the festive mood on the sunny island. The floral displays will be making its way down to the white sandy beaches of Palawan, making it a truly Sentosa experience. Jan 24-Feb 1, 2009 at Sentosa,Singapore.

Friday, January 23, 2009

HP-UX find

Q : Is there a way to run "find" so it reports all files/subdirs under a directory that are over X days old without transposing through all the subdirs?

example
under /X
/X/Y/Z
/X/A/B/C/D
/X/A/E/I/O/U

I would like it to report back only if Y and A have a date stamp older then 30 days.

A : find * -type d -prune -mtime +60
EXAMPLES (HP-UX man pages)
Search the two directories /example and /new/example for files
containing the string Where are you and print the names of the files:

find /example /new/example -exec grep -l 'Where are you' {} \;

Remove all files named a.out or *.o that have not been accessed for a
week:
find / \( -name a.out -o -name '*.o' \) -atime +7 -exec rm {} \;

Note that the spaces delimiting the escaped parentheses are
required.

Print the names of all files in /bin that are context-dependent; that
is, hidden directories:
find /bin -type H -print

Print the names of all files on this machine. Avoid walking nfs
directories while still printing the nfs mount points:

find / -fsonly hfs -print

Copy the entire file system to a disk mounted on /Disk, avoiding the
recursive copy problem. Both commands are equivalent (note the use of
-path instead of -name):
cd /; find . ! -path ./Disk -only -print | cpio -pdxm /Disk
cd /; find . -path ./Disk -prune -o -print | cpio -pdxm /Disk

Copy the root disk to a disk mounted on /Disk, skipping all mounted
file systems below /. Note that -xdev does not cause / to be skipped,
even though it is a mount point. This is because / is the starting
point and -xdev only affects entries below starting points.
More on man pages from HP-UX...kampai!

Saturday, January 17, 2009

How can I find the HP-UX equivalent for a given Solaris/AIX/etc.. commands?

-->Rosetta Stone for UNIX (A Sysadmin's Universal Translator; or
"What do they call that in this world?") provides a very nice AIX/
DG-UX/FreeBSD/HP-UX/IRIX/Linux/NetBSD/OpenBSD/Solaris/
SunOS/Tru64/Ultrix etc quivalency table at:

http://bhami.com/rosetta.html

-->UNIXguide.net also provides a
AIX/FreeBSD/HP-UX/Linux(RedHat)/Solaris/Tru64 equivalency
table, at:

http://www.unixguide.net/unixguide.shtml

Friday, January 16, 2009

How to change hostname on HP-UX 11i

::without reboot

HP-UX 11iv2 and v3 allows you to change the hostname on the fly, so if you want to change the hostname on HP-UX 11i server you can do it without rebooting your server. I have documented here several steps to change the hostname on your HP-UX 11i server.
Steps to change the hostname on HP-UX:

1. First run the hostname command to HP-UX server to change the hostname on HP-UX 11i server:

root@hpuxdev:/> hostname hpuxdev11

I am changing hostname on Integrity Itanium rx6600 running HP-UX 11iv2 from hpuxdev to hpuxdev11

2. Next execute uname command to set the nodename like hostname:

root@hpuxdev:/> uname –S hpuxdev11

running uname with –S option changes the nodename to required hostname value on HP-UX 11i server

3. Change network configuration file (netconf) to make the change permanent during reboots. The netconf files exists

under /etc/rc.config.d direcotory on HP-UX servers

root@hpuxdev:/> cd /etc/rc.config.d/netconf

root@nedunix6:/etc/rc.config.d> vi netconf

Open the netconf file using vi editor and search for HOSTNAME variable, replace the old hostname value to new hostname value. It is recommended by HP to keep the value enclosed in double quotes (" ")

root@nedunix6:/etc/rc.config.d> vi netconf

HOSTNAME="hpuxdev"
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1

After changing the HOSTNAME , the netconf file portion with HOSTNAME directives looks like this :

root@nedunix6:/etc/rc.config.d> vi netconf

HOSTNAME="hpuxdev11"
OPERATING_SYSTEM=HP-UX
LOOPBACK_ADDRESS=127.0.0.1

5.Restart the network configuration settings on HP-UX server by running following command .Make sure you run these command from the CONSOLE or MP (Management processor) , sometimes ui have noticed network timeout for few seconds while restarting network settings :

root@hpuxdev:/> /sbin/init.d/net start

Verify changes hostname on HP-UX:

Finally run following commands to make sure hostname and nodename is changed to newer name :

root@hpuxdev:/> hostname

hpuxdev11

root@hpuxdev:/> nodename

hpuxdev11

:with REBOOT

There is a *much* simpler way:

set_parms hostname

Answer a prompt or two, and.... Done!

Monday, January 12, 2009

Barack Obama is featured on the upcoming issue of The Amazing Spider-Man comic book in commemoration of his upcoming inauguration as the 44th President of the USA. Since Obama is a self confessed Spider-Man comics geek when he was a kid, Marvel Comics thought it would be cool to honor the new president this way...
The issue hits the comic stands on Jan 14, this is gonna be huge!

HP-UX LVM creation

ex. create /oracle/J1Q/sapdata13 under volume group vg_J1Q_04
using luns c14t1d4(primary) & c14t8d1(alternate)

-->check if fs existed
bdf /oracle/J1Q/sapdata13

--> check the latest disk report
cd /var/opt/soeg/rpt
ll *disk*

--> check for available luns
more 20080423diskinfo.rpt | grep -i lvm | grep -v "0(" | sort -u

-->compares the current hardware configuration (pairing of luns)
xpinfo -il | grep c12t0d1
xpinfo -il | grep 04:28

--> check if controller exists already
pvdisplay /dev/dsk/c14t8d1
pvdisplay /dev/dsk/c14t1d4
vgdisplay -v | grep -iE "c14t8d1|c12t0d1"

ll /dev/*/group | sort -u

-->create directory/device
mkdir /dev/vg_J1Q_04

-->create a character file type group
mknod /dev/vg_J1Q_04/group c 64 0x410000

-->initialize/format physical volume
pvcreate -f /dev/rdsk/c12t0d1

-->create volume group
vgcreate -e 10000 /dev/vg_J1Q_04 /dev/dsk/c12t0d1 /dev/dsk/c14t8d1
vgdisplay /dev/vg_J1Q_04

-->create logical volume
lvcreate -L 8624 -n lv_data13 /dev/vg_J1Q_04

-->construct the new file system
newfs -F vxfs -o largefiles /dev/vg_J1Q_04/rlv_data13

-->create directory
mkdir -p /oracle/J1Q/sapdata13

-->update /etc/fstab

--> mount created new directory
mount /oracle/J1Q/sapdata13

-->check file permission and ownership
chgrp oraj1q:dba sapdata13
chown oraj1q:dba sapdata13


note: the above syntax are derived from true to life experience
and im not liable in case you use it on a production box and
it didn't works. :-)

Monday, January 5, 2009

HP-UX reviewer 4

:: if you can't remove Volume Group w/ 'ghost' logical volume

# vgremove /dev/vg
vgremove: Volume group "/dev/vg" still contains a logical volume(s).
vgremove: Couldn't remove volume group "/dev/vg".

ans:

#vgchange -a n /dev/vg
#vgexport /dev/vg

your volume group will be removed from /etc/lvmtab..
It is equal to vgremove...tried it and it worked.

sa susunod ulit...ciao...

Sunday, January 4, 2009

HP-UX reviewer 3

:: NFS mounting

ex : mount directory /sapcd of sihp8080 to sihp8085

@sihp8080 -->
[root@sihp8080:/sapcd]
# bdf /sapcd
Filesystem kbytes used avail %used Mounted on
/dev/vg_sapcd2_temp/lv_sapcd2
106770432 54467240 51894584 51% /sapcd

[root@sihp8080:/sapcd]
# more /etc/exports | grep -i sapcd
/sapcd -root=sihp8085:sihp8086:sihp8087,access=sihp8085:sihp8086:sihp8087

[root@sihp8080:/sapcd]
# exportfs -av
re-exported /sapcd
re-exported /usr/sap/put

@sihp8085-->
[root@sihp8085:/sapcd]
#
bdf /sapcd
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lv_root 819200 179488 634768 22% /

[root@sihp8085:/sapcd]
# more /etc/fstab | grep -i sapcd
sihp8080:/sapcd /sapcd nfs rw,suid 0 0

[root@sihp8085:/sapcd]
# mount /sapcd

more to come....chalo
('lets go' in Hindi).

Friday, January 2, 2009

2009 Year of the Earth OX January 26, 2009 - February 13, 2010


Peoples' Park, Chinatown in Singapore 2009

The Chinese calendar is based on solar and lunar cycles and thus the new year falls on a different day of the Western solar calendar each year.

Year Ahead:
The OX year is a conservative year, one of traditions and values. This is not a year to be outrageous. A slow but steady year.

This OX year will bring stability and growth where patience and diligence pays off.

This is a year of Harvest - when we reap what we have sown. Take care of business this year, do not let things slide.

Thursday, January 1, 2009

Different uses of the word F_U

Eto try nyo, sinend sa akin..

Explanation of the word F_u_ c_k.mp3
download the file here.

HP-UX reviewer 2

....continued from my HP-UX kodigo....
  • Exporting and Importing disks across system.
1. make the volume group unavailable
vgchange -a n /dev/vgdata

2. Export the the disk while creating a logical volume map file.
vgexport -v -m data_map vgdata

3. Disconnect the drives and move to new system.
4. Move the data_map file to the new system.
5. On the new system recreate the volume group directory
mkdir /dev/vgdata
mknod /dev/vgdata/group c 64 0x02000

6. Import the disks to the new system
vgimport -v -m data_map /dev/vgdata /dev/dsk/c2t1d0 /dev/dsk/c2t2d0

7. Enable the new volume group
vgchange -a y /dev/vgdata
  • Renaming a logical volume
    /dev/vgdata/lvol1 -> /dev/vgdata/data_lv
umount /dev/vgdata/lvol1
ll /dev/vgdata/lvol1
take note of the minor ( e.g 0x010001 )
brw-r----- 1 root root 64 0x010001 Dec 31 17:59 lvol1
mknod /dev/vgdata/data_lv b 64 0x010001 create new logical volume name
mknod /dev/vgdata/rdata_lv c 64 0x010001
vi /etc/fstab { reflect the new logical volume }
mount -a
rmsf /dev/vgdata/lvol1
rmsf /dev/vgdata/rlvol1

to be continued.....

HP-UX reviewer

naks, kala nyo genius ako sa HP-UX? Kodigo ko lang ito in case of emergency..ito ung laman ng halo-halo.txt na naka-save sa lagi kong dala na vintage 128mb flash disk tuwing may duty ako.

HP-UX: Disk and Filesystem tasks
  • Search for attached disk
    ioscan -fnC disk
  • Initialize a disk for use with LVM
    pvcreate -f /dev/rdsk/c0t1d0
  • Create the device structure needed for a new volume group.
    cd /dev
    mkdir vgdata
    cd vgdata
    mknod group c 64 0x010000
  • Create volume group vgdata
    vgcreate vgdata /dev/dsk/c0t1d0
    { if your expecting to use more than 16 physical disks use the -p option, range from 1 to 256 disks. }
  • Display volume group vgdata
    vgdisplay -v vg01
  • Add another disk to volume group
    pvcreate -f /dev/rdsk/c0t4d0
    vgextend vg01 /dev/dsk/c0t4d0

  • Remove disk from volume group
    vgreduce vg01 /dev/dsk/c0t4d0
  • Create a 100 MB logical volume lvdata
    lvcreate -L 100 -n lvdata vgdata
    newfs -F vxfs /dev/vgdata/rlvdata
  • Extend logical volume to 200 MB
    lvextend -L 200 /dev/vgdata/lvdata
  • Extend file system to 200 MB

    :: NO online JFS installed
    fuser -ku /dev/vgdata/lvdata { kill all process that has open files on this volume. }
    umount /dev/vgdata/lvdata
    extendfs /data

    ::Online JFS {ex. 200 MB / 4 MB = 50 LE; 50 x 1024 = 51200 blocks }
    fsadm -F vxfs -b 51200 /data
  • Set largefiles to support files greater than 2GB
    fsadm -F vxfs -o largefiles /data

Paunawa:kung hindi maintindihan, magtanong sa katabing ofismate...more to come.

New year - new challenge


Marina Bay - New Year, Singapore 2009

We will open the book. Its pages are blank. We are going to put words on them ourselves. The book is called Opportunity and its first chapter is New Year’s Day.--Edith Lovejoy Pierce