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

20 Oct 09 HP-UX Integrity Software mirror procedure

This was written by a former colleague. It is better than anything else I have seen. SEP

Mirroring a Boot Disk with LVM on HP-UX 11i for HP Integrity

Servers

The following diagram shows the disk layout of a boot disk. The disk

contains a Master Boot Record (MBR) and Extensible Firmware

Interface (EFI) partition tables that point to each of the partitions. The

idisk

command is used to create the partitions (see idisk (1M)).

Figure 6-5 Example LVM Disk Layout on HP Integrity Server

Before starting the procedure, make sure that add-on product HP

MirrorDisk/UX (B5403BA) is installed. This product is an extra-cost

product available on the HP-UX 11i application release media. For

example:

swlist -l fileset | grep -i mirror

LVM.LVM-MIRROR-RUN B.11.22 LVM Mirror

Step 1.

file.

Partition the disk using the idisk command and a partition description

a.

Create a partition description file. For example:

vi /tmp/idf

In this example the partition description file contains:

3

EFI 500MB

HPUX 100%

HPSP 400MB

NOTE

an EFI partition, an HP-UX partition, and an HP Service partition.

Boot disks of earlier HP Integrity Servers may have an EFI partition

of only 100MB and may not contain the HPSP partition.

The values in the example represent a boot disk with three partitions:

b.

Partition the disk using idisk and your partition description file:

idisk -f /tmp/idf -w /dev/rdsk/c3t1d0

c.

To verify you can run:

idisk /dev/rdsk/c3t1d0

Step 2.

the partitions. For example:

Use the insf command with the -e option to create the device files for all

insf -e -H 0/18/1/2/0.0.1.0

You should now have eight device files for this disk:

/dev/[r]dsk/c?t?d?

(This refers to the entire disk)

/dev/[r]dsk/c?t?d?s1

(This refers to the EFI partition)

/dev/[r]dsk/c?t?d?s2

(This will be the HP-UX partition)

/dev/[r]dsk/c?t?d?s3

(This refers to the Service partition)

Step 3.

disk:

Use pvcreate to make the HP-UX partition of the disk an LVMmanaged

pvcreate -B /dev/rdsk/c3t1d0s2

Step 4.

Add the disk to vg00:

vgextend vg00 /dev/dsk/c3t1d0s2

Step 5.

Place the boot files on the disk using mkboot:

mkboot -e -l /dev/rdsk/c3t1d0

Step 6.

Copy any autoboot file from the original boot disk to this one.

a.

partition to the current directory. Make sure to use the device file

with the

Use efi_cp to copy the AUTO file from the original boot disk’s EFIs1 suffix, as it refers to the EFI partition:

efi_cp -d /dev/rdsk/cntndns1 -u /efi/hpux/auto ./AUTO

b.

partition:

Copy the file from the current directory into the new disk’s EFI

efi_cp -d /dev/rdsk/c3t1d0s1 ./AUTO /efi/hpux/auto

Step 7.

volume group onto the desired physical volume. The logical volumes

must be extended in the same order that they are configured on the

original boot disk. Use the

determine the list of logical volumes and their order. For example:

Use the lvextend command to mirror each logical volume in the rootpvdisplay command with the -v option to

pvdisplay -v /dev/dsk/c0t0d0s2 | grep ’current.*0000$’

00000 current /dev/vg00/lvol1 00000

00038 current /dev/vg00/lvol2 00000

00550 current /dev/vg00/lvol3 00000

00583 current /dev/vg00/lvol4 00000

00608 current /dev/vg00/lvol5 00000

00611 current /dev/vg00/lvol6 00000

00923 current /dev/vg00/lvol7 00000

01252 current /dev/vg00/lvol8 00000

In this example, mirror the logical volumes as follows:

lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c3t1d0s2

lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c3t1d0s2

lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c3t1d0s2

lvextend -m 1 /dev/vg00/lv0l4 /dev/dsk/c3t1d0s2

lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/c3t1d0s2

lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/c3t1d0s2

lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/c3t1d0s2

lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c3t1d0s2

If

lvextend fails with following message:

“m”: Illegal option

then HP MirrorDisk/UX is not installed.

Step 8.

Update the root volume group information:

lvlnboot -R /dev/vg00

Step 9.

disk and that the boot, root, and swap logical volumes appear to be on

both disks:

Display the BDRA. Verify that the mirrored disk is displayed as a boot

lvlnboot –v

Step 10.

Specify the mirror disk as the alternate boot path in nonvolatile memory:

setboot -a path_to_disk

Step 11.

text editor:

Add a line to /stand/bootconf for the new boot disk using vi or another

vi /stand/bootconf

l /dev/dsk/c3t1d0s2

where

l denotes LVM.

Tags: , , , , , , , ,

04 Sep 09 Creating Logical Volumes and Filesystems

Quick and Dirty Example here.

In our last example, we created a volume group vg03. It had thee disk, we expanded it to 4 because we planned proper capacity.

Our volume group now consists of 4 disks.

We are asked to create an approximately 10 GB files system in this SAN based volume group.

vgdisplay /dev/vg03

