vicker313 tech blog

June 8, 2011

Rebuild Partition after Change Hard Disk in Disk Array of HPUX Machine

Filed under: HPUX — Tags: , , , — vicker313 @ 10:38 pm

A little experience on dealing with Disk Array in HPUX machine to be shared.

It is happened at an old HPUX machine with disk array attached. After 2 of the hard disks in the disk array are being replaced, the new hard disks cannot be seen in SAM. To discover back the missing hard disks, issue the following command:

armdiscover <array alias>

After the command, you should able to see the hard disks in SAM, and even can see the unmounted partitions. However you wouldn’t able to do anything with it, either mount it, remove it or recreate it. You should get some errors like “can’t find /dev/dsk/cxtxdx”. Then issue the following command:

armdsp -s <array alias>

This command will show the hard disks path in the disk array. You will see that the path is not the same inside the error. The unmounted partitions are actually still referring to the old hard disk path, where you need to remove it using the following command:

vgreduce -l /dev/vgxx /dev/dsk/cxtxdx

You must include “-l” in the command to remove the missing path. After that you need to add back the actual hard disk path either using SAM or vgextend command, and everything should be back to normal.

August 29, 2010

Enable Telnet and SSH at HPUX

Filed under: HPUX — Tags: , , — vicker313 @ 8:18 am

Aside from access through console port, HPUX like other Unix or Linux, can be accessed through Telnet or SSH. If some how you cannot access your HPUX through these 2 methods, it may be either the service is not started or the firewall of the machine blocking your way. Solutions below are tried at HPUX 11.3.

To start the Telnet Service:

  1. Edit /etc/inetd.conf, search for keyword “telnet”
  2. If you see the line is commented (hash in front), uncomment it by removing the hash sign
  3. Issue command “inetd -c” to reconfigure, now the telnet service should be up.

However if you still unable to access through Telnet, try to disable the firewall by issuing this command:

ipfilter -d

In my case, after doing these 2 solutions, I able to access through either telnet or ssh.

July 1, 2009

Add header to printout in HPUX using not JetDirect

Filed under: HPUX — Tags: , — vicker313 @ 8:00 am

This post is continue from Add header to printout in HPUX using JetDirect, if you’re not using JetDirect but other print server such as DLINK, you might use method below to set your printout header:

  1. Add your queues using System Administrator Manager (SAM): sam
  2. Go to our destination: cd /usr/bin.
  3. Create a file called enbanner. This is used to set which queue to print out header and which don’t, simply 1 stand for yes and 0 stand for no, and it is space sensitive (10 character space for the queue name). Here is the sample:
    prt1      1
    prt2      0
  4. You can found an execution file called lp, rename it to lporig: mv lp lporig.
  5. create a text file called lp and put in the following code:
    #!/sbin/sh
    TEMP=/tmp/printmp
    printer=`echo $1 | /usr/bin/cut -b 3-100`
    enbanner=`cat /usr/bin/enbanner | grep $printer | cut -c11`
    if [ `expr $enbanner` != 0 ]
    then
    /usr/bin/lp2 $1 $2 $TEMP
    /usr/bin/lporig $1 $TEMP $2
    rm $TEMP
    else
    /usr/bin/lporig $1 $2
    fi
  6. create a text file called lp2 and put in the following code:
    #!/bin/sh
    fname=$2
    TEMP=$3
    printer=`echo $1 | /usr/bin/cut -b 3-100`


    do_banner()
    {
    # Print the standard header
    banner TESTING
    account=`whoami`
    banner $account
    banner `basename $fname`
    echo "\n"
    reqque=`cat /var/spool/lp/seqfile`
    reqqueadd=`expr $reqque + 1`
    reqid=$printer-$reqqueadd
    echo "Request id: $reqid Printer: `basename $printer`\n"
    date
    echo "\n"

    echo "\f\r\c"
    }

    echo "" > $TEMP
    do_banner >> $TEMP
  7. Then make lp and lp2 executable:
    chmod 777 lp
    chmod 777 lp2
  8. Now you can try to print out the header, depend on the setting at enbanner.

June 25, 2009

Add header to printout in HPUX using JetDirect

Filed under: HPUX — Tags: , , , — vicker313 @ 8:00 am

In HPUX, we use LP command to print text file, for example lp -dprt1 printme.txt, where prt1 is the LP destination name (or also known as queue name) and printme.txt is the file to be printed.

If the print server used is a HP JetDirect, we can set the printout header using the HPPI utility:

  1. Install the HP JetDirect  Installer (in HPUX 11iv3, the installation file is named as HP11e134.SD).
  2. Then copy /usr/spool/lp/model/hp2560 to /opt/hpnpl/sh.
  3. Run HPPI (HP Printer Installer) by typing hppi or /opt/hpnpl/bin/hppi.
  4. Select option 1 (Spooler Administration) then option 1 again (Add printer to local spooler).
  5. Type in print server IP address.
  6. Type in the LP destination name (option 1) then select option 5 (additional printer configuration).
  7. Type in hp2560 in Model Script (option 1, there is actually a list of model script for you to select but you won’t find hp2560 in the list) then continue for the rest.
  8. Finally you can find a file named exactly like the queue name in /etc/lp/interface/model.orig. You can add or modify a function called do_banner() in order to add a customized printout header.

