Sunteți pe pagina 1din 6

How to Create an Alternate Boot Disk on PA-RISC Systems

as of: 12/22/2010
This article describes a method that will successfully “break” (copy) the vg00
volume group prior to doing system significant changes (such as patching).

NOTES:

• Before doing anything, perform a make_{tape|net]_recovery!


(Preferably using “-A”.)

• “lvreduce” methods do not successfully split a mirror. A careful read


of man lvreduce will reveal that disks extents are deallocated (erased).

For all versions of HP-UX, to create an alternate boot disk there must be N
free disks (where N = the number of PVs currently in vg00).

This document is written for PA-RISC systems. For Itanium systems


please use this document.
For releases 11.23 and greater “Dynamic Root Disk” can be used.

Create an Alternate Boot Disk

1. Presumption for this example is that vg00 resides on a single disk –


c0t6d0. The “alternate” disk is c0t5d0 and reports as claimed in
ioscan –fnC disk. The name of the alternate VG is /dev/vgroot.
Adapt these procedures as necessary to fit your environment.

2. If necessary, initialize the alternate disk for use as a bootable LVM disk:
# pvcreate –Bf /dev/rdsk/c0t5d0

3. If necessary, create /dev/vgroot:

a. Determine what minor numbers are currently in use:


# ll /dev/vg*/group
crw-r----- 1 root sys 64 0x000000 Jun 17 2002 /dev/vg00/group
cr--r--r-- 1 root sys 64 0x010000 Jun 15 2004 /dev/vg01/group
In the above example, 0 and 1 are in use. 2 would be a good,
logical next choice

b. Make /dev/vgroot:
# mkdir /dev/vgroot
c. Check the permissions of the new directory. They should be 640.
Correct if necessary.

d. Make the “group” character device file using the minor number
selected above:
# mknod /dev/vgroot/group c 64 0x020000

e. Create the volume group on the alternate disk:


# vgcreate /dev/vgroot /dev/dsk/c0t5d0

4. Confirm that /etc/lvmtab is up-to-date. You should see the following, at


least:
# strings /etc/lvmtab
/dev/vg00
/dev/dsk/c0t6d0
/dev/vgroot
/dev/dsk/c0t5d0

5. Install boot programs on the alternate disk:


# mkboot /dev/rdsk/c0t5d0

6. Determine the hardware address of the alternate disk:


# lssf /dev/dsk/c0t5d0
sdisk card instance 0 SCSI target 5 SCSI LUN 0 section 0 at address
8/12.5.0 /dev/dsk/c0t5d0
“ioscan –fnC disk” should report the same information.

7. Use the hardware address to create an AUTOBOOT file on the alternate


disk:
# mkboot –a “hpux (8/12.5.0;0) /stand/vmunix” /dev/rdsk/c0t5d0

8. Determine the lvol sizes in vg00. Use this information in the next step
(lvcreate). For example:
# vgdisplay -v vg00|egrep "LV Name|LV Size"
LV Name /dev/vg00/lvol1
LV Size (Mbytes) 320
LV Name /dev/vg00/lvol2
LV Size (Mbytes) 2048
LV Name /dev/vg00/lvol3
LV Size (Mbytes) 3460
9. Create and extend the root logical volume and the swap logical volume
(you will need to customize the sizes): (-C = contiguous; “-r n” = turn
off bad block relocation)
(Reminder, lvol1 is usually “/stand”, lvol2 is usually swap/dump, lvol3
is usually “/” (root))
# lvcreate -L 320 -C y –r n -n bootlvol /dev/vgroot
# lvcreate -L 2048 -C y –r n -n swaplvol /dev/vgroot
# lvcreate -L 3460 -C y –r n -n rootlvol /dev/vgroot

10. Create all other root disk logical volumes as needed. For example, a
200-Mb lvol5:
# lvcreate -L 200 -n lvol4 /dev/vgroot

11. Update the BDRA (Boot Disk Reserved Area) with the new information
for boot, root, swap and dump logical volumes:
# lvlnboot -b bootlvol /dev/vgroot # this is /stand lvol
# lvlnboot -r rootlvol /dev/vgroot # this is root "/" lvol
# lvlnboot -s swaplvol /dev/vgroot # this is swap lvol
# lvlnboot -d swaplvol /dev/vgroot # this is the default dump lvol
# lvlnboot –v # verify

12. Create filesystems as appropriate on the new logical volumes, using


the raw lvol device. (See Supported File and File System Sizes for HFS
and JFS (jan 2007).pdf if specific “-o” options are needed.) To see what
vg00 lvol’s have filesystems and their type:

