LVM and VxVM

Extending a disk online by mirroring/pvmoving it

 
SOLVED
Go to solution
compiler
Frequent Advisor

Extending a disk online by mirroring/pvmoving it


Hi.

I have a disk (100GB) in an EVA storage at about 91% of usage. We're planning to create a bigger disk (200GB) and move all the data from "disk1" to "disk2" without stopping machine's services (that partition is holding Oracle datafiles). After that, I need to remove "disk1" from the system.

I've done a search in older itrc-forum's threads and I found some different options. Please, correct me if anything below this is wrong:


1.- Using pvmove: "pvmove disk1 disk2".

It's (for me) the simplest way to do it. I "pvcreate" disk2 and "vgextend" my vg to add it. Then I just do a "pvmove" of disk1 to disk2 so that all PE are moved. After this, I "vgreduce" disk1 and remove the disk from the EVA.

The questions:

- Is it safe?

- I've read the following on the manpage: """ The first extent of the physical volume can be moved to get extra space for metadata, while vgmodify can use this extra space to expand the metadata. To relocate the first extent, specify 0 after source_pv_path, delimited by a colon (:).". What this that mean? Do I need to do this in order to move my data and "destroy" disk1 after it?



2.- Using "lvextend -m 1" to mirror the disk.

On previous ITRC threads I've read about "lvextending -m 1" the disk, and "lvextending -m 0" after a while. How is supposed to do this (with my "disk1" and "disk2" disks).

My first thought about the above was adding a "disk3" of the same size of "disk1" and mirroring "disk1 - disk3" (for security purposes) and then doing "pvmove" to move "disk1" data to "disk2". After moving data, I lvextend -m 0 the mirror and destroy disk3.

Is the right way? Or can "lvextend -m 1" do the copy disk1 -> disk2 for me although having different sizes?

How can this "type of copy" can be done? :?


3.- Using MirrorDisk/UX.

We have HP-UX 11.23 ENTERPRISE. If I remember correctly, this includes Mirrordisk/UX License.

How would I make the disk1 -> disk2 moving with Mirrordisk?



That's it... the idea is ... which is the best and safer option and how do you recommend me to do the "data move operation"?

Would all the above methods work correctly when moving from a smaller disk to a bigger one? I mean, the resulting disk will have the LVM updated with my "extra" Free_PEs ? I imagine that after the moving, in all cases, I will be able to extend the FS online with fsadm ...

Thanks :)
10 REPLIES 10
Torsten.
Acclaimed Contributor

Re: Extending a disk online by mirroring/pvmoving it

First of all you need to check your VG maximum settings: does it allow to vgextend a larger disk?

use vgdisplay -v

If not, you cannot do this online.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Ivan Krastev
Honored Contributor

Re: Extending a disk online by mirroring/pvmoving it

The easiest way will be to use MirrorDisk - add the second disk to volume group, create mirror copy of all locical volumes over second disk, remove mirror copy from the 1st disk and remove 1st disk from volume group.

regards,
ivan
Ganesan R
Honored Contributor

Re: Extending a disk online by mirroring/pvmoving it

Hi,

There is little risk involved in pvmove.pvmove is not an atomic operation. Furthermore the command moves data extent by extent and is easily interruptable. If this happens, then the configuration is left in some weird inconsistent state showing an additional pseudo mirror copy for the extents in question. This can be cleaned up only using the lvreduce command.

So the safer way would be mirror all the lv's residing on disk1 to disk2 by specifying the disk2 in command line. Once all lv's are mirrored, you can remove the mirrors from disk1 and remove the disk out from the volume group.
Best wishes,

Ganesh.
Fred Ruffet
Honored Contributor

Re: Extending a disk online by mirroring/pvmoving it

hello,

Note that points 2 and 3 are the same. You need Mirror-UX installed in order to use "-m 1" option of lvextend. As others, I think using lvextend / lvreduce is a better way than pvmove.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Sharma Sanjeev
Respected Contributor
Solution

Re: Extending a disk online by mirroring/pvmoving it

Hi compiler

1. Check if you can extend you VG with Larger Disk if yes than

#vgextend /dev/vg_name new disk
#lvextend -m 1 /dev/vg_name/lv_name /dev/dsk/newdisk

#lvreduce -m 0 /dev/vg_name/lv_name /dev/dsk/olddisk

#vgreduce /dev/vg_name /dev/dsk/olddisk

its done

Regards
Sanjeev
Everything is Possible as " IMPOSSIBLE" word itself says I M POSSIBLE
compiler
Frequent Advisor

Re: Extending a disk online by mirroring/pvmoving it


Multiple answers:

Torsten wrote:
> First of all you need to check your VG
> maximum settings: does it allow to
> vgextend a larger disk?

Yes, because it contains other disks (in the same VG, for other LVs) that are larger or equal the size of the disk I want to add.

Fred Ruffet wrote:
> Note that points 2 and 3 are the same. You
> need Mirror-UX installed in order to use
> "-m 1" option of lvextend. As others, I
> think using lvextend / lvreduce is a
> better way than pvmove.

Something that I don't understand is ... if "-m" is a Mirror-UX option... how is it possible to have in my inherited hp-ux system "mirrored vg00 disks" but Mirrordisk UX software is not installed? Are root-disks LVM mirror created a different package? We have a machine that uses mirrored boot disks but I can't find no Mirrordisk software in it :-???

Sharma Sanjeev wrote:
> #vgextend /dev/vg_name new disk
> #lvextend -m 1 /dev/vg_name/lv_name /dev/dsk/newdisk
> #lvreduce -m 0 /dev/vg_name/lv_name /dev/dsk/olddisk
> #vgreduce /dev/vg_name /dev/dsk/olddisk

How much time should I wait between the -m1 command and the -m0 command (how to see if all the PE have been copied before the vgreduce?).


And, after that, it must follow lvextend + fsadm, right?


Thanks a lot.

Ivan Krastev
Honored Contributor

Re: Extending a disk online by mirroring/pvmoving it

>How much time should I wait between the -m1 >command and the -m0 command (how to see if >all the PE have been copied before the >vgreduce?).

It depends from the size of the lvols. It was something like 1GB for ~3 min.
You can check the progress with lvdisplay command:
lvdisplay -v /dev/vg_xx/lvolX | grep stale | wc -l

>And, after that, it must follow lvextend + >fsadm, right?
No, mirroring is enough.

regards,
ivan
compiler
Frequent Advisor

Re: Extending a disk online by mirroring/pvmoving it


>> And, after that, it must follow lvextend + >> fsadm, right?
>
>No, mirroring is enough.

??????

But I'm moving lvol1 from disk1 to disk2 because I'm running out of space in disk1...

I imagine that after the "mirroring" to disk2, I still have to lvextend lvol1 (to get the extra space on disk2) and use fsadm to extend the filesystem... but you say that "mirroring is enough" :?

Does the mirroring autoextend the lvol and fs? :?




regards,
ivan
Ivan Krastev
Honored Contributor

Re: Extending a disk online by mirroring/pvmoving it

If you have 100GB lvol over disk1 and mirror it over disk2 after removing the mirror copy from disk1 you will have a 100GB lvol over disk2.
And of course if you want to extend it use:

#lvextend -L size /dev/vg_xx/lvolX
#fsadm -F vxfs -b sizeM /mountpoint

regards,
ivan