June 23, 2009

Remote access tape drive in another HPUX server

Filed under: HPUX — Tags: , , , , , — vicker313 @ 10:41 pm

Below is a list of TAR and CPIO command integrated with REMSH command in order to remote access tape drive in another HPUX server. Refer Tar and Untar tape drive in another HPUX server to setup the server before try the commands below.

  • CPIO into tape: find /dir/or/files/to/cpio -print | cpio -oacvB | remsh OLDSERVER 'dd of=/dev/rmt/0m bs=64b'
  • Verify CPIO tape: remsh OLDSERVER 'dd if=/dev/rmt/0m bs=64b' | (cpio -itcvB)
  • CPIO from tape: remsh OLDSERVER 'dd if=/dev/rmt/0m bs=64b' | (cpio -iacvBdum)
  • TAR into tape: (tar -cvfb - 64 /dir/or/files/to/tar) | remsh OLDSERVER 'dd of=/dev/rmt/0m bs=64b'
  • Verify TAR tape: remsh OLDSERVER 'dd if=/dev/rmt/0m bs=64b' | (tar -tvfb - 64)
  • UNTAR from tape: remsh OLDSERVER 'dd if=/dev/rmt/0m bs=64b' | (tar -xvpfb - 64)

May 29, 2009

Tar and Untar tape drive in another HPUX server

Filed under: HPUX — Tags: , , , , — vicker313 @ 10:46 pm

There is situation when you have a new HPUX server and then you need to access the old tape that is not supported on the new tape drive. If there is extra SCSI port on the server, definitely you can move the old tape drive to the new server. But when there is no extra SCSI port and you don’t want to buy extra SCSI card, or the old tape drive is needed to be attached to the old server, you still can access the old tape drive using “remsh” command.

We assume the new server’s host name is newserver, while the old server’s host name is oldserver:

  1. Decide a user login to be used to access the old tape drive, let’s said james.
  2. Ensure that both servers have that particular user login (with same password).
  3. Add the host names of both servers into both hosts file (/etc/hosts), for example:
    192.168.0.1 oldserver
    192.168.0.2 newserver
  4. At old server, create or edit the .rhosts file at the home directory of that particular user by adding the following line:
    newserver james
  5. To untar files from old tape drive on old server, use this command:
    remsh oldserver dd if=/dev/rmt/0m bs=64b|(cd /location/to/untar;tar -xvpfb - 64)
  6. While to tar files into the old tape drive, use this command:
    tar -cvpfb - 64|remsh oldserver dd of=/dev/rmt/0m bs=64b

Refer Remote access tape drive in another HPUX server for extra commands.

May 11, 2009

Set mirroring in HPUX using MirrorDisk

Filed under: HPUX — Tags: , — vicker313 @ 12:11 pm

HPUX 11iv3 has a feature called MirrorDisk that enable user to do software mirroring, basically is integrated with LVM. However you need to pay extra in order to use it. After installing this feature, follow steps below to mirror the disks (assume the new disk as c2t2d0):

  1. Create physical volume for new disk:
    pvcreate -f -B /dev/rdsk/c2t2d0
  2. Add disk to current root volume group.
    vgextend /dev/vg00 /dev/dsk/c2t2d0
  3. Make new disk bootable.
    mkboot /dev/rdsk/c2t2d0
  4. Copy correct AUTO file into new LIF area.
    mkboot -a "hpux -lq (;0)/vmunix" /dev/rdsk/c2t2d0
  5. Here is the part to mirror up the logical volume, boot (stand) logical volume need to be done first so that it occupies the first contiguous set of extends on the new disk. Normally logical volume 1 is for stand, 2 is for swap and 3 is for root.
    lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c2t2d0
    lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c2t2d0
    lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c2t2d0
    lvextend -m 1 /dev/vg00/lvol4 /dev/dsk/c2t2d0
    lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/c2t2d0
    lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/c2t2d0
    lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/c2t2d0
    lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c2t2d0
  6. Update the boot information contained in BDRA for the mirror copies of boot, root and primary swap.
    lvlnboot -b /dev/vg00/lvol1
    lvlnboot -v -r /dev/vg00/lvol3
    lvlnboot -s /dev/vg00/lvol2
  7. Check if the BDRA is correct.
    lvlnboot -R /dev/vg00
  8. Verify if the mirrors were properly created.
    lvlnboot -v

After finish all the steps, try to restart the server and boot from the new disk. If server is able to boot, it means the mirroring setup is success.

Create a free website or blog at WordPress.com.