LVM and VxVM

Difference between lvextend and lvsplit

 
Matthew_50
Valued Contributor

Difference between lvextend and lvsplit

Dear All guru, I need some advice.

Here's our situation, we have root disks mirrored(c0t12d0,c1t12d0), I would like to split it for migration usages, as following is my idea thinking. I know I can choose to boot from make_tape_recovery tape, but it's time consuming.

Case_A,
"lvextend -m 0 /dev/vg00/lvolX /dev/dsk/c1t12d0" to remove mirror-copy of each root volume
2. start migration tasks, if migration fail, boot by /dev/dsk/c1t12d0, and use 'lvextend -m 1 /dev/vg00/lvolX /dev/dsk/c1t12d0' to do the mirror-copy

Case_B,
use "lvsplit" and "lvmrege" to do the same thing, if fails, sync from the /dev/vg00/lvolXb

Case_C,
use -lq to bypass lvm quorm check when boot from c0t12d0, start migration tasks, if fail,
reboot from c1t12d0 without -lq, then resync the disks, if success, reboot from c0t12d0 and resync the disks
8 REPLIES 8
Naveej.K.A
Honored Contributor

Re: Difference between lvextend and lvsplit

Hi,

lvextend is not the command to reduce the mirror. you have to use

lvreduce -m 0 /dev/vg00/lvolx /dev/dsk/c1t12d0 for each logical volumes to reduce the mirror.


Regards,
--Naveej
practice makes a man perfect!!!
Steven E. Protter
Exalted Contributor

Re: Difference between lvextend and lvsplit

The procedure HP taught me at sysadmin school is thus:

To mirror:

lvextend -m 1

lvsplit is used to break the mirrors.

I've never used lvmerge to put mirrors back together.

The risk is that the mirrors have changed in some way making the merged logical volume a heap of magnetic garbage.

Hope this clarifies.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Suraj Singh_1
Trusted Contributor

Re: Difference between lvextend and lvsplit

Hi,

Use 'lvsplit' instead of 'lvreduce -m 0' (and not lvextend -m 0) to break mirror; and 'lvextend -m 1' to mirror.

Regards,
Suraj
What we cannot speak about we must pass over in silence.
Jdamian
Respected Contributor

Re: Difference between lvextend and lvsplit

I think there is a lot of issues you shoud be in mind before upgrading. I think all your proposals have lacks that prevent you to recover your original system in case of failure of your upgrade:

case A:
1) If you remove the copy mirror in your 2nd disk, you will not be able to boot from it because 2nd disk will have no PE of /dev/vg00/lvol3 (for example). In other words, you try to boot from a disk whose LVM header says that 2nd disk contains no PE of /dev/vg00/lvol3 (after removing disk mirror all PEs reside in 1st disk and, though PEs contains original data, they are seen as FREE PE).

2) you suggested to run 'lvextend -m 1 /dev/vg00/lvolX /dev/dsk/c1t12d0'... after booting from c1t12d0... This will copy data from c0t12d0 (containing bad data) onto c1t12d0 (containing safe system)

case C:

Booting using -lq in order to bypass LVM quorum check will NOT split any mirror. This is useful only for disk failures. If both disks are fine and mirror haven't been brokern, data from upgrade will be written to both disks.

case B: the most interesting (I had to use)

1) /dev/vg00/lvol3 must be splitted in last 'lvsplit' command because it holds /etc/lvmtab file.
2) After splitting you MUST fsck /dev/vg00/lvol3b (and all other lvols containing FileSys), mount it on any trivial dir (for example /m1), and CHANGE the logical volume names in this /m1/etc/fstab file (You must change lvol4 by lvol4b, lvol5 by lvol5b, and so on). If you plan to boot using OLD logical volumes (containing the pre-upgrade data) you must mount the /dev/vg00/lvolXb logical volumes, not the /dev/vg00/lvolX ones (containing bad data).

3) In LVM headers of boot disks, lvol1 and lvol3 are set as BOOT and ROOT devices. In case of upgrade failure and reboot from safe disk, I think these setting should be changed to lvol1b and lvol3b (I guess). Read lvlnboot man pages.



