Epic Uptime!

August 17th, 2012 | Posted by spritian in HP-UX | Linux | Solaris - (0 Comments)

LOL… One of my clients has a box running solaris with this epic uptime…

2:48pm up 1187 day(s), 3:34, 4 users, load average: 0.09, 0.12, 0.12

HAHA! And I need to reboot it next week 🙁

Few commands I use often in HP-UX; Coming from over 15 years of Linux experience, the quirks in HP-UX can get annoying at first, but hopefully this will help you through it!

Sick of your backspace key not working? Here’s your answer:

stty erase ^?

Annoyed with the shitty output of df?


Trying to figure out what the model/arch of the server is?


This lists a few different thing… disk related, and/or fibre channel cards:

ioscan -fnNkC disk
ioscan -fnkC disk
ioscan -fnkC
ioscan -m lun
ioscan -m dsf

How do I configure which mirror to boot from!?

setboot -v (verify/list)
setboot -a (alt)
setboot -p (primary)

I miss yum/apt-get:

swinstall -s /full/path/to/depotfile.depot \*
swinstall -x autoreboot=true -s /full/path/to/depotfile.depot \*

The \* is pretty cool, it prevents the TUI/GUI from loading, but continues the install/dep check. Makes it feel more like yum or apt-get, instead of aptitude or a GUI update manager.

AHHH usermod and passwd are missing flags in HP-UX! No, just use modprpw instead!

/usr/lbin/modprpw -v (refresh/validate all accounts)
/usr/lbin/modprpw -k -l username (unlock/enable [k] a local account [l])

This will reset the expiration of a locked account.

Where the fuck are the init.d and rc scripts?!


How can I figure out the current runlevel?!

who -r

I miss bash, how can I auto-complete a command?!

Like bash, type a few letters of the prefix, but instead of tab, hit:
esc twice

WTF?! No history command?!?! Lies, hit esc+k – then use j/k to cycle forward/backwards respectively. To edit a line you scroll to, it’s interactive vi in ksh… so ‘l’ to move foward, shift+R to replace, etc…

Here are my notes on how to remove and replace a dead mirrored drive on HP-UX 11i v3:

Remove bad mirrored boot disk HP-UX:

Check for stale LEs:

lvdisplay -v -k /dev/vg00/lvol# (1-7 is normal, however your system might have more) (to get key for the next command)

Next we need to remove the bad drive from the LVM, so let’s reduce the lvols (the last integer is the key from the last lvdisplay command):

lvreduce -m 0 -A n -k /dev/vg00/lvol1 0
lvreduce -m 0 -A n -k /dev/vg00/lvol2 0
lvreduce -m 0 -A n -k /dev/vg00/lvol3 0
lvreduce -m 0 -A n -k /dev/vg00/lvol4 0
lvreduce -m 0 -A n -k /dev/vg00/lvol5 0
lvreduce -m 0 -A n -k /dev/vg00/lvol6 0
lvreduce -m 0 -A n -k /dev/vg00/lvol7 0

Now that we’ve reduced the mirror, let’s remove partition 2 from the volgroup:

vgreduce /dev/vg00 /dev/disk/disk62_p2

If we can’t reduce because it’s critically failed, then we need to do this:

vgreduce –f /dev/vg00 /dev/disk/disk62_p2
vgscan –f /dev/vg00

Then confirm:

vgdisplay -v vg00

Here’s an example of a DEAD drive from ioscan:

disk 62 64000/0xfa00/0xd esdisk NO_HW DEVICE offline HP 36.4GST336753LC
/dev/disk/disk62 /dev/disk/disk62_p2 /dev/rdisk/disk62 /dev/rdisk/disk62_p2
/dev/disk/disk62_p1 /dev/disk/disk62_p3 /dev/rdisk/disk62_p1 /dev/rdisk/disk62_p3

Example of REPLACED drive with the old DEAD DSF – Map DSF then Re-add to VG:

STEP1: In order to see the new drive, you need to do this first (AFTER NEW DRIVE IS INSERTED): scsimgr replace_wwid –D /dev/rdisk/disk62

disk 62 64000/0xfa00/0xd esdisk NO_HW DEVICE offline HP 36.4GST336753LC
/dev/disk/disk62 /dev/disk/disk62_p2 /dev/rdisk/disk62 /dev/rdisk/disk62_p2
/dev/disk/disk62_p1 /dev/disk/disk62_p3 /dev/rdisk/disk62_p1 /dev/rdisk/disk62_p3

disk 219 64000/0xfa00/0x20 esdisk CLAIMED DEVICE online HP 36.4GST336753LC
/dev/disk/disk219 /dev/rdisk/disk219

STEP2: Formart disk219

echo "3" > /tmp/partitionfile
echo "EFI 500MB" >> /tmp/partitionfile
echo "HPUX 100%" >> /tmp/partitionfile
echo "HPSP 400MB" >> /tmp/partitionfile

idisk -wf /tmp/partitionfile /dev/rdisk/disk219
ioscan -fnNC disk
insf -e -C disk

STEP3: Then you can map the new DSF to the old one:

io_redirect_dsf -d /dev/disk/disk62 -n /dev/disk/disk219

STEP4: Make Bootable and fix EFI partitions:

mkboot -e -l /dev/rdisk/disk62
efi_ls -d /dev/rdisk/disk62_p1
lifls -l /dev/rdisk/disk62_p2
mkboot -a "boot vmunix -lq" /dev/disk/disk62
efi_cp -d /dev/rdisk/disk62_p1 -u /EFI/HPUX/AUTO /tmp/x; cat /tmp/x;rm /tmp/x

STEP5: Create PV, Extend VG, and Extend LVs:

pvcreate -f -B /dev/rdisk/disk62_p2
vgextend /dev/vg00 /dev/disk/disk62_p2

lvextend -m 1 /dev/vg00/lvol1 /dev/disk/disk62_p2
lvextend -m 1 /dev/vg00/lvol2 /dev/disk/disk62_p2
lvextend -m 1 /dev/vg00/lvol3 /dev/disk/disk62_p2
lvextend -m 1 /dev/vg00/lvol4 /dev/disk/disk62_p2
lvextend -m 1 /dev/vg00/lvol5 /dev/disk/disk62_p2
lvextend -m 1 /dev/vg00/lvol6 /dev/disk/disk62_p2
lvextend -m 1 /dev/vg00/lvol7 /dev/disk/disk62_p2
lvlnboot -r /dev/vg00/lvol3
lvlnboot -b /dev/vg00/lvol1
lvlnboot -s /dev/vg00/lvol2
lvlnboot -d /dev/vg00/lvol2
lvlnboot -R
lvlnboot -v

STEP6: Verify VG and boot paths

vgdisplay -v vg00
setboot -v

If the mirrored disk fails to boot from EFI, boot off the alternate working one, and re-execute setboot -v with the device path (even though it might already be set, set it again since the wwid change).

HP IRTC / HP-UX Patch Management Link

April 23rd, 2012 | Posted by spritian in HP-UX - (1 Comments)

For those who manage HP-UX, the new IRTC link is at https://h20566.www2.hp.com/portal/site/hpsc/patch/home/