1833757 Members
2606 Online
110063 Solutions
New Discussion

Re: 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.
Elmar P. Kolkman
Honored Contributor

Re: Duplicating a drive

Sorry, but that is info I didn't have. (the 2 different disks)

It might work, but this could very well give major problems, since the disks are not the same size. I would suggest to test the copy before relying on it, at least...

I think ignite could solve your problem better by creating an ignite image on the 9Gb disk... I don't know the exact syntax in this case, but have seen threads with questions about this this week, so some browsing could give you the info you need.
Every problem has at least one solution. Only some solutions are harder to find.
Mark Grant
Honored Contributor

Re: Duplicating a drive

I wondered about ignite but I'm not sure you can do an ignite build from a disk. On the other hand if it does work it is by far the best option for you.
Never preceed any demonstration with anything more predictive than "watch this"
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

Here's another question:
Is this the procedure to break a mirror after I've made my dupe? Or will this destroy the mirror?

Remove a mirror and/or the mirror drive
Remove the mirror from a logical volume:
lvreduce -m 0 /dev/vg00/lvol1

Remove the disk from the volume group:
vgreduce /dev/vg00 /dev/dsk/c?t?d?

Elmar P. Kolkman
Honored Contributor

Re: Duplicating a drive

DONT DO THE LVREDUCE.

It will leave your data unusable. Use lvsplit instead...
Every problem has at least one solution. Only some solutions are harder to find.
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

Ok, Anything else I should know before I do this? I hope I don't trash my system again!
Mark Grant
Honored Contributor

Re: Duplicating a drive

Yes,

Don't remove the disk from the volume group. Also, after you lvsplit the logical volumes it creates, you should check then with "fsck" before you attempt to use them.
Never preceed any demonstration with anything more predictive than "watch this"
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

What is the proper command for lvsplit in my case and how do I use fsck?
Mark Grant
Honored Contributor
Solution

Re: Duplicating a drive

"lvsplit /dev/vgXX/lvolX" for each logical volume.

"fsck -F vxfs -o full /dev/vgXX/rlvolX"
Never preceed any demonstration with anything more predictive than "watch this"
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

I'm doing it now and so far it was working until I did the:

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

I get a m illegal action...
should it be lvextend -m l instead of 1?
Elmar P. Kolkman
Honored Contributor

Re: Duplicating a drive

Do you have mirror UX installed on the system? If not, mirroring (which -m 1 implies) won't work...
Every problem has at least one solution. Only some solutions are harder to find.
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

Not sure...How do I check? And by doing the first couple of steps below which worked is my system still safe for a reboot if I need to?


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 WORKED

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

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

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

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 WORKED

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

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

Mark Grant
Honored Contributor

Re: Duplicating a drive

Try

"swlist | grep -i mirror"

If you don't have it, you are not going to be doing any mirroring and worse than that, it's not cheap either.

You haven't done any harm yet though :)

Lokos like we might need to go back to the backing up to disk option - sorry
Never preceed any demonstration with anything more predictive than "watch this"
Bernhard Mueller
Honored Contributor

Re: Duplicating a drive

That is what I suspected in the first place. Workstations usually do not have MirrorDisk/UX so you have no LVM mirroring capability.

What you should actually try (since you *do* have a tape drive, do you?) run
make_tape_recovery -x inc_entire=vg00 -I -a /dev/rmt/0mn

(replace vg00 if your root VG has another name, as well as /dev/rmt/0mn for the tape).

Note that if it does not fit on one tape it (pax) will prompt you to insert another one and enter "go" to proceed.

When this has "completed successfully" you run ioscan, note the HW path of the tape, halt your workstation at the Boot Console Handler and enter
bo
then you should see whether you are able to boot from this tape. You actually *could* proceed with the recovery from tape but, I guess that is something you might want to try at a later time...

An alternative would be to use your other disk as an "alternate root vg" i.e. create another vg on the disk and copy all the filesystems over into similar lvols.

Regards,
Bernhard
Patrick Wallek
Honored Contributor

Re: Duplicating a drive

Check for MirrorDisk being installed by doing:

# swlist -l bundle | grep -i mirror

If a line with "MirrorDisk/UX" shows up then it's installed. If not, then it aint.

If you don't have, you'll need to buy it. It is not a free product.
John Ramsay_2
Regular Advisor

Re: Duplicating a drive

I did the "swlist | grep -i mirror"
and I just went back to #.
I didn't install it and if it's not part of the basic install then I probably don't have it.
OK....The backing up to disk option...
I need it to be an EXACT dupe of the pri.
Where do I start to research this?