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
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: vgs
If you have a hardware fault or other calamity in a HP-UX serviceguard cluster you lose the ability to make incremental changes to the cluster until that node comes back.
If you need to make a change to a cluster in this state and you don’t want to bring down the cluster, you have to do all your changes with one gigantic command line.
Lets say you have a 4 node cluster named cnode1,cnode2,cnode3, and cnode4.
cnode4 suffers a hardware fault and you packages fail over to cnode1-3. But your usage has grown and you have a package that is beating the hardware down and you want to move it from cnode2 to cnode1.
Well you can’t do it incrementally. You have to do it all at once. I recently ran into a situation where I had to modify 37 cluster environment files and the cluster configuration to remove a node cnode4.
That requires you to correctly type a command line that could easily be in excess of 4000 characters. Anybody who knows my typing skills knows this is beyond my abilities on my best day.
So I wrote a little assistant program.
It consists of three files two of which are scripts.
pkg-mod-list (A list of all the package configuration files, full path that need to be modified. It is your choice how to handle the editing. We used ansible last night when we did it in a DR cluster.
Contents …
/etc/cmcluster/nc-package-name/nc-package-name.env
/etc/cmcluster/sc-package-name/sc-package-name.env
Then we have helper scripts which put the command line together.
myclusterV6_prod.conf is the main cluster configuration file with the references to node cnode4 commented out.
cat missing-node-checkconf
MAIN=”cmcheckconf -C /etc/cmcluster/configs/myclusterV6_Prod.conf”
PCMD=””
cat pkg-mod-list | while read -r pfile
do
PCMD=”${PCMD} -P ${pfile}”
### echo “$PCMD”
done
MYCMD=”${MAIN} ${PCMD}”
echo $MYCMD
exec ${MYCMD}
MAIN=”cmapplyconf -C /etc/cmcluster/configs/myclusterV6_Prod.conf”
PCMD=””
cat pkg-mod-list | while read -r pfile
do
PCMD=”${PCMD} -P ${pfile}”
### echo “$PCMD”
done
MYCMD=”${MAIN} ${PCMD}”
echo $MYCMD
exec ${MYCMD}
add device called lvdump1
[root@stlam61p]
:/home/root # lvchange -r n /dev/vg00/lvdump1
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
The Before picture:
BOOTTEST Settings Default Variable OS is not speedy boot aware. Selftest Setting
——— ————–
early_cpu Run this test
late_cpu Run this test
platform Run this test
chipset Run this test
io_hw Run this test
mem_init Run this test
mem_test Run this test
BOOTTEST Settings Default Variable OS is not speedy boot aware. Selftest Setting
Shell> boottest
Shell> boottest mem_test off
Shell> boottest mem_init off
Shell> boottest io_hw off
Shell> boottest chipset off
Shell> boottest platform off
Shell> boottest late_cpu off
Shell> boottest early_cpu off
BOOTTEST Settings Default Variable OS is not speedy boot aware. Selftest Setting
——— ————–
early_cpu Skip this test
late_cpu Skip this test
platform Skip this test
chipset Skip this test
io_hw Skip this test
mem_init Skip this test
mem_test Skip this test
Skip this test Shell>
This cuts boot time over 90%. NOTE: YHou may need to turn this stuff back on to troubleshoot hardware issues.
Troublehooting steps:
1- Remove the /var/opt/perf/ttd.pid and try to start glance again
#rm /var/opt/perf/ttd.pid
#glance
2- If the above fails to fix it then stop and restart Glance as follows
# mwa stop
# midaemon -smdvss 4M -kths 1000 -pids 5000 -p # ps -ef | grep midaemon Make sure the midaemon is running, # mwa start
Modify MWA_START_COMMAND variable in /etc/rc.config.d/ovpa as follows to keep the changes across system reboot.
# grep MWA_START_COMMAND /etc/rc.config.d/ovpa MWA_START_COMMAND=”/opt/perf/bin/midaemon -smdvss 4M -kths 1000 -pids 5000 -p ; /opt/perf/bin/mwa start”
Tags: HP-UX, hpux, hpux 11.31, ia64, patches
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 >
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: HP-UX, hpux, storage ldev, storage ldev works in hpvm guests, xpinfo improvement