msgbartop
Tips and Tricks site for advanced HP-UX Engineers
msgbarbottom

19 Jul 22 Disk issues on HP-UX

So you are having disk problems:

Scenario 1:

You need to build a logical volume on a disk that is in the kernel. You have other issues that will not let you completely replace /etc/lvmtab

mv /etc/lvmtab /etc/lvmtab.save

vgscan -av

You need that disk number 967 to change.

ioscan -NfnCdisk shows the offending device files

 /dev/disk/disk967

 /dev/rdisk/disk967

64000/0xfa00/0x102

What to do?

Force the system to hand out new device files.

rmsf /dev/rdisk/disk967

rmsf /dev/disk/disk967

rmsf -H 64000/0xfa00/0x102

scsimgr -h lun_reset -D /dev/rdisk/disk967

insf -e

Possible alternative:

vgreduce -f /dev/vgname

Trick of the day if you are seing flapping on the SAN. Such as a scenario where deices are giong on and ofline.

ioscan -fN | wc -l ## Gets you a count.

drop the wc -l and you get a pretty detailed look at the HBA/SAN/disk infrastructure.

ioscan -fN

16 Dec 21 Linux vgs port for HPUX (updated to work with vg version 2.2)

A while back, I came across a port of the very nice linux vgs command for HP-UX. A h/t to Juan Manuel Rey (juanmanuel.reyportal@gmail.com) for that original version.

But, upon using it recently, I noted it was not working now that we have some volume groups with vg version 2.2. Here is a modified version of the script that works for version 2.2 volume groups!

#!/sbin/sh
#
# vgs.sh - script to emulate the Linux LVM command vgs in HP-UX 11iv3
#
# (C) 2010 - Juan Manuel Rey (juanmanuel.reyportal@gmail.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#

version="v0.2 2021/12/15"

usage() {
  echo
  echo "VGS for HP-UX ${version}"
  echo
  echo "Usage: vgs [-v vg_name]"
  echo
  exit 1
}

if [ ! "$(uname -r)" = "B.11.31" ]; then
   echo "VGS for HP-UX only works on HP-UX 11iv3"
   exit 1
fi

if [ "$1" ]; then
"vgs" 87 lines, 3053 characters

if [ "$1" ]; then
   case "$1" in
   -v) shift; [  "$1" = "" ] && usage || vg_name=${1};;
   *)  usage;;
   esac
fi

vg_display="vgdisplay -F"
[ ! "${vg_name}" = "" ] && vg_display="vgdisplay -F ${vg_name}"

printf "%-10s %-5s %-5s %-20s %-8s %-6s %-5s\n" VG PVs LVs Status Version VGSize Free

# First, we must determine which VG Version we have

eval ${vg_display} | \
  while IFS=":" read vgdisplay; do
     version=$(echo ${vgdisplay} | awk -F: '{for (i=1;i<=NF;i++) print $i}' | grep vg_version | cut -d= -f2)
     case "$version" in
       2.2) total_pe_index=15
            pe_size_index=13
            free_pe_index=18
            cur_pv_index=9
            ;;
         *) total_pe_index=13
            pe_size_index=12
            free_pe_index=15
            cur_pv_index=8
            ;;
     esac

     echo ${vgdisplay} | cut -d ":" -f 2 | cut -d "=" -f 2 | read status
     if [ "${status}" = "deactivated" ]; then
        status=deactivated
        vg_size=""
        vg_free=""
     else
        echo ${vgdisplay} | cut -d ":" -f 3  | cut -d "=" -f 2 | read status
     else
        echo ${vgdisplay} | cut -d ":" -f 3  | cut -d "=" -f 2 | read status
        echo ${vgdisplay} | cut -d ":" -f ${total_pe_index} | cut -d "=" -f 2 | read total_pe
        echo ${vgdisplay} | cut -d ":" -f ${pe_size_index} | cut -d "=" -f 2 | read pe_size
        echo ${vgdisplay} | cut -d ":" -f ${free_pe_index} | cut -d "=" -f 2 | read free_pe
        vg_size="`/usr/bin/expr $total_pe \* $pe_size / 1024`G"
        vg_free="`/usr/bin/expr $free_pe \* $pe_size / 1024`G"
     fi

     echo ${vgdisplay} | cut -d ":" -f 1 | cut -d "=" -f 2 | cut -d "/" -f 3 | read vg_name
     echo ${vgdisplay} | cut -d ":" -f ${cur_pv_index} | cut -d "=" -f 2 | read pvs
     echo ${vgdisplay} | cut -d ":" -f 5 | cut -d "=" -f 2 | read lvs
     #echo ${vgdisplay} | cut -d ":" -f 19 | cut -d "=" -f 2 | read version
     printf "%-10s %-5s %-5s %-20s %-8s %-6s %-5s\n" "${vg_name}" "${pvs}" "${lvs}" "${status}" "${version}" "${vg_size}" "${vg_free}"