Please, read doc X1401978. It is a good guide for you.
Doug O'Leary
Honored Contributor

Re: Difference between lvextend and lvsplit

Hey;

Other people have posted parts of the answer; hopefully, this'll be all of it.

lvextend is used to extend lvs, not reduce them. To reduce mirrors, you want lvreduce -m 0 ${lv}

ISP> hpux -lq won't affect the mirrors either; that's not what you want.

In order to protect your operating system while upgrading your boot disk, do the following:

1. Use lvsplit to create new logical volumes of all vg00 based LVs. Note the new LV names.

2. Mount the split lv for the root filesystem. After creating a backup copy, update the split /mnt/etc/fstab to reflect all the split lvs instead of the originals.

3. Execute setboot to verify that the system sees the alternate boot disk as a valid boot path.

4. Upgrade; make damned sure you upgrade the correct disk.

5. If you need to eliminate the upgrade, boot from the alternate disk and execute

lvmerge -A n ${upgraded_lvs} ${split_lvs}

then restore the backed up copy of /etc/fstab
Then reboot to start using the old OS again.

It is complex, but it's not rocket science. Make sure you undestand what you're doing at each step. You can email me directly, if you want more direct help.

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
sivaji.v
New Member

Re: Difference between lvextend and lvsplit

Hi Matthew,

ALL our HPUX-Minds given diff solutions for your requirement. what i feel is that most of those are very complex.

i am giving very simple and safe solution.

1,Check your all LV's are got properly mirrored and not spaning accross the disk's

#lvdisplay -v /dev/vg00/l* |grep stale

2,shutdown and boot the system using alternate disk for confirming second disk is able to boot properly.

Main Menu> Bo Alt
ISL>hpux -lq

3,Hard shutdown the system.

4,Physically plug out any one of the disk.
Ex: alternate disk.

5, boot the system using Pri disk.
Main Menu> Bo Pri
ISL>hpux -lq

6,complete your activity (upgradation )and test for 3 to 4 days.

7,When ever you decided to re-sync simply plug the disk and run below command.
#ioscan -fnC disk
#vgchnage -a y vg00
#vgsync /dev/vg00
it will take little time and your system is ready.


In case of your upgrdation is fails or satuvation come for boot with old disk.

shutdown the HPUX and plug the alt disk and boot with alt. disk. Now your system will got rollback.

This i did severla time and i can assure it will work.

if have any dobut, you can contact me directly ..

regards,
Sivaji
Rory R Hammond
Trusted Contributor

Re: Difference between lvextend and lvsplit

I have never used a mirror disk for migration, but it should work. using lvsplit.

I use split and merge all of time. The secret for merge is to make sure you merge them back into the correct order.

I have never tried Option B but it should work.

I am going to give you a Case_D
what I use
1. you have a tape backup (make_tape_recovery)
2. boot disk are swapable.

3 lvreduce vg00 logical volumes and vgreduce c1t12d0.
4. dd if=/dev/rdsk/c0t12d0 of=/dev/rdsk/c1t12d0 bs=64k
5. you can now reboot and do your upgrade.
6.0 it your migration fails
a. swap disks c1t12d0 with c0t12d0
b. boot up and you have your orginal up.
7. After your migration is done
do the normal mkboot, vgextend, lvextend, etc,etc to the c1t12d0 to make it boot mirror of the upgrade c0t12d0.
(At step five you might want to swap disk
and boot off the copy and use it for the migration, that way you know
that your copy is good.)

Rory
There are a 100 ways to do things and 97 of them are right
Rita C Workman
Honored Contributor

Re: Difference between lvextend and lvsplit

Matthew,

Maybe you could explain, first, exactly what your migrating or hoping to do.

It's a bit skewed...are you doing and upgrade on your server, or are you migrating from one server to another...

Cause I'm hearing alot of folks saying what they 'think' you mean....but I'm not sure I heard it from you, what you mean.

Thanks,
Rita