Operating System - HP-UX
1833631 Members
3579 Online
110062 Solutions
New Discussion

Off-line boot disk mirror

 
Travis Harp_1
Advisor

Off-line boot disk mirror

I'm trying to come up with a scheme that would allow me to have an additional mirror that would be off line and not being automatically synced with the primary mirror.

The end goal is to have a mirror that is only synced monthly so if a change is made to the boot mirror that prevents booting, we would be able to boot the system up on the off-line mirror.

We're looking for a cheap and quick way to recover if we ever get hit by the "fat_fingered_sa" virus 8)

Apparently this happened in the past and I've been tasked with making sure we have a fast way to recover.

What would be the best way to make this happen?

Travis
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor

Re: Off-line boot disk mirror

Do a search on "lifeboat" disks. I've described this several times. The idea is that you use dd to create an exact copy of your boot disk(s). These are used in addition to mirrors because they protect you from two things that mirrors do not: 1) Really bad patches 2) Your own stupidy.
If it ain't broke, I can fix that.
TwoProc
Honored Contributor

Re: Off-line boot disk mirror

Essentially, you're just going to have a drive in your system that isn't attached to anything. Just copy the primary disk of vg00 to that disk periodically (monthly as you said) using the dd command. What it takes to make this work is that your mirrored boot drive combo is pretty simple. That is vg00 is only two disks, and that each disk holds a mirrored copy of every lvm, and that each is bootable, and quorum checking is turned off. Basically a pretty straightforward solution of using two disks for a mirror of all root file systems.

Then just run a dd command from the primary disk of the mirror to the other unmounted (and unused hard drive). It works best if the drive you are copying to is the same exact disk as the one you are copying from. It doesn't have to be, but the copy drive should be at least bigger than the source drive.

Let's say your primary is:
/dev/dsk/c8t2d0
and your copy is:
/dev/dsk/c9t2d0

The dd command would be:

dd if=/dev/dsk/c8t2d0 of=/dev/dsk/c9t2d0
We are the people our parents warned us about --Jimmy Buffett
A. Clay Stephenson
Acclaimed Contributor

Re: Off-line boot disk mirror

Actually John's answer is missing the mark a bit:

dd if=/dev/dsk/c8t2d0 of=/dev/dsk/c9t2d0

There are two basic problems with this approach:

1) This is using the block (/dev/dsk) device nodes rather than the character (/dev/rdsk) device nodes.

2) No blocksize is specified so the default of 512 bytes will be used.

Performance will be terrible.

Instead use:
dd if=/dev/rdsk/c8t2d0 bs=1024k of=/dev/rdsk/c9t2d0

but I've attached a full-blown solution that is ready to be added to your cronjobs BUT be extremely careful to set 3 variables in the attached copy_boot.sh script:

src="c1t6d0 c1t5d0" # the source vg00 disk(s)
DEST="c2t6d0 c2t5d0" # the destination disk(s)
and optionally:
TMPVG=31

If TMPVG is > 0 then in addition to dd'ing the disks, a temporary volume group, /dev/vg${TMPVG} is created and your lifeboats are vgimport'ed. The filesystems are checked and marked clean and then the volume group is vgexport'ed and then /dev/vg${TMPVG} is removed. This adds another layer of comfort because now you know that you have fixed the filesystems that were copied dirty.

Even without the fsck's, I've never had a lifeboat fail to boot but the fsck's are a nice thing to do.

Should you actually need to use the lifeboats, you power down the box; remove the primary boot disk(s) and replace them with the lifeboat disk(s). You are back in business in a fraction of the time an Ignite would require.

I typically run this command under cron every weekend (you want to pick a relatively quiescent time if possible) and manually before I install a patch.
If it ain't broke, I can fix that.