done

Tags:

03 Sep 19 Add new dump device

add device called lvdump1

[root@stlam61p]

:/home/root # lvchange -r n /dev/vg00/lvdump1

Set dump lv to contiguous. SEP

lvcreate -L <size in MB> -n lvdump1 /dev/vg00

# lvchange -C y /dev/vg00/lvdump1
Logical volume “/dev/vg00/lvdump1” has been successfully changed.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# crashconf -a /dev/vg00/lvdump1

:/home/root # crashconf -v

13 Aug 18 Disk is hung by drd nothing works

claimed on ioscan

fuser -c shows clean

drd is insists the disk is busy

DRD crashed causing the issue.

Don’t want to reboot that is an admission of defeat.

 

ERROR: Analysis of file system creation fails.
– Analysis of target fails.
– Analysis of the configuration with disk “/dev/disk/disk143” fails.
– The analysis step for creation of an inactive system image failed.
– The default DRD mount point “/var/opt/drd/mnts/sysimage_001/” cannot be used due to the following error(s):
– The mount point /var/opt/drd/mnts/sysimage_001/ is not an empty directory as required.
* Analyzing For System Image Cloning failed with 1 error.
* DRD operation failed, contents of /var/opt/drd/tmp copied to /var/opt/drd/save.

======= 08/13/18 06:39:16 EDT END Clone System Image failed with 1 error. (user=hcladmin) (jobid=ohonq001)

 

cd /var/opt/drd/mnts/

rm -rf *

scsimgr clear_kmstat -D /dev/rdisk/disk143

scsimgr: Cleared the Kmetric data successfully

DRD nirvana.

If this solution helped you consider making a donation to support the site:


Tags: , , ,

30 Nov 17 No downtme migration of mounted filesystem to new storage type

On LVM 1.0 Volume group, the task is no downtime storage migration.
 Hitachi to Pure Solid State storage. Mirror/UX required.
 Disks are almostthe same size:

dbrestore:root > diskinfo /dev/rdisk/disk42
 SCSI describe of /dev/rdisk/disk42:
 vendor: HITACHI
 product id: OPEN-V
 type: direct access
 size: 16777216 Kbytes
 bytes per sector: 512
 dbrestore:root > diskinfo /dev/rdisk/disk52
 SCSI describe of /dev/rdisk/disk52:
 vendor: PURE
 product id: FlashArray
 type: direct access
 size: 10485760 Kbytes
 bytes per sector: 512

pvcreate /dev/rdisk/disk52
 vgextend /dev/vgtest /dev/disk/disk52

Before state:
 dbrestore:root > vgdisplay -v vgtest
 --- Volume groups ---
 VG Name /dev/vgtest
 VG Write Access read/write
 VG Status available
 Max LV 255
 Cur LV 1
 Open LV 1
 Max PV 16
 Cur PV 2
 Act PV 2
 Max PE per PV 4095
 VGDA 4
 PE Size (Mbytes) 4
 Total PE 6654
 Alloc PE 1024
 Free PE 5630
 Total PVG 0
 Total Spare PVs 0
 Total Spare PVs in use 0
 VG Version 1.0
 VG Max Size 262080m
 VG Max Extents 65520

