LVM and VxVM

Patching and Recovery Using LVM in Mirrored Root


Patching and Recovery Using LVM in Mirrored Root

I've read through several of the messages in the forum but here's what I want.

I have a system that I want to patch. I split the root, patch the primary, I need to boot off the mirror and merge the data back to the primary.

I need to know the steps, mainly booting off the mirror long enough to merge the data back to the primary. The steps I've seen are a lot of renaming of lvols and reboots.

I'm sure someone has already been there.

S.K. Chan
Honored Contributor

Re: Patching and Recovery Using LVM in Mirrored Root

Done it once but it was such a painful exercise. You have another option though to do this with Ignite (ie create your vg00 image before you patch it). Anyway these are the steps .. (lets assume this ..
lvol1 - /stand
lvol2 - primary swap
lvol3 - root
lvol4 -> lvol6 - the rest (ie /opt,/var..)
# lvsplit /dev/vg00/lvol6
==> Repeat in this order:- lvol5,4,1,2,3
==> You should see the additional lvols ..
/dev/vg00/lvol1b -> lvol6b . The next step is run fsck on these lvols to make sure they are ok.
# lvrmboot -r /dev/vg00
==> Remove BDRA definition.
# lvlnboot -r /dev/vg00/lvol3b
# lvlnboot -b /dev/vg00/lvol1b
# lvlnboot -s /dev/vg00/lvol2b
# lvlnboot -d /dev/vg00/lvol2b
==> Redefined the root,boot,swap and dump areas.
Now lets fix the fstab file.
# cd /etc
# cp fstab fstab.split
# vi fstab.split
==> Edit approriately (example ..change lvol1 to lvol1b and so on ..)
# mkdir /temp
# mount /dev/vg00/lvol3b /temp
# cp /etc/fstab.split /temp/fstab
==> Copy the "modified" fstab file over to "lvol3b" which is mounted on /temp.
# umount /temp
# mount /dev/vg00/lvol1b /temp
# vi /temp/bootconf
==> Edit this and change the path of the boot disk to secondary disk.
# umount /temp
# rmdir /temp
# setboot
==> Check to see what's your current boot path. You would want to change the pri boot path to point to your secondary disk so that when you reboot the system it'll pick up the secondary disk instead.
# setboot -p
Now reboot your system (shutdown -r). After you have verified it has booted up from the secondary disk you can proceed with the patching exercise. After you're done and ready to merge both disks .. delete the BDRA and redefine it (see above , use lvol3,lvol1,etc).. edit /etc/bootconf (put back the pri disk path)..change the bootpath with setboot. Reboot the system so that it'll boot up using the pri disk this time.

Finally merge the lvols ..
# lvmerge /dev/vg00/lvol6 /dev/vg00/lvol6b
==> Repeat for the rest.

Basically that's all to it. I would strongly advice you to go through the lvsplit and lvmerge steps (if possible) on a "test" environment before diving into it.

A. Clay Stephenson
Acclaimed Contributor

Re: Patching and Recovery Using LVM in Mirrored Root

A far easier method (assuming that you have done mkboot -a "hpux -lq (;0)/stand/vmunix" /dev/rdsk/cXtYd0 on both boot drives - so that you can boot without quorum) is to simply yank a drive. You can shutdown cleanly if you like and then yank the drive. You install the patches and then do a "boot drive replacement with mirrored boot disk". There's no lvsplits or lvmemrges at all. It now just a routine boot disk replacement "on the fly".

My most favorite method (even over Ignite) is to leave the mirrors in place and do a raw disk copy of the boot drive to a 3rd disk - the lifeboat. If anything goes wrong, you simply move the lifeboat into the boot disk slot and away you go. I routinely refresh my lifeboats weekly during quiet periods.

If it ain't broke, I can fix that.
Michael Steele_2
Honored Contributor

Re: Patching and Recovery Using LVM in Mirrored Root

Two additions to above (* which is basically what I'd say *)

a) Need to do this from LVM maintenacne mode:

ISL > hpux -is -lm

You can't mount you're file systems from LVM maintenance mode so just split and reboot.

b) Check for diagnostics installed in bootlif of both boot disks:

lifls /dev/rdsk/cXtYdZ

7 or 8 files is not diagnostics, 15 or 16 has diagnostics loaded.

The diagnostics software has to be installed on the alternate boot disk when booted off of the alternate boot disk.
Support Fatherhood - Stop Family Law

Re: Patching and Recovery Using LVM in Mirrored Root

Thanks for all the input. I just need some clarification on a few things to make sure I understand things right.

S.K - I'm not sure why you would remove the BDRA definition off the b side?

Maybe your idea will work. The question will the system be returned back to where it was before. I want to make sure I don't do what others have done is that lvlnboot shows that everything is set to the b side. I want to be able to patch the primary, boot off the secondary, restore all the data back to the primary and boot off of it.

Now something I didn't think of is just booting off the mirror, patching it, if you can't boot off the mirror after patching you can just reboot off the primary and re-merge the disks.

One thing I did find interesting that even though you do a bo P1 for instance to tell it to boot off the mirror disk, it seems to read data off the primary disk. I think that was the reasoning for Clay yanking the primary disk, but also simulating a failed root primary disk. That's not and option that I think admins would want to do on production systems as a routine. Also some of these machines are remote.

I guess I'm trying to find the easiest solution that admins can follow without a huge list of editing fstabs, renaming files, etc.

Would using setboot to tell it to boot of the secondary, reboot to the secondary and patch it, reboot and if it fails boot off the primary and use setboot back to it and remerge work?

I'm going to be trying some of these suggestions today but it takes time when if it doesn't work I have to get the system back. You're talking at least an hour or more, not to mention the syncs take a while too. I'm doing this in our lab so it's not too bad. But still would rather have something that in the end will be easy enough for the admins to follow.

I'm distributing the results of this to all the admins at our company. Not all of them are at the same level. So keeping it to as few as steps as possible and either scripting or elminating human error would help.

Thanks again for all your time helping me.

Stuart Abramson_2
Honored Contributor

Re: Patching and Recovery Using LVM in Mirrored Root


I think you are making this to complicated:

Don't split the alternate, patch the primary, boot off the split alternate and then mirror back to the primary.

Just split the alternate, patch the primary, then boot off the PRIMARY. Wait a few days to verify that everything is okay (which 19/20 times it will be), and then mirror the alternate back to the primary. During production hours.

In the rare case that you have a problem, then you have to revert to the alternate, and mirror the primary back to the old alternate.

This approach saves reboots. Cuts down on downtime. Is simpler.

lvsplit before.
lvmerge after.