# grep vg00 /etc/fstab

Examples:
# newfs -F hfs /dev/vgroot/rbootlvol
# newfs -F vxfs /dev/vgroot/rrootlvol
# newfs -F vxfs /dev/vgroot/rlvol4

The above steps probably only need to be done once.


From this point and below, these steps need to be
repeated on a regular basis to keep the alternate boot
drive in-sync.
13. Quiesce the system. This includes having users log-off and
application halt. One way to do this is to shutdown into single-user
mode:
# shutdown 0

14. Mount any needed system file systems that are no longer
mounted. For example, to mount /usr:
# mount /usr

15. Create a mount point for the new stand logical volume and
mount it:
# cd /
# mkdir /newstand
# mount /dev/vgroot/bootlvol /newstand

16. Copy over the entire original /stand directory to the new stand directory:
(-xdev = don't cross any file system mount points that exist below the starting point
-depth = traverse sub-directories
-print = current path name will be printed
-p = pass through
-x = store special files
-d = make directories
-u = unconditional copy
-m = preserve modification times
-v = verbose)
# cd /stand
# find . -xdev -depth -print | cpio -pxdumv /newstand

Do the same for the new root directory:


# cd /
# mkdir /newroot
# mount /dev/vgroot/rootlvol /newroot
# cd /
# find . -xdev -depth -print | cpio -pxdmv /newroot

Mount all of the other logical volumes that will contain file systems, and copy over the
files. For example, if /dev/vg00/lvol4 mounted at /opt, then mount /dev/vgroot/lvol4 at
/newroot/opt and copy the files:
# mount /dev/vgroot/lvol4 /newroot/opt
# cd /opt
# find . -xdev -depth -print | cpio -pxdumv /newroot/opt
NOT Because of industry standards and interoperability goals, cpio
E: does not support the archival of files larger than 2 GB or files
that have user/group IDs greater than 60 K. For files > 2 GB use
a utility such as cp or fbackup/frecover.
17. Edit the /newroot/etc/fstab file to reflect the new bootable disks paths:
# vi /newroot/etc/fstab

Comment out the lines pertaining to vg00:


# /dev/vg00/lvol1
# /dev/vg00/your_swap_logical_volumes

Add the new root and device swap logical volume and the other logical volumes:
/dev/vgroot/rootlvol
/dev/vgroot/bootlvol
/dev/vgroot/lvol4

NOT Use the same options and syntax for the entries. There is no
E: entry for primary swap, just for device and file system swap.
18. Prepare the new lvol’s to be bootable:
# lvlnboot -r /dev/vgroot/rootlvol
# lvlnboot -b /dev/vgroot/bootlvol
# lvlnboot -s /dev/vgroot/swaplvol
# lvlnboot -d /dev/vgroot/swaplvol
# lvlnboot –R
# lvlnboot -v # to verify the results

19. Reboot, interrupt autoboot if necessary and boot from 8/12.5.0.

20. VERIFY YOUR WORK!!!


Manually boot the system using each boot option.

If you are doing the above steps to begin using the “alternate disk” as the
new boot disk (perhaps because the original disk is failing or too small),
use the following steps to turn “vgroot” into “vg00”. Recall that LVM
knows that /dev/vgroot exists on c0t5d0, and both “vgroot” and “vg00”
exist.

1. Set the primary boot entry to point to the “alternate” disk:


# setboot –p 8/12.5.0

2. Reboot into LVM maintenance mode


> BO PRI
interact with IPL
ISL> hpux –lm

3. vgexport vg00 and vgimport the new drive:


# vgexport /dev/vg00
# vgimport /dev/vg00 /dev/dsk/c0t5d0
4. Activate vg00:
# vgchange –a y /dev/vg00

5. Edit /etc/fstab to reflect the new mounts:

Un-Comment out the lines pertaining to vg00:


# /dev/vg00/lvol1
# /dev/vg00/your_swap_logical_volumes
etc

And comment out the lines pertaining to the vgroot.

6. Using lvlnboot, update all physical volumes in the volume group so


that the logical volume becomes the root, boot, primary swap, or a
dump volume when the system is next booted on the volume group.

# lvlnboot -r /dev/vg00/lvol3
# lvlnboot -b /dev/vg00/lvol1
# lvlnboot -s /dev/vg00/lvol2
# lvlnboot -d /dev/vg00/lvol2
# lvlnboot –R
# lvlnboot -v # to verify the results