--- Logical volumes ---
 LV Name /dev/vgtest/lvtest
 LV Status available/syncd
 LV Size (Mbytes) 4096
 Current LE 1024
 Allocated PE 1024
 Used PV 1

--- Physical volumes ---
 PV Name /dev/disk/disk42
 PV Status available
 Total PE 4095
 Free PE 4095
 Autoswitch On
 Proactive Polling On

PV Name /dev/disk/disk52
 PV Status available
 Total PE 2559
 Free PE 1535
 Autoswitch On
 Proactive Polling On

dbrestore:root > ioscan -NfnCdisk /dev/disk/disk42
 Class I H/W Path Driver S/W State H/W Type Description
 ===================================================================
 disk 42 64000/0xfa00/0x21 esdisk CLAIMED DEVICE HITACHI OPEN-V
 /dev/disk/disk42 /dev/rdisk/disk42
 dbrestore:root > ioscan -NfnCdisk /dev/disk/disk52
 Class I H/W Path Driver S/W State H/W Type Description
 ===================================================================
 disk 52 64000/0xfa00/0x35 esdisk CLAIMED DEVICE PURE FlashArray
 /dev/disk/disk52 /dev/rdisk/disk52
 dbrestore:root > bdf | grep test
 /dev/vgtest/lvtest 4194304 19544 3913845 0% /test
 dbrestore:root > lvdisplay -v /dev/vgtest/lvtest
 --- Logical volumes ---
 LV Name /dev/vgtest/lvtest
 VG Name /dev/vgtest
 LV Permission read/write
 LV Status available/syncd
 Mirror copies 0
 Consistency Recovery MWC
 Schedule parallel
 LV Size (Mbytes) 4096
 Current LE 1024
 Allocated PE 1024
 Stripes 0
 Stripe Size (Kbytes) 0
 Bad block on
 Allocation strict
 IO Timeout (Seconds) default

--- Distribution of logical volume ---
 PV Name LE on PV PE on PV
 /dev/disk/disk42 1024 1024

--- Logical extents ---
 LE PV1 PE1 Status 1
 00000 /dev/disk/disk42 00000 current
 00001 /dev/disk/disk42 00001 current
 00002 /dev/disk/disk42 00002 current
 ...
 01022 /dev/disk/disk42 01022 current
 01023 /dev/disk/disk42 01023 current

dbrestore:root > lvextend -m 1 /dev/vgtest/lvtest /dev/disk/disk52
 The newly allocated mirrors are now being synchronized.This operation will
 take some time. Please wait ....
 Logical volume "/dev/vgtest/lvtest" has been successfully extended.
 Volume Group configuration for /dev/vgtest has been saved in /etc/lvmconf/vgtest.conf
 dbrestore:root > lvdisplay -v /dev/vgtest/lvtest
 --- Logical volumes ---
 LV Name /dev/vgtest/lvtest
 VG Name /dev/vgtest
 LV Permission read/write
 LV Status available/syncd
 Mirror copies 1
 Consistency Recovery MWC
 Schedule parallel
 LV Size (Mbytes) 4096
 Current LE 1024
 Allocated PE 2048
 Stripes 0
 Stripe Size (Kbytes) 0
 Bad block on
 Allocation strict
 IO Timeout (Seconds) default

--- Distribution of logical volume ---
 PV Name LE on PV PE on PV
 /dev/disk/disk42 1024 1024
 /dev/disk/disk52 1024 1024

--- Logical extents ---
 LE PV1 PE1 Status 1 PV2 PE2 Status 2
 00000 /dev/disk/disk42 00000 current /dev/disk/disk52 00000 current
 00001 /dev/disk/disk42 00001 current /dev/disk/disk52 00001 current
 00002 /dev/disk/disk42 00002 current /dev/disk/disk52 00002 current
 ...
 01023 /dev/disk/disk42 01023 current /dev/disk/disk52 01023 current