vgdisplay -v /dev/vg03

< Insert vgdisplay example here>

HP vgdisplay documentation link (Note this tends to change. I can’t help it if HP breaks the links)

This will show an empty volume group as we have not created any logical volumes

pvdisplay /dev/dsk/c10d0t1

… repeat for other disks …

<Insert pvdisplay examples here>

HP pvdisplay document link

Make sure nothing is on them.

Turns out 10 GB will fit quite nicely on a single disk. Since this is a SAN based disk, we need not worry here about raid configuration. If you are hosting an oracle rdbms, you should make sure the SAN admin sets up data, index and rollback as raid 1 or raid 10 to insure good performance.

lvcreate /dev/vg03

# Creates an empty logical volume on vg03. Uses default naming.

You can also do it this way if you like names.

lvcreate /dev/vg03 -n mydata

lvextend -L 10240 /dev/vg03/mydata /dev/dsk/c10t0d1

# This command creates an approximately 1024 MB logical volume and defines the disk it goes on. Always define the disk. Don’t let LVM or SAM decide where your data is going to go. Plan in advance. Note that LVM for Linux which is a feature port and not a binary recompile does let you define size 10 GB or 10240 MB. Still waiting for that feature on LVM for HP-UX.

newfs -F vxfs -o largefiles /dev/vg03/rmydata

# Why largefiles? Databases are big and the default limit on a file size in a file system is 2 GB. That is too small. I almost always set up my file systems these days for largefiles unless the file system itself is less than 2 GB

# Create a mount point.

mkdir /mydata

# mount it.

mount /dev/vg03/mydata /mydata

# This does not set an optimal JFS logging and recovery options, but that is a different article

bdf

# See if its there and the right capacity.

Next article: Edit /etc/fstab and set permanent mount options.

NOTE: This article needs to be checked and have vgdisplay and pvdisplay and other examples inserted into it.

Tags: , , , , , , ,

04 Sep 09 LVM Volume Group Create. High Capacity VGlvm

Volume group creation, done right need only be done once to last a long time. A few simple steps can make it a process you do once and then enjoy the long term benefits.

Step one is a little homework. Take a reasonable estimate at how many physical volumes the volume group is going to contain. Why is this important? Because by default lvm allocates resources as if there will be 255 physical volumes. Most volume groups don’t see that many disks, and the overall capacity is impacted by the default. For this example, we will pick a small volume group that is never anticipated to exceed 10 physical volumes. We will set the maximum volumes to 25 to have a fair amount of additional capacity but to more efficiently allocate scarce resources.

Now th fun begins. We will create a volume group called vg03

Discover the new disks, important if LUNS have been presented to the system.

insf -C disk (may not be needed on HP-UX 11.31)

ioscan -fnC disk

ioscan shows three disks for this example.

/dev/rdsk/c10t0d1 /dev/rdsk/c10t0d2 /dev/rdsk/c10t0d3

cd /dev

mkdir vg03

mknod /dev/vg03/group c 64 0x030000

# We have created a device file for the volume group.

We need to pvcreate the disks, which lablels the disk for use by LVM

pvcreate /dev/rdsk/c10t0d1

pvcreate /dev/rdsk/c10t0d2

pvcreate /dev/rdsk/c10t0d3

vgcreate -p25 /dev/vg03 /dev/dsk/c10t0d1 /dev/dsk/c12t0d1 /dev/dsk/c10t0d3

# alternative vgcreate -e 65535 -s 16 /dev/vg10 /dev/dsk/c10t0d1 /dev/dsk/c12t0d1 /dev/dsk/c16t0d1 /dev/dsk/c17t0d1

The option -s lets us set a larger PE size which can also increase capacity.

Now inevitably someone is going to decide to add another disk to this volume group. It may be immediately or it may be down the road. We are prepared.

The SAN admin and project manager want to create a scratch area within the volume group for oracle backups to disk.

They present a new lun disk /dev/rdsk/c16t0d5

We respond like lightning.

insf -C disk

ioscan -fnC disk

pvcreate /dev/rdsk/c16t0d5

vgextend vg03 /dev/dsk/c16t0d5

The disk is ready for use.

Different article for how we set up logical volumes and a file system.

Tags: , , ,

09 Jun 09 System mirroring script

This was taken off of itrc forums. It may need some adjustment.

#!/bin/ksh

PARTITION_FILE=/var/tmp/partition_file

# define primary and mirror disks

# the format is:
# PRI_DISK=cXtXdX
# PRI_DISK=cXtXdX

PRI_DISK=c2t1d0
MIR_DISK=c3t0d0

echo
echo “PRIMARY DISK = /dev/dsk/$PRI_DISK”
echo “MIRROR  DISK = /dev/dsk/$MIR_DISK”
echo
echo If the above is correct, hit enter to continue echo If not correct, hit control-C to quit echo

echo
echo “Creating partition file /tmp/$PARTITION_FILE”
echo

cat <<EOF > $PARTITION_FILE
3
EFI 500MB
HPUX 100%
HPSP 400MB
EOF

# create system, OS and  service partitions

