Duplicating a drive

 
SOLVED
Go to solution
John Ramsay_2
Regular Advisor

Duplicating a drive

I have everything like I want on 4 gig in the hp-712/100. I also have another drive external that is empty. I don't have a tape drive large enough to back everything up so I was wondering if using the steps below could I make a bootable mirror on the external of the internal so when I screw it up I can just switch drives and re-mirror and be back in business? Also if I ran the command
mkboot -a "hpux -lq on my primary which is already loaded would I screw it up. This doc says I must run the command with the -lq so they won't be tied together at boot up.
Here is the procedure...

LVM/Disk Stuff
Make a bootable mirror disk (primary=c0t6d0, alternate=c0t5d0)
The "-B" option is used to create a bootable Physical Volume:
pvcreate -B /dev/rdsk/c0t5d0

Make sure to use the character device file when using mkboot:
mkboot /dev/rdsk/c0t5d0

Add diagnostics to lif:
mkboot -b /usr/sbin/diag/lif/updatediaglif -p ISL -p AUTO -p HPUX -p LABEL /dev/rdsk/c0t5d0

Add boot info:
mkboot -a "hpux -lq (;0)/stand/vmunix" /dev/rdsk/c0t5d0

Note:
The "-lq" indicates no quorum when two disks
are used. When three or more are used you don't need "-lq."

You also need to do this with the primary disk. Otherwise,
when you boot normally to pri and the alt disk is not there
for whatever reason, you will **NOT** be able to boot. The
pri disk will "look" for the alt disk. No quorum????
To bad so sad, you loose. Ack! So do this as well:

mkboot -a "hpux -lq (;0)/stand/vmunix" /dev/rdsk/c0t6d0

Adds the Physical Volume to the root volume group:
vgextend /dev/vg00 /dev/dsk/c0t5d0

Do this next command for each "lvol"[1-7]......
lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c0t5d0

******* or *******
for x in lvol1 lvol2 lvol3 lvol4 lvol5 lvol6 lvol7 swap2 Crash Logs
do
echo "\n******** Doing ${x} ********\n"
lvextend -m 1 /dev/vg00/${x} /dev/dsk/c0t5d0
done

Don't forget any extra swap you added (like /dev/vg00/swap2). Do "swapinfo" and "bdf" to check for swap and any other lvols that may have been created.
Specifies the root logical volume:
lvlnboot -r /dev/vg00/lvol3

Specifies the swap logical volume:
lvlnboot -s /dev/vg00/lvol2

Specifies the dump logical volume:
lvlnboot -d /dev/vg00/lvol2

Specifies the boot logical volume:
lvlnboot -b /dev/vg00/lvol1

Recovers any BDRA info:
lvlnboot -R

Verify boot, root, swap and dump settings:
lvlnboot -v

Display the Primary and Alternate boot paths that are currently set:
setboot

Change the Alternate Boot Path to the path of the Root Mirror:
setboot -a 10/0.5.0

Note:
Use "ioscan -funC disk" to find out what the
path should be. Run "setboot" again to confirm
the change.

Do "shutdown -r 0" (or "reboot") to test. After halting the boot process, type in "bo alt" to boot from the alternate disk. Also, you may want to *remove* the primary disk to test as well. The server should boot from the alternate disk if the primary is not found and no quorum was set.
41 REPLIES 41
Kent Ostby
Honored Contributor

Re: Duplicating a drive

Easy issue first:

You can run the mkboot -a on your primary while you're up and running with no problem.

The above process will work for mirroring the disk.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

Thanks... So when I screw it up again (because I'm teaching myself), all I have to do is boot to the alternate - make a mirror of the alternate back on the primary and reboot, right? Also, do I need to format or erase the primary before doing the mirror thing?
Mark Grant
Honored Contributor

Re: Duplicating a drive

You know, that mirroring the drive isn't really going to be a backup as such. You could actually use fbackup/tar/whatever to just copy data to this disk instead of mirroring it.

I'm not sure which is more risky, not have a mirror of your root logical volumes or not having a backup of anything!

Anyway, no you don't need to format anything :)
Never preceed any demonstration with anything more predictive than "watch this"
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

Why won't it be a backup? I thought it would be an exact copy of what the other drive is right now. Also, do I need to do these things in the single user mode?
Mark Grant
Honored Contributor

Re: Duplicating a drive

John,

It's not a backup as such because if you delete a file or corrupt a filesystem then the mirror will reflect exactly those changes too so you won't be able to restore anything from it.. Of course, you re-synch the mirror every night and then break the mirror straight after (7 years bad luck) but I think just backing up to the disk would be simpler.

However, no, you don't need to be in single user mode to do what you propose. It can all be done on line without upsetting any of your users.
Never preceed any demonstration with anything more predictive than "watch this"
Elmar P. Kolkman
Honored Contributor

Re: Duplicating a drive

If both disks are the same size and you'll swap the disks physically before the boot, you could do it simpler:
dd if= of= bs=4096

This way your whole disk gets copied.

If you do it by extending the volume group, if you change data on a lvol, it will be changed on both disks, meaning you're still screwed... That's why it is not a real backup.
Every problem has at least one solution. Only some solutions are harder to find.
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

Ok so, the command would be:
dd if=/dev/dsk/c0t0d0 of=/dev/dsk/c0t5d0 bs=4096
Right?
The pri is an 18 gig with only 4 gig allocated at this point (I'll extend everything after).
The alt is a 9 gig empty.
The plan would be in case of probable OS destruction,
1.Change to alt at boot up.
2.Run dd if=/dev/dsk/c0t5d0 of=/dev/dsk/c0t0d0 bs=4096 (putting the pri back like it is today)
3. Rebooting with Pri.
4. Extend to the full 18 gig.
Right???
Mark Grant
Honored Contributor

Re: Duplicating a drive

Sorry but your "dd" isn't going to work if using different size disks. YOu are better off mirroring as you originally said and then breaking the mirror afterwards. That way you can mirror back should you break the system. Obviously, you would need to resync the mirrors from time to time.
Never preceed any demonstration with anything more predictive than "watch this"
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

What about using ignite? I just installed it.