dbrestore:root > bdf | grep test
 /dev/vgtest/lvtest 4194304 19544 3913845 0% /test
 dbrestore:root > lvreduce -m 0 /dev/vgtest/lvtest /dev/disk/disk42
 Logical volume "/dev/vgtest/lvtest" has been successfully reduced.
 Volume Group configuration for /dev/vgtest has been saved in /etc/lvmconf/vgtest.conf
 dbrestore:root > bdf | grep test
 /dev/vgtest/lvtest 4194304 19544 3913845 0% /test
 dbrestore:root > lvdisplay -v /dev/vgtest/lvtest
 --- Logical volumes ---
 LV Name /dev/vgtest/lvtest
 VG Name /dev/vgtest
 LV Permission read/write
 LV Status available/syncd
 Mirror copies 0
 Consistency Recovery MWC
 Schedule parallel
 LV Size (Mbytes) 4096
 Current LE 1024
 Allocated PE 1024
 Stripes 0
 Stripe Size (Kbytes) 0
 Bad block on
 Allocation strict
 IO Timeout (Seconds) default

--- Distribution of logical volume ---
 PV Name LE on PV PE on PV
 /dev/disk/disk52 1024 1024

--- Logical extents ---
 LE PV1 PE1 Status 1
 00000 /dev/disk/disk52 00000 current
 00001 /dev/disk/disk52 00001 current

...
 01023 /dev/disk/disk52 01023 current

dbrestore:root > bdf | grep test
 /dev/vgtest/lvtest 4194304 19544 3913845 0% /test
 dbrestore:root >

Tags: , ,

28 Nov 17 An xpinfo that works in hpvm guests and on non Hitachi storage

Hitachi shops faced annoyance times two:
1. xpinfo does not work on non-Hitachi storage for example Pure storage
2. xpinfo does not work on hpvm guests depending on how the storage is passed through from the hpvm host

I now present xpinfonew which though raw and unfnished
The output:

myserv0:root > ./xpinfonew
Device path ldev
==========================================================================
/dev/rdisk/disk111 =:=
/dev/rdisk/disk12 30:86
/dev/rdisk/disk172 03:f3
/dev/rdisk/disk215 46:2c
/dev/rdisk/disk216 46:30
/dev/rdisk/disk217 46:34
/dev/rdisk/disk218 46:38
/dev/rdisk/disk219 46:28
/dev/rdisk/disk220 46:25
/dev/rdisk/disk221 46:27
/dev/rdisk/disk222 46:2a
/dev/rdisk/disk223 46:2e
/dev/rdisk/disk224 46:32
/dev/rdisk/disk225 46:2b
/dev/rdisk/disk226 46:2f
/dev/rdisk/disk227 46:33
/dev/rdisk/disk237 46:37
/dev/rdisk/disk238 46:36
/dev/rdisk/disk239 46:26
/dev/rdisk/disk240 46:29
/dev/rdisk/disk241 46:2d
/dev/rdisk/disk242 46:31
/dev/rdisk/disk243 46:35
/dev/rdisk/disk244 46:39
/dev/rdisk/disk4 aa:bf
/dev/rdisk/disk5 8b:c3
/dev/rdisk/disk6 03:a6
/dev/rdisk/disk9 01:00

myserv0:root > ./xpinfonew raw
Device path ldev
==========================================================================
/dev/rdisk/disk111 =
/dev/rdisk/disk12 3086
/dev/rdisk/disk172 03f3
/dev/rdisk/disk215 462c
/dev/rdisk/disk216 4630
/dev/rdisk/disk217 4634
/dev/rdisk/disk218 4638
/dev/rdisk/disk219 4628
/dev/rdisk/disk220 4625
/dev/rdisk/disk221 4627
/dev/rdisk/disk222 462a
/dev/rdisk/disk223 462e
/dev/rdisk/disk224 4632
/dev/rdisk/disk225 462b
/dev/rdisk/disk226 462f
/dev/rdisk/disk227 4633
/dev/rdisk/disk237 4637
/dev/rdisk/disk238 4636
/dev/rdisk/disk239 4626
/dev/rdisk/disk240 4629
/dev/rdisk/disk241 462d
/dev/rdisk/disk242 4631
/dev/rdisk/disk243 4635
/dev/rdisk/disk244 4639
/dev/rdisk/disk4 aabf
/dev/rdisk/disk5 8bc3
/dev/rdisk/disk6 03a6
/dev/rdisk/disk9 0100

