You stand up a new HP-UX host. sudo and ldap won’t work.
You know it should have been built into the Golden image but you never had time. Your organization requires sudo and ldap.
Temporary procedure to restore ldap and sudo functionality.
HP-UX 11.31 Itanium
Step 1: Log on to a working production box.
cd /etc/opt/ldapux
scp -rp * working_host:/$PWD
scp -p /etc/sudoers targethost:/etc
scp –p /sbin/init.d/ ldapclientd.rc targethost:/sbin/init.d
From the HP-UX Veritas Administration guide, buried on page 106
This example shows how to create an LVM root disk on physical disk c0t1d0
after removing the existing LVM root disk configuration from that disk.
BOOTBG=$(vxdg bootdg)
vxprint -htg $BOOTDG | grep ^dm
dm rootdisk01 disk233_p2 auto 1024 142450592 –
dm rootmirr disk234_p2 auto 1024 142450592 –
# You get the boot disk from this command. Break off the s2 if you are using legacy devices you can use them or the agile SDF devices.
# You may need to use vxbrk_mirror to break the mirror. Make sure you know which disk you are booted from. Check syslog to be sure. setboot is not a good indicator.
# Due to a wordpress error I’ve been forced to take the path etc vx bin out of the commands. I will fix this when wordpress stops blowing chunks on this data. Where there are spaces there need to be slashes.
# etc vx bin vxdestroy_lvmroot -v c0t1d0
# etc vx bin vxres_lvmroot -v -b c0t1d0
The -b option to vxres_lvmroot sets c0t1d0 as the primary boot device.
As these operations can take some time, the verbose option, -v, is specified to
indicate how far the operation has progressed.
This command takes care of setboot and all details. Then just boot from the console.
This procedure does not remove VxVM software. The daemon still runs. But your system now boots LVM and that makes using Dynamic Root Disk (DRD) much easier.
Tags: Capacity Planning, forums.itrc.hp.com, high capacity volume group, Ignite-UX, patching, superdome, system migration
Create a partition description file
(Need to update the EFI and HPSP size below according to the other root disk partition’s size)
This examples is where the new disk is disk85. Applies only to HP-UX 11.31 with VxVM as boot drive manager.
# vi /tmp/efipart
3
EFI 500MB
HPUX 100%
HPSP 400MB
Use the idisk(1M) command to partition the disk according to this file
# idisk -wf /tmp/efipart /dev/rdisk/disk85
Write EFI info to the EFI partition on the disk
# mkboot -e -l /dev/rdisk/disk85
Confirm the AUTO file entry is intact It should be “boot vmunix”
# efi_cp -d /dev/rdisk/disk85_p1 -u /EFI/HPUX/AUTO /tmp/efi; cat /tmp/efi
If found any difference, edit /tmp/efi file as below to update the entry “boot vmunix”
#echo “boot vmunix ” > /tmp/efi
Update auto file
#efi_cp -d /dev/rdisk/disk85_p1 /tmp/efi /EFI/HPUX/AUTO
Confirm the AUTO file entry again, It should be “boot vmunix”
# efi_cp -d /dev/rdisk/disk85_p1 -u /EFI/HPUX/AUTO /tmp/efi; cat /tmp/efi
Initialize the disk as VXVM boot disk
#### vxdisksetup -iB disk85_p2 ((lives in etc vx bin slashes removed due to Word Press error))
Add the disk to the existing rootdg
# vxdg -g rootdg adddisk rootdisk02=disk85_p2
Write Volume Manager volume information to the LABEL file:
# /opt/VRTS/bin/vxbootsetup rootdisk02
Display the LIF and Volume Manager label information:
# vxvmboot -v /dev/rdisk/disk85
Check the Mirror status ( Each volume should be with two plex )
$ vxprint –htg rootdg |egrep –i “^v|^pl”
Tags: Capacity Planning, high capacity volume group, HP-UX, LVM, software mirror
Thanks to Jibn Antony of the Best Buy IDC team for validating.
So who cares what the root shell is? You do if you try to boot your system into single user mode with root shell changed to a shared executable shell, you will find out the hard way. The system won’t boot.
swlist -l fileset -a state | grep -v config | sed ‘/^#/d’
Output looks like this:
PHCO_36551.CORE2-64SLIB transient
PHCO_36551.CORE2-SHLIBS transient
Look for stuff that is in state installed instead of configured.
swconfig \* or swconfig PHCO_36551 may fix the issue.
Tags: definition of patch type., patches, patching
HP-UX 11.23
setboot provides output only including the hardware path (ioscan -H).
When calculating DRD clone targets and such you need the regular legacy device path.
Here is a converter, built with a little help from JRF on the ITRC forums.
First get the setboot path. Might want to use the full path of the setboot command in practice.
pboot=$(setboot | grep ^Primary | awk ‘{ print $NF }’);
aboot=$(setboot | grep ^Alternate |awk ‘{ print $NF}’);
abootdisk=$(ioscan -kfnCdisk | awk -v aboot=${aboot} ‘/aboot/ $0~aboot {getline;print aboot,$2}’ | awk ‘{ print $2 }’);
pbootdisk=$(ioscan -kfnCdisk | awk -v aboot=${pboot} ‘/pboot/ $0~pboot {getline;print pboot,$2}’ | awk ‘{ print $2 }’);
The slick part is getting the variable in and out of awk.
Uses ioscan.
Tags: fiber channel adaptor, high capacity volume group, integrity, system migration
# vi /tmp/idf
3
EFI 500MB
HPUX 100%
HPSP 400MB
Use the idisk command to initialize:
idisk -wf /tmp/idf /dev/rdsk/disk8
Replace disk with the disk you intend to use.
insf -e -C disk
# May need to be used in advance to insure the device is recognized.
Tags: crash dump, high capacity volume group, HP-UX, hpux, ia64, Ignite-UX, superdome
Lets say I have a list of servers a mile long to visit. Got a help desk request with the servers listed separated by commas.
server1,server2,server3
Lets say It is actually about 30 or 40 servers and I’m too lazy to edit the list
echo “server1,server2,server3” > olist
awk -F, -v nr=1 ‘{ for (x=nr; x<=NF; x++) {printf $x ” \n”; }; print ” ” }’ olist
Output:
server1
server2
server3
Plug and play time here, you can take care of any delimited format like this.
Spaces input by wordpress (thanks)
I needed to update documentation and I needed more information that my prior syslayout.sh script provided on fiber.
# Improvement by JRF on the ITRC forums.
ioscan -kfnC fc | awk ‘/fcd/ {getline;fcd=$NF;print fcd,$2}’ | while read -r fdev
do
fcmsutil ${fdev} | awk ‘/Hardware / {print $5};/World / { print $7}’
done
Ouput looks like this:
0/0/12/1/0/4/0
0x5001438002a24979
0x5001438002a24978
0x204f000dec81b540
0x200f000dec81b541
0/0/12/1/0/4/1
0x5001438002a2497b
0x5001438002a2497a
0x2093000dec81b480
0x2010000dec81b481
2/0/12/1/0/4/0
0x5001438002a24d35
0x5001438002a24d34
0x2050000dec81b480
0x2010000dec81b481
2/0/12/1/0/4/1
0x5001438002a24d37
0x5001438002a24d36
0x2093000dec81b540
0x200f000dec81b541
Second, new improved version (Girsah Chadash)
ioscan -kfnC fc | awk ‘/fcd/ {getline;fcd=$NF;print fcd,$2}’ | while read -r fde
v
do
fcmsutil ${fdev} | awk ‘/Hardware / {print $5};/World / { print $7}’ | awk’ {printf “%s %s %s %s %s”,$1, $2, $3, $4, $5;}’
fcmsutil ${fdev} | awk ‘/Hardware Path/ {PATH=$5};
/N_Port Node/ {NNODE=$7};
/N_Port Port/ {NPORT=$7};
/Switch Port/ {SPORT=$7};
/Switch Node/ {SNODE=$7};
END{print PATH, NNODE, NPORT, SPORT, SNODE}’
done
Next innovation would be to combine the awk statements in the while loop and pull off the output with a single awk command. I may do this, but I might need help from an awk guru.
The ioscan output is multi line, so the real innovation is using the getline function of awk to get the second line of data and ignore the first. The filter /fcd gets rid of the column format information.
Yes it could be done with grep, but it is more AWKFUL this way.
Updated document to provide some indentation. Trying to make the code easier to read. That may force me to add formatted scripts to download, which I will get to as time permits.
SEP
Tags: Capacity Planning, high capacity volume group, superdome