echo
echo idisk -wf $PARTITION_FILE /dev/rdsk/$MIR_DISK echo

idisk -wf $PARTITION_FILE /dev/rdsk/$MIR_DISK

# Create device files needed for the new partitions

insf -eC disk

# Verify the parition table

echo idisk /dev/rdsk/$MIR_DISK
idisk /dev/rdsk/$MIR_DISK

# Initialize the EFI partition for use

echo efi_fsinit -d /dev/rdsk/${MIR_DISK}s1 efi_fsinit -d /dev/rdsk/${MIR_DISK}s1

# Populate the /efi/hpux directory in the new EFI system partition

echo mkboot -e -l /dev/rdsk/$MIR_DISK
mkboot -e -l /dev/rdsk/$MIR_DISK

# Changing the auto file for the mirror to boot without quorum # Note: Using s1

echo “boot vmunix -lq”
echo “boot vmunix -lq”           > /tmp/AUTO.lq
efi_cp -d /dev/rdsk/${MIR_DISK}s1  /tmp/AUTO.lq   /EFI/HPUX/AUTO

# Verify the contents of the auto file on the primary and the mirror.
# Note: Using s1

echo  Verify the contents of the auto file on the primary and the mirror.
echo
efi_cp -d /dev/rdsk/${PRI_DISK}s1 -u  /EFI/HPUX/AUTO  /tmp/AUTO.pri efi_cp -d /dev/rdsk/${MIR_DISK}s1 -u  /EFI/HPUX/AUTO  /tmp/AUTO.alt

echo cat /tmp/AUTO.pri
echo
cat /tmp/AUTO.pri

echo cat /tmp/AUTO.alt
echo
cat /tmp/AUTO.alt

# add the new paritition to vg00
# Note: Using s2

echo  add the new paritition to vg00
echo  Note: Using s2

echo pvcreate  -B /dev/rdsk/${MIR_DISK}s2

pvcreate  -B /dev/rdsk/${MIR_DISK}s2

#pvcreate  -fB /dev/rdsk/${MIR_DISK}s2

vgextend vg00 /dev/dsk/${MIR_DISK}s2

# Add the new disk to /stand/bootconf
# Note: Using s2

echo  “Add the mirror disk $MIR_DISK to /stand/bootconf”
echo “l  /dev/dsk/${MIR_DISK}s2” >> /stand/bootconf

echo  Mirroring all Logical Volumes in /dev/vg00, lvol1 – lvol8 echo echo

echo “Mirroring /stand”
echo lvextend -m 1 /dev/vg00/lvol1  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol1  /dev/dsk/${MIR_DISK}s2 echo

echo “Mirroring swap”
echo lvextend -m 1 /dev/vg00/lvol2  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol2  /dev/dsk/${MIR_DISK}s2 echo

echo “Mirroring root”
echo lvextend -m 1 /dev/vg00/lvol3  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol3  /dev/dsk/${MIR_DISK}s2 echo

echo “Mirroring /home”
echo lvextend -m 1 /dev/vg00/lvol4  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol4  /dev/dsk/${MIR_DISK}s2 echo

echo “Mirroring /opt”
echo lvextend -m 1 /dev/vg00/lvol5  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol5  /dev/dsk/${MIR_DISK}s2 echo

echo “Mirroring /tmp”
echo lvextend -m 1 /dev/vg00/lvol6  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol6  /dev/dsk/${MIR_DISK}s2 echo

echo “Mirroring /usr”
echo lvextend -m 1 /dev/vg00/lvol7  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol7  /dev/dsk/${MIR_DISK}s2 echo

echo “Mirroring /var”
echo lvextend -m 1 /dev/vg00/lvol8  /dev/dsk/${MIR_DISK}s2
lvextend -m 1 /dev/vg00/lvol8  /dev/dsk/${MIR_DISK}s2 echo

15 Oct 07 Mirror an HP-UX system

Developed on HP-UX 11.11
pvcreate -B /dev/rdsk/c1t0d0 #use real disk

mkboot -l /dev/rdsk/c1t0d0
mkboot -a “hpux -lq (;0)/stand/vmunix” /dev/rdsk/c1t0d0 # use real disk

# mkboot -b /usr/sbin/diag/lif/updatediaglif -p ISL -p AUTO -p HPUX -p PAD -p LABEL /dev/rdsk/c?t?d?

If you are running 64-bit OS:

# mkboot -b /usr/sbin/diag/lif/updatediaglif2 -p ISL -p AUTO -p HPUX -p PAD -p LABEL /dev/rdsk/c?t?d?

vgextend /dev/vg00 /dev/dsk/c1t0d0 # same thing
lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c1t0d0

# real disk. repeat for other lvols

lvlnboot -r /dev/vg00/lvol3 # root fs /
lvlnboot -s /dev/vg00/lvol2 #swap
lvlnboot -d /dev/vg00/lvol2 #swap/dump
lvlnboot -b /dev/vg00/lvol1
lvlnboot -R
lvlnboot -v
setboot

setboot -a 52.1.0 # second disk

WhatsApp chat