cat xpinfonew
#!/bin/ksh
# Get ldev from any disk regardless of storage provider
#
# 10/26/2017 Steven “Shmuel” Protter steven.protter@hcl.com
#

echo “Device path \t\t ldev ”
echo “==========================================================================”

ioscan -NfnCdisk | awk ‘/rdisk/{ print $(NF) }’ | awk -F_ ‘{ print $1 }’ | sort -u |while read -r dv
do
ldev=$(/var/adm/bin/getldev.ksh ${dv} ${1} );
echo “${dv} \t ${ldev}”
done

The code:
cat /var/adm/bin/getldev.ksh
#!/bin/ksh
# Get ldev from any disk regardless of storage provider
#
# 10/26/2017 Steven “Shmuel” Protter steven.protter@hcl.com
#
argies=$#
if [ $argies -eq 0 ]
then
echo “———— 1 argument required device path ex: /dev/rdisk/disk101 ————-”
exit 1
fi
dv=$1
fmt=$2
## /usr/sbin/scsimgr lun_map -D ${dv} | awk ‘/World Wide Identifier/{ print $(NF) }’
rldev=$(/usr/sbin/scsimgr lun_map -D ${dv} | awk ‘/World Wide Identifier/{ print substr ( $NF, length($NF) – 3, length($NF) ) }’);

l1=$(echo ${rldev} | awk ‘{ print substr ( $NF, length($NF) – 3, 2 ) }’);
l2=$(echo ${rldev} | awk ‘{ print substr ( $NF, length($NF) – 1, length($NF) ) }’);

### echo “raw: ${rldev} l1: ${l1} l2: ${l2} …”
if [ “$fmt” = “raw” ]
then
echo ${rldev}
else
echo “${l1}:${l2}”
fi

Should work on any SAN based storage

Tags: , , , ,

24 Jul 15 Single user vg00 reconfiguration for a san boot hp-ux system

San boot system.

HBA has to be replaced.

Then you have to boot single user mode to re-establish all your paths.

Procedure authored by my colleague Mahesh Koduru

Before you start make sure you have a current map file hosted on root filesystem.

“Reboot the server and follow these steps :
Interrupt the boot and boot the system in maintenance mode.

fs0:\EFI\HPUX> hpux

HPUX> boot -lm –lq vmunix This will bring the System into Maintance mod

#vgdisplay vg00 The VG should be in deactivated Mod

#ll /dev/*/group Collect the Group file

#vgexport -p -s -m vg00.map /dev/vg00 Keep the Map file in present directory , ie root

# ll vg00.map
#vgexport -v /dev/vg00

#mkdir -m 755 /dev/vg00
#mknod /dev/vg00/group c 64 0x030000 ##This is an example your major/minor number may vary
#vgimport -s -N -m vg00.map /dev/vg00 ## The -N is B.11.31 only to convert to agile storage
#vgchange -a y vg00
#mount -a Mount only Root filesystems

#setboot Check and correct setboot issues

#lvlnboot -v vg00 Check and correct lvlnboot issues , lvrmboot command can be used if needed

#/usr/sbin/lvlnboot -v
# lvlnboot -r /dev/vg00 Execute for fixing Boot Labels
# lvlnboot -r /dev/vg00/lvol3
# lvlnboot -b /dev/vg00/lvol1
# lvlnboot -s /dev/vg00/lvol2
# lvlnboot -d /dev/vg00/lvol2
# lvlnboot -v
# lvlnboot -R

Note: Comment the swap in fstab and then issue below command.
# shutdown -ry 0

30 Oct 14 EFI compatible ioscan: Tip of the day

Ever had a problem equating your disk device output for boot disks to what you see on the EFI prompt?

 

map -r

?????

# ioscan -fneCdisk

