Monday, September 26, 2011

Set Kernel Parameters - HP-UX

Solaris Commands

Zlogin

To connect to the console of a Solaris 10 zone called testzone, use the following command as root or the equivalent on the global zone: zlogin -C testzone
The -C option specifies a console login. The console login will persist when the zone is rebooted.
To exit zlogin, use the escape sequence ~. on a new line (the tilde must follow a carriage return, not any other character). If this escape character is inappropriate (because you are connected using software like tip that also uses this escape sequence), you can specify a different escape character on the command line. For example, to use the @ symbol, use:
zlogin -C -e @ testzone
 

To Restart the SSH Service

  1. Login to the command-line terminal
  2. Run the command:
svcadm restart svc:/network/ssh:default

or
The command to restart sshd service in Solaris is :
Usage: /lib/svc/method/sshd { start | restart }

Commands to check status
busstat
cachefsstat
ctstat
fsstat
iostat
kstat
lpstat
mailstats
mpstat
netstat
nfsstat
poolstat
pppstats
prstat
rcapstat
smbstatus
uustat
vmstat

Tuesday, September 13, 2011

Setting Up A CVS Project

Setting Up A CVS Project

You've created your code.  It works great.  Now you want to make some changes.  But in case it all goes wrong, you want to be able to back out the changes.
You need CVS (or some random backup system, but CVS will do a better job).

Setting up a CVS Server

If you do not already have a CVS server, you can set one up on your RimuHosting server.  Just log in and run:

# you need the CVS applications
apt-get -y install cvs
# this tells cvs init where to create the CVSROOT directory
export CVSROOT=/usr/local/cvsroot
# create the CVSROOT directory with all the config files cvs needs
cvs init

# create a group for 'cvs' users.  This group may already exist, so ignore any error
groupadd cvs
# give that group ownership of the cvs repository
chown -R root:cvs /usr/local/cvsroot
# set the sticky bit so that files created by a group member stay owned by the group
chmod -R g+srw /usr/local/cvsroot/
Then for each Unix user that needs access to the repository, run: usermod -G cvs somecvsusername.
If you get an error like:

cvs import: cannot make path to /usr/local/cvsroot/someproj: Permission denied
cvs import: Importing /usr/local/cvsroot/someproj/someproj
cvs import: ERROR: cannot mkdir /usr/local/cvsroot/someproj/someproj -- not added: No such file or directory
Then check that the user is in the cvs user's group, and that the sticky bit was set for the cvs group on the /usr/local/cvsroot directory.
The /usr/local/cvsroot/CVSROOT directory created by cvs init includes the cvswrappers file.  You should probabably add a list of your binary file types there (see below).

Creating a CVS Project

Go to the directory where you have your files.  Say /usr/randomproject.
Create a .cvsignore file (note the dot prefix).  On each line, enter the files you don't want to import.  Enter a directory name if you don'twant to import that.   Use wildcards if you want.
e.g. contents could be:
*.jpg
confdir
Create a cvs_setup.sh file.  e.g.:

export CVS_RSH=ssh
export CVSROOT=:ext:yourloginname@yourcvsserver.com:/usr/local/cvsroot
CVS consists of a client program.  And a server.  The CVS_RSH setting tells CVS to use SSH when connecting to the server.  It means you don't have to run anything else on your CVS server other than the SSH daemon (i.e. no pserver, no rsh).   Using SSH also means that all your network traffic will be kept nice and secure.
Run the setup command: . cvs_setup.sh (i.e. dot space cvs_setup.sh)
Now, from inside your project directory, import your files (actually you may just want to check your server's cvswrappers file first, see below): cvs import -m "your import messsage" the_project_name_or_directory_name_i_want_to_use vendor initialtag.  e.g.

cvs import -m "initial import" projectalpha joecoder projectalpha_v_1_0
You should get a message saying something like: No conflicts created by this import.
Doing the import doesn't place the imported files (on your hard disk) under cvs 'control'.  So what you'll often do is move the original files away, and then do a cvs checkout to work with the files you've checked out:
cvs checkout the_project_name
e.g. cvs co uml
If you want the directory you create from the checkout to differ from the project name, try:
cvs co -d yournewdirname uml
Further reading:
https://www.cvshome.org/docs/manual/cvs-1.12.8/cvs_3.html#SEC38
http://www.loria.fr/~molli/fom-serve/cache/159.html

Dealing with Binary Files: cvswrappers

Before importing, make sure that your CVS repository has a decent cvswrappers file (usually on your CVS server at /usr/local/cvsroot/CVSROOT/cvswrappers). This file tells CVS which files are mergeable (when two developers both change the same file) and which files are binary (for CR/LF translation to different platforms).  Without the correct contents in this file, CVS will do things like alter (ruin) the content of gif and jpeg files (first hand experience on that one).

##
# Non-mergeable files
##
*.a -k 'b' -m 'COPY'
*.ai -k 'b' -m 'COPY'
*.bin -k 'b' -m 'COPY'
*.bitmap -k 'b' -m 'COPY'
*.bmp -k 'b' -m 'COPY'
*.BMP -k 'b' -m 'COPY'
*.BPT -k 'b' -m 'COPY'
*.BRO -k 'b' -m 'COPY'
*.class -k 'b' -m 'COPY'
*.dll -k 'b' -m 'COPY'
*.DLL -k 'b' -m 'COPY'
*.doc -k 'b' -m 'COPY'
*.DOC -k 'b' -m 'COPY'
*.dvi -k 'b' -m 'COPY'
*.eps -k 'b' -m 'COPY'
*.EPS -k 'b' -m 'COPY'
*.exe -k 'b' -m 'COPY'
*.EXE -k 'b' -m 'COPY'
*.fm -k 'b' -m 'COPY'
*.gif -k 'b' -m 'COPY'
*.png -k 'b' -m 'COPY'
*.GIF -k 'b' -m 'COPY'
*.gmo -k 'b' -m 'COPY'
*.gz -k 'b' -m 'COPY'
*.hqx -k 'b' -m 'COPY'
*.icns -k 'b' -m 'COPY'
*.ico -k 'b' -m 'COPY'
*.ICO -k 'b' -m 'COPY'
*.image -k 'b' -m 'COPY'
*.ins -k 'b' -m 'COPY'
*.jar -k 'b' -m 'COPY'
*.jpg -k 'b' -m 'COPY'
*.jpeg -k 'b' -m 'COPY'
*.lib -k 'b' -m 'COPY'
*.MAK -k 'b' -m 'COPY'
*.mcp -k 'b' -m 'COPY'
*.o -k 'b' -m 'COPY'
*.obj -k 'b' -m 'COPY'
*.OPN -k 'b' -m 'COPY'
*.pdf -k 'b' -m 'COPY'
*.pgp -k 'b' -m 'COPY'
*.ppt -k 'b' -m 'COPY'
*.prj -k 'b' -m 'COPY'
*.ps -k 'b' -m 'COPY'
*.PS -k 'b' -m 'COPY'
*.psd -k 'b' -m 'COPY'
*.res -k 'b' -m 'COPY'
*.snd -k 'b' -m 'COPY'
*.sit -k 'b' -m 'COPY'
*.tar -k 'b' -m 'COPY'
*.tgz -k 'b' -m 'COPY'
*.tif -k 'b' -m 'COPY'
*.TIF -k 'b' -m 'COPY'
*.tiff -k 'b' -m 'COPY'
*.TIFF -k 'b' -m 'COPY'
*.wordbreak -k 'b' -m 'COPY'
*.xbm -k 'b' -m 'COPY'
*.XBM -k 'b' -m 'COPY'
*.z -k 'b' -m 'COPY'
*.Z -k 'b' -m 'COPY'
*.zip -k 'b' -m 'COPY'
*.ZIP -k 'b' -m 'COPY'

Application Environment Setup Using /etc/profile.d/*

When a user logs in, environment variables are set from various places.  That includes /etc/profile (for all users).
Then all the files in the /etc/profile.d directory.
Then ~/.bash_profile, then ~/.bashrc.
/etc/profile.d/ is a good place to put your application specific setups.  For example, I always use SSH for CVS (cf. RSH).  So I use:
echo "export CVS_RSH=ssh" >> /etc/profile.d/cvs.sh
chmod +x /etc/profile.d/cvs.sh

MQM Practice

Start MQ Manager
strmqm <Queue Manger>
Stop MQ Manager
endmqm <Queue Manager>

========================= Unix Script to Start/Stop QMgrs =======================

#!/sbin/sh
#
# MQM auto startup, shutdown script
#
MQ_DIR=/var/mqm/errors
TMP_FILE=$MQ_DIR/1
MQ_SCRIPT=$MQ_DIR/2
CHLTYPE="SVRCONN|SDR|RCVR|RQSTR"
if [ -f /var/mqm/qmgrs/qm.ini ]
then
  QM=`dspmq | awk -F\( '{print $2}' | sed 's/)//g' | awk '{print $1}'`
#
# Please keep the pathern of the blanks other scrips are using these port numbers.
#
LSNR="ART.QMGR 1415:\
      BING_MGR 1425"
  case "$1" in
  start)
        for q in $QM
        do
          echo "$1ing QM: $q"
          su - mqm -c "strmqm $q"
          runmqsc $q << EOF > $TMP_FILE
            display channel(*) all
EOF
         CHL=`cat $TMP_FILE | grep CHANNEL | grep -v SYSTEM | egrep $CHLTYPE | awk '{print $1}'`
          echo "START CHANNEL('SYSTEM.ADMIN.SVRCONN')" > $MQ_SCRIPT
          for ch in $CHL
          do
            echo "START $ch" >> $MQ_SCRIPT
          done
          echo "DISPLAY CHSTATUS(*)" >> $MQ_SCRIPT
          echo "END" >> $MQ_SCRIPT
          runmqsc $q < $MQ_SCRIPT
        done

        echo $LSNR | awk -F: '{for (i=1; i<=NF; i++) print $i}; END{}' | while read QM PORT
        do
          su - mqm -c "runmqlsr -t TCP -m $QM -p $PORT &"
        done
        su - mqm -c "strmqcsv $q"
        su - mqm -c dspmq
        echo
        echo "shmem segs: `ipcs -m | grep mqm | grep -v grep | wc -l`"
        echo "listeners: `ps -ef | grep runmqlsr | wc -l`"
        echo
        ;;
  stop)
        for q in $QM
        do
          echo "$1ing $q"
          su - mqm -c "endmqm -p $q; endmqlsr -m $q"
        done
        su - mqm -c dspmq
        echo
        echo "shmem segs: `ipcs -m | grep mqm | grep -v grep | wc -l`"
        echo "listeners: `ps -ef | grep runmqlsr | wc -l`"
        echo
        sleep 2
        ID="m s"
        for id in $ID
        do
          for j in `ipcs -$id | grep mqm | awk '{print $2}' | sort | uniq`
          do
            echo "Removing semid $j"
            ipcrm -$id $j
          done
        done
        ;;
  *)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
  esac
else
  exit 0
fi
================================Create QMGR =========================

#!/bin/sh
######################################################################
#
# Usage:
# --------
# sh wssmq.sh { -help } | {  [ -log log_path ]
#                             [ -dl ]
#                             [ -stop ]
#                             -lip local_ip
#                             -lport local_port
#                             -lqm local_q_manager }
#
# Flags:
#    -help: disply usage
#    -log: the log path (default: /tmp/mq_cmd.log)
#    -dl: delete the old MQ manager (default: false)
#    -stop: stop the running MQ manager (default: false)
#    -lip: local MQ manager IP
#    -lport: local MQ manager port
#    -lqm: local MQ manager name
#
#
#######################################################################
#
# Print Usage
#
print_usage()
{
   echo ''
   echo 'GTS MQ creation script'
   echo '------------------------------'
   echo ''
   echo 'Usage:'
   echo '   sh wssmq.sh { -help }'
   echo '        | { [ -dl ]'
   echo '            [ -stop ]'
   echo '            [ -log log_path ]'
   echo '            -lip local_IP'
   echo '            -lport local_port'
   echo '            -lqm local_q_manager }'
   echo ''
   echo 'Flags:'
   echo '   -log: the log path (default: /tmp)'
   echo '   -dl: delete the old MQ manager (default: false)'
   echo '   -stop: stop the running MQ manager (default: false)'
   echo '   -lip: local MQ manager IP'
   echo '   -lport: local MQ manager port'
   echo '   -lqm: local MQ manager name'
   echo '   -help: disply usage'
   echo ''
}
# set default values
dmqm=false
stmqm=false
logdir=/tmp
# parse flags
while [ "${1}" ]
do
   case ${1} in
      "-help")
         print_usage;
         exit 1
         ;;
      "-dl")
         dmqm=true
         shift 1
         ;;
     "-stop")
         stmqm=true
         shift 1
         ;;
      "-log")
         logdir=${2}
         shift 2
         ;;
      "-lip")
         lip=${2}
         shift 2
         ;;
      "-lport")
         lport=${2}
         shift 2
         ;;
      "-lqm")
         lqm=${2}
         shift 2
         ;;
      *)
         echo "Program $0 does not recognize option $1"
         exit 1
         ;;
   esac
done
# check required variables
if [ -z "${lip}" -o -z "${lport}" -o -z "${lqm}" ]; then
   echo "Missing arguments"
   exit 1
fi
echo '********************************************************'
echo "Start MQ creation script: `/usr/ucb/whoami` in host `uname -n`"
echo '********************************************************'
# define script path
script=${logdir}/mqm_cfg_cmd.sh
# define log file
log=${logdir}/mqm_cfg_cmd.log
if [ ${stmqm} = 'true' ]; then
   echo 'Stop GTS MQ manager ...'
   endmqm -p ${lqm}
   endmqlsr -m ${lqm}
   echo 'Done'
fi
if [ ${dmqm} = 'true' ]; then
   echo 'Delete GTS MQ manager ...'
   dltmqm ${lqm}
   echo 'Done'
fi
echo 'Creating GTS MQ manager ...'
crtmqm -ll -lf 32000 -lp 10 -ls 3 -u DEAD.LETTER.QUEUE -ld /var/mqm/share/log -md /var/mqm/share/qmgrs ${lqm}
strmqm -x ${lqm}
nohup runmqlsr -t tcp -p ${lport} -m ${lqm} >/dev/null 2>&1 &
sleep 5
echo 'Done'
echo 'Creating queues and channels ...'
echo > ${script}
# define dead letter queue
 echo "DEFINE QLOCAL('DEAD.LETTER.QUEUE')" >> ${script}
echo "ALTER QMGR DEADQ('DEAD.LETTER.QUEUE')" >> ${script}
# define local queues
echo "DEFINE QLOCAL('GOWEEKEND_DEAL_QUEUE') DESCR ('GTS50UAT')" >> ${script}

echo "DEFINE QLOCAL('EFX_DEAL_QUEUE') DESCR ('EFX Deal Request')" >> ${script}
echo "DEFINE QLOCAL('EFX_DEAL_ACK_QUEUE') DESCR ('EFX Deal Acknowledge')" >> ${script}
echo "DEFINE QLOCAL('EFXGTS_DEAL_ACK_QUEUE') DESCR ('EFX GTS Deal ACK')" >> ${script}

echo "DEFINE QLOCAL('OW_DEAL_QUEUE') DESCR ('OW Deal Request')" >> ${script}
echo "DEFINE QLOCAL('OW_DEAL_ACK_QUEUE') DESCR ('OW Deal Acknowledge')" >> ${script}
echo "DEFINE QLOCAL('DLB_DEAL_QUEUE') DESCR ('DLB Deal Request')" >> ${script}
echo "DEFINE QLOCAL('DLB_DEAL_ACK_QUEUE') DESCR ('DLB Deal Acknowledge')" >> ${script}
echo "DEFINE QLOCAL('DLBGTS_DEAL_ACK_QUEUE') DESCR ('DLB GTS Deal Ack')" >> ${script}
echo "DEFINE QLOCAL('ETM_DEAL_QUEUE') DESCR ('ETM Deal Request')" >> ${script}
echo "DEFINE QLOCAL('ETM_DEAL_ACK_QUEUE') DESCR ('ETM Deal Acknowledge')" >> ${script}
echo "DEFINE QLOCAL('ETMGTS_DEAL_ACK_QUEUE') DESCR ('ETM GTS Deal Ack')" >> ${script}

echo "DEFINE QLOCAL('MXG_DEAL_QUEUE')DESCR ('Outbound MXG deal Queue')" >> ${script}

echo "DEFINE QLOCAL('EFX_ADMIN_QUEUE')" >> ${script}
echo "DEFINE QLOCAL('EFX_ADMIN_ACK_QUEUE')" >> ${script}

# define server connection channel
echo "DEFINE CHANNEL('GTS50UAT_4X_MGR.CHL') CHLTYPE(SVRCONN) " >> ${script}
# define server admin channel
echo "DEFINE CHANNEL('MQEXPLORER') CHLTYPE(SVRCONN) " >> ${script}
# start channels
echo  >> ${script}
echo "START CHANNEL('GTSUAT.SVRCONN')" >> ${script}
echo "START CHANNEL('MQEXPLORER')" >> ${script}
echo  "END" >> ${script}
# run script
runmqsc ${lqm} < ${script} > ${log}
rm -f ${script}
echo "! ! ! ALL DONE ! ! !"

===================== mqmAuth.sh ==================================
#!/bin/ksh
qmgrName=$1
userName=$2
if [ -z "${userName}" ] || [ -z "${qmgrName}" ]; then
  echo "%%MQM-E-SYNTAX, wrong syntax."
  echo "%%MQM-I-USAGE, usage:"
  echo "                     $0 <QManager Name> <user name>"
  exit ${LINENO}
fi
id $userName
if [ $? -ne 0 ]; then
  echo "%%MQM-E-USER, user ${userName} is not found. Please contact `hostname` adminstrator."
  exit ${LINENO}
fi
setmqaut -m ${qmgrName} -t qmgr -g ${userName} +inq +connect +dsp
setmqaut -m ${qmgrName} -n '**' -t queue -g ${userName} +browse +dsp
setmqaut -m ${qmgrName} -n SYSTEM.ADMIN.COMMAND.QUEUE -t  queue -g ${userName} +inq +put +dsp
setmqaut -m ${qmgrName} -n SYSTEM.MQEXPLORER.REPLY.MODEL -t queue  -g ${userName} +inq +browse +get +dsp
setmqaut -m ${qmgrName}  -n SYSTEM.DEFAULT.MODEL.QUEUE -t queue -g ${userName} +inq +browse +get
setmqaut -m ${qmgrName}  -n '**' -t topic -g ${userName} +dsp
setmqaut -m ${qmgrName} -n '**' -t channel -g ${userName} +dsp
setmqaut -m ${qmgrName} -n '**' -t clntconn -g ${userName} +dsp
setmqaut -m ${qmgrName} -n '**' -t authinfo -g ${userName} +dsp
setmqaut -m ${qmgrName} -n '**' -t listener -g ${userName} +dsp
setmqaut -m ${qmgrName} -n '**' -t namelist -g ${userName} +dsp
setmqaut -m ${qmgrName} -n '**' -t process -g ${userName} +dsp
setmqaut -m ${qmgrName} -n '**' -t service -g ${userName} +dsp

LVM Resizing Guide


(19 votes, average 4.95 out of 5)
Written by Tom Hirt   
Friday, 15 May 2009 09:02
Article Index
LVM Resizing Guide
Grow File System
Shrink File System
All Pages

LVM Resizing Overview


In our LVM Configuration KB, we showed how to create a linear mapped logical volume (LV).  In this KB, we are going to build on our LVM knowledge and show you how to resize an existing ext3 file system and it's associate LV.
Note: Procedures for resizing XFS, ResierFS and other volumes may differ.  You should check your documentation for non ext3 volumes before proceeding.  Resizing a file system can also be destructive if not done properly.  You should always make sure you have a backup of your data before attempting a resize!
Logical Volumes can be increased or decreased in size depending on your needs.  However, resizing the LV does not eliminate the need to resize the file system contained within the LV.  This is an important concept to understand since resizing the LV without resizing the file system can cause corruption of your data.
In the following pages, we will guide you through expanding and contracing LV's and their associated file systems.  Let's get to it!



Grow File System


Increasing the size of a file system managed with LVM can be done online (with the file system mounted.)  In order to grow the LV and file system:
  • Check to see if free space exists on the LV that contains the file system
  • Expand the LV if it does not contain enough free space (which could require expanding the volume group if it is out of free space)
  • Grow the file system to utilize all available space on the LV
Lets get started!
    1. First, check the size of the file system to see if it needs expanding

      [root@Linux01 ~]# pwd
      /TCPDumpLV
      [root@Linux01 TCPDumpLV]# df -kh .
      FilesystemSizeUsedAvailUse%Mounted on
      /dev/mapper/TCPDumpVolGRP-TCPDumpLV3.1G2.9G69M98%/TCPDumpLV
      Note: The disk free command shows that we have 65MB available on our file system and that its 98% use.  If we don't take action soon, we risk filling the file system.
    2. Let's find out which Volume Group contains the Logical Volume that holds /dev/mapper/TCPDumpVolGRP-TCPDumpLV

      [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV
      --- Logical volume ---
      LV Name/dev/TCPDumpVolGRP/TCPDumpLV
      VG NameTCPDumpVolGRP
      LV UUIDhYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF
      LV Write Accessread/write
      LV Statusavailable
      # open1
      LV Size3.12 GB
      Current LE100
      Segments1
      Allocationinherit
      Read ahead sectorsauto
      - currently set to256
      Block device253:5
      Note: You can see the volume group for this file system is TCPDumpVolGRP
    3. Let's find out if the volume group TCPDumpVolGRP has available free space to allocate to the logical volume

      [root@Linux01 ~]# vgdisplay TCPDumpVolGRP
      --- Volume group ---
      VG NameTCPDumpVolGRP
      System ID
      Formatlvm2
      Metadata Areas3
      Metadata Sequence No5
      VG Accessread/write
      VG Statusresizable
      MAX LV0
      Cur LV2
      Open LV2
      Max PV0
      Cur PV3
      Act PV3
      VG Size11.91 GB
      PE Size32.00 MB
      Total PE381
      Alloc PE / Size228 / 7.12 GB
      Free PE / Size153 / 4.78 GB
      VG UUID9fWFIS-vDlg-xOW6-Xmb8-Tkrg-GPZw-ZnUZwh
      Note: This volume group has plenty of free space.  If we were out of physical extents, we would have to add additional physical volumes to this volume group before continuing on.
    4. We will now resize the logical volume TCPDumpLV by adding 3GB

      [root@Linux01 TCPDumpLV]# lvresize -L +3GB /dev/TCPDumpVolGRP/TCPDumpLV
      Extending logical volume TCPDumpLV to 6.12 GB
      Logical volume TCPDumpLV successfully resized
      [root@Linux01 TCPDumpLV]#
    5. Confirm the new size of the logical volume

      [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV
      --- Logical volume ---
      LV Name/dev/TCPDumpVolGRP/TCPDumpLV
      VG NameTCPDumpVolGRP
      LV UUIDhYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF
      LV Write Accessread/write
      LV Statusavailable
      # open1
      LV Size6.12 GB
      Current LE196
      Segments2
      Allocationinherit
      Read ahead sectorsauto
      - currently set to256
      Block device253:5

      [root@Linux01 ~]# pwd
      /TCPDumpLV
      [root@Linux01 TCPDumpLV]# df -kh .
      FilesystemSizeUsedAvailUse%Mounted on
      /dev/mapper/TCPDumpVolGRP-TCPDumpLV3.1G2.9G69M98%/TCPDumpLV
      Note: You will notice that although we have increased the size of the logical volume, the size of the file system has been unaffected.
    6. We now need to resize the ext3 file system to utilize the remaining available space within the logical volume

      [root@Linux01 TCPDumpLV]# resize2fs -p /dev/mapper/TCPDumpVolGRP-TCPDumpLV
      resize2fs 1.39 (29-May-2006)
      Filesystem at /dev/mapper/TCPDumpVolGRP-TCPDumpLV is mounted on /TCPDumpLV; on-line resizing required
      Performing an on-line resize of /dev/mapper/TCPDumpVolGRP-TCPDumpLV to 1605632 (4k) blocks.
      The filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV is now 1605632 blocks long.

      [root@Linux01 TCPDumpLV]# df -kh .
      FilesystemSizeUsedAvailUse%Mounted on
      /dev/mapper/TCPDumpVolGRP-TCPDumpLV6.1G2.9G2.9G50%/TCPDumpLV
    Nice work, you just resized your file system while it was online!  Now lets take a look at reducing the size of a file system.



    Shrink File System


    Decreasing the size of a file system managed with LVM must be done off-line (unmounted.)  To shrink the file system and LV:
    • Unmount the file system
    • Run a file system check to ensure the integrity of the volume
    • Shrink the file system
    • Shrink the logical volume
    Note: You cannot shrink the file system beyond the amount of free space that is available on it.  So if the file system you want to shrink has 1GB of free space, you will only be able to shrink the volume by 1GB.  However, logical volumes are not as forgiving.  If you are not careful, you can shrink the LV to a size less than what is required by the file system.  If the LV is resized smaller than what the file system has been resized to, things will go very badly for you.  Did we mention you should backup your data before hand?
    Let's get started!
    1. First, check to see how much space is available

      [root@Linux01 ~]# pwd
      /TCPDumpLV
      [root@Linux01 TCPDumpLV]# df -kh .
      FilesystemSizeUsedAvailUse%Mounted on
      /dev/mapper/TCPDumpVolGRP-TCPDumpLV6.1G922M4.9G16%/TCPDumpLV
      Note: The disk free command shows that we are using 922MB and have 4.9G available on our file system.  Therefore, we can safely shrink the volume to 1.5G (leaving a little bit for overhead) without any issue.
    2. Unmount the file system

      [root@Linux01 TCPDumpLV]# cd /
      [root@Linux01 /]# umount /TCPDumpLV
    3. Check the file system for errors

      [root@Linux01 /]# e2fsck -f /dev/mapper/TCPDumpVolGRP-TCPDumpLV
      e2fsck 1.39 (29-May-2006)
      Pass 1: Checking inodes, blocks, and sizes
      Pass 2: Checking directory structure
      Pass 3: Checking directory connectivity
      Pass 4: Checking reference counts
      Pass 5: Checking group summary information
      /dev/mapper/TCPDumpVolGRP-TCPDumpLV: 13/802816 files (7.7% non-contiguous), 261017/1605632 blocks
      [root@Linux01 /]#
    4. Shrink the file system to 1.5GB

      [root@Linux01 /]# resize2fs /dev/mapper/TCPDumpVolGRP-TCPDumpLV 1500M
      resize2fs 1.39 (29-May-2006)
      Resizing the filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV to 384000 (4k) blocks.
      The filesystem on /dev/mapper/TCPDumpVolGRP-TCPDumpLV is now 384000 blocks long.

      [root@Linux01 /]#
    5. Shrink the logical file system to 1.5GB

      [root@Linux01 /]# lvresize -L 1.5G /dev/TCPDumpVolGRP/TCPDumpLV
      WARNING: Reducing active logical volume to 1.50 GB
      THIS MAY DESTROY YOUR DATA (filesystem etc.)
      Do you really want to reduce TCPDumpLV? [y/n]: y
      Reducing logical volume TCPDumpLV to 1.50 GB
      Logical volume TCPDumpLV successfully resized
      [root@Linux01 /]#
      Note: Special precaution should be taken with this step.  It's possible to reduce the logical volume size by more than the size of the file system.  If you do reduce the LV size by more than what you resized the file system to (from step #4), this will almost certainly end very badly for you.  Ensure the LV is large enough for the file system and that you make a backup before hand!
    6. Verify the new size of the logical volume

      [root@Linux01 ~]# lvdisplay /dev/TCPDumpVolGRP/TCPDumpLV
      --- Logical volume ---
      LV Name/dev/TCPDumpVolGRP/TCPDumpLV
      VG NameTCPDumpVolGRP
      LV UUIDhYQs4t-YtY7-51hl-c4ps-4N6d-2W7h-IidcxF
      LV Write Accessread/write
      LV Statusavailable
      # open0
      LV Size1.50 GB
      Current LE48
      Segments1
      Allocationinherit
      Read ahead sectorsauto
      - currently set to256
      Block device253:5
    7. Remount the file system and verify the new size

      [root@Linux01 /]# mount /dev/TCPDumpVolGRP/TCPDumpLV
      [root@Linux01 /]# cd /TCPDumpLV/
      [root@Linux01 TCPDumpLV]# df -kh .
      FilesystemSizeUsedAvailUse%Mounted on
      /dev/mapper/TCPDumpVolGRP-TCPDumpLV1.5G920M497M65%/TCPDumpLV

    Nice work, you've just resized your LV and it's file systems!  Next up, LVM snapshots!

    Thursday, September 8, 2011

    Administration Console Welcome Page is blank

     

    Technote (troubleshooting)


    Problem(Abstract)

    After logging into and being prompted for a user ID in the Administration Console of IBM® WebSphere® Application Server V6.0. (any modification), only the word "Welcome" is displayed in the upper left hand corner and nothing else is rendered. Re-installing the Administration Console does not seem to solve the problem.

    Cause

    The node-metadata.properties file is improperly written. The deployed features should be in a relative path not absolute.

    Resolving the problem

    First, check if all the folder and files in WAS Root have rigth owner/group and permission.

    Check the following file in your configuration.


    First look at the <WAS_HOME>/profiles/<profilename>/config/cells/<cellname>/nodes/<node name>/node-metadata.properties file.

    Make sure that these are relative paths and not absolute paths.

    For example, this is what was found:
    com.ibm.websphere.deployed.features=/opt/IBM/WebSphere/AppServer/feature
    s/com.ibm.ws.base_6.0.0.0,/opt/IBM/WebSphere/AppServer/features/com.ibm.
    ws.express_6.0.0.0,/opt/IBM/WebSphere/AppServer/features/com.ibm.ws.j2ee
    _6.0.0.0,/opt/IBM/WebSphere/AppServer/features/com.ibm.ws.uddi_6.0.0.0,/
    opt/IBM/WebSphere/AppServer/features/com.ibm.ws.wsgateway_6.0.0.0,


    Whereas this file should contain a relative path like:
    com.ibm.websphere.deployed.features=com.ibm.ws.base_6.0.0.0,com.ibm.ws.e
    xpress_6.0.0.0,com.ibm.ws.j2ee_6.0.0.0,com.ibm.ws.uddi_6.0.0.0,com.ibm.w
    s.wsgateway_6.0.0.0


    If this is the case, then change to the relative path and then clear out the <profile>/wstemp before restarting the server.

    If this does not resolve this issue, contact IBM® Support for additional support. To do this, follow the link below titled "Steps to get support for WebSphere Application Server".

    Sunday, September 4, 2011

    Install and configure CVS on Solaris 10

    1.       Download the binary file from http://ftp.gnu.org/non-gnu/cvs/binary/stable/
    cvs-1.12.13-sol10-x86-local.gz
    2.     Extract downloaded file to a folder, eg. /opt
    #gunzip cvs-1.12.13-sol10-x86-local.gz
    3.     Install CVS
    # pkgadd –d cvs-1.12.13-sol10-x86-local
    4.     Create soft link
    ln -s /usr/local/bin/cvs /usr/bin/cvs
    5.     Create a CVS repository, for example, create the repository in /cvsroot
    #cvs -d /cvsroot init
    This command will create a CVSROOT foler under /cvsroot
    6.     Create user/password for CVS repository
    If you want to use existing Solaris’s user to access CVS, open
    /etc/shadow, copy the user id and password to a file "passwd" under
    /cvsroot/CVSROOT. Edit it with following format
    aniu:jYETQkdxnNkYw
    7.     Add $CVSROOT parameter’s in joey profile
    export CVSROOT=:pserver:aniu@artsolaris:2401:/cvsroot
    8.     6. As CVS use 2401 port to monitor the connection, we need to modify
    serveral configuration files
    - Modify /etc/services to add following line
    cvspserver 2401/tcp
    cvspserver 2401/udp

    9.     Create file cvsinetd and add below line into it
    cvspserver stream tcp nowait root /usr/local/bin/cvs -f --allow-root=/cvsroot pserver
    As inetd in Solaris was changed, so use following command to convert
    the original inetd config
    # inetconv -f -i cvsinetd

    10. #Add the following lines to /var/svc/profile/inetd_services.xml
    11.<service name='network/cvspserver-tcp' version='1' type='service'>
    
    <instance name='default' enabled='true'/>
    
    </service>
    12. #Restart the network

    # svcadm restart svc:/network/inetd:default
    13.  #telnet localhost 2401
    If seeing "Connected to localhost" after running the command, you have
    installed CVS server successfully