Class     I  H/W Path  Driver S/W State   H/W Type     Description
==================================================================
disk      0  0/2/1/0.0.0.0.0          sdisk   CLAIMED     DEVICE       HP      DG0300BALVP
/dev/dsk/c0t0d0     /dev/dsk/c0t0d0s3   /dev/rdsk/c0t0d0s2
/dev/dsk/c0t0d0s1   /dev/rdsk/c0t0d0    /dev/rdsk/c0t0d0s3
/dev/dsk/c0t0d0s2   /dev/rdsk/c0t0d0s1
Acpi(HWP0002,PNP0A03,200)/Pci(1|0)/Sas(Addr5000C5000A9C4FC9, Lun0)/HD(Part1,SigD061ACEA-862A-11DE-8000-D6217B60E588)/\EFI\HPUX\HPUX.EFI

Note: EFI is not agile aware you get nothing useful by trying ioscan -NfneCdisk

Tags: , , ,

29 Oct 14 Puzzle of the day. Strict logical volume prevents you from extending a filesystem

Thanks to Veerappan Dhandapani of HCL Technologies for bringing me this problem

You have 50 GB free in the volume group.

You try to extend the logical volume and you cant.

Basics:

1) bdf is the tool for measuring filesystem size not logical volume size

2)lvdisplay is the tool for measuring logical volume size.

Steps:

1) Extend the logical volume. That is why the previous two number points are important. In process after extending the logical volume size the lv size and file system size are not equal

2) Extend the file system.

root@mybox# vgdisplay -v vgdata | grep -i “Free PE”
Free PE 1784
Free PE 511
Free PE 0
Free PE 0
Free PE 0
Free PE 0
Free PE 1273
Free PE 0

root@mybox# lvdisplay /dev/vgdata/lv_prod_datastaging
— Logical volumes —
LV Name /dev/vgdata/lv_prod_datastaging
VG Name /dev/vgdata
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 245760
Current LE 7680
Allocated PE 7680
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation PVG-strict
IO Timeout (Seconds) default

root@mybox# lvextend -L 278528 /dev/vgdata/lv_prod_datastaging
lvextend: Not enough free physical extents available.

The problem here is the allocation policy.

lvchange -C n -s n /dev/vgdata/lv_prod_datastaging

See the man page for details. -C is for contiguous -s is for strict allocation.

We changed both to n(o).

Off camera we extended the logcal volume

lvdisplay /dev/vgdata/lv_prod_datastaging

— Logical volumes —
LV Name                     /dev/vgdata/lv_prod_datastaging
VG Name                     /dev/vgdata
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    parallel
LV Size (Mbytes)            302848
Current LE                  9464
Allocated PE                9464
Stripes                     0
Stripe Size (Kbytes)        0
Bad block                   on
Allocation                  non-strict
IO Timeout (Seconds)        default

We get the size from the logical volume size to feed into the Online JFS extend command so we do not have to do math.

fsadm -F vxfs -b 302848m /prod/datastaging

bdfmegs is Bill Hassell’s new and improved bdf

/var/adm/bin/bdfmegs /prod/datastaging
File-System                      Mbytes    Used   Avail %Used Mounted on
/dev/vgdata/lv_prod_datastaging   310.1g  215.7g   94.0g  70% /prod/datastaging

 

 

Tags: , , , , , , ,

29 Aug 14 HPVM storage discovery & passthrough

This applies to hpvm, definitely version 4.00, probably all the way through version 6.2. HP-UX 11.31

 

You have a HPVM host named hpvm1 and it has a guest dguest1

 

Virtual Machine Name VM # Type OS Type State     #VCPUs #Devs #Nets Memory

==================== ===== ==== ======= ========= ====== ===== ===== =======

dguest0                 9 SH   HPUX   On (OS)        4   41     4   48 GB

dguest1                 8 SH   HPUX   On (OS)       4   41     4   48 GB

 

Storage team presents you the storage.

ioscan -Nfncdisk (or)

ioscan -fnCdisk

Disk turns out to be disk 5

hpvmmodify -p 8 -a disk:avio_stor::disk:/dev/rdisk/disk5

To pull back disk288 from a guest on:

rmsf -k -H <hardware path from ioscan -NfnCdisk>

hpvmmodify -p 8 -d disk:avio_stor::disk:/dev/rdisk/disk288

 

WhatsApp chat