Operating System - Linux
1825805 Members
2182 Online
109687 Solutions
New Discussion

Re: pvmove - coding [DestinationPhysicalVolume[:PE[-PE]...]

 
SOLVED
Go to solution
MikeL_4
Super Advisor

pvmove - coding [DestinationPhysicalVolume[:PE[-PE]...]


I am moving some Logical Volumes to different LUN's but my question is simple...

Not sure of exact format for coding the [DestinationPhysicalVolume[:PE[-PE]...] on the command line...

If I am moving an extent to two or three seperate LUN's: /dev/mpath/mpath1 /dev/mpath/mpath2 and /dev/mpath/mpath3 what is the format for coding that on the command line ??
2 REPLIES 2
Matti_Kurkela
Honored Contributor
Solution

Re: pvmove - coding [DestinationPhysicalVolume[:PE[-PE]...]

> If I am moving an extent to two or three seperate LUN's

For LVM, one physical extent is an indivisible unit: you cannot split it to multiple destination PVs. One source extent will be moved to one destination extent, that's it.


If you want to make the LUN /dev/mpath/mpath1 empty (e.g. because it must be removed), but the mpath1 LUN is bigger than the destination LUNs, you can specify multiple destinations:

pvmove /dev/mpath/mpath1 /dev/mpath/mpath2 /dev/mpath/mpath3

This command will attempt to move all the extents away from mpath1: it will first use all the free extents on mpath2. If it is not enough, the remaining extents of mpath1 will be moved to mpath3. (Of course, mpath2 and mpath3 must already be members of the same VG for this to work at all.)

Note: the first (and only the first) PV you specify on the pvmove command line will be the source of the move operation. All the other disk devices will be (potential) destinations, to be used in order until there are no more allocated extents to move at the source.


Or you can specify no destinations at all:

pvmove /dev/mpath/mpath1

This command will attempt to make mpath1 empty by moving all the extents to any other PVs of the same VG. In this case, pvmove will grab any free extents space on the other PVs of this VG it needs to complete the move. This is the "I don't care how you do it, just make mpath1 empty so I can disconnect it, please" command.


If you want to only move a part of the contents:

pvmove /dev/mpath/mpath1:0-499 /dev/mpath/mpath2
pvmove /dev/mpath/mpath1:500-999 /dev/mpath/mpath3

These commands will move the first 500 extents of mpath1 to mpath2, and the next 500 extents to mpath3, no matter which LVs they belong to. If mpath1 contains more than 1000 extents, the remaining extents will not be moved.


Or if you want to move all of mpath1, but only use a part of mpath2's capacity and put all the rest to mpath3:

pvmove /dev/mpath/mpath1 /dev/mpath/mpath2:0-499 /dev/mpath/mpath3

This will move the first 500 extents of mpath1 to physical extents 0-499 of mpath2 (assuming that they are free; if not, the command will probably display an error message and do nothing). The rest of mpath1's contents are moved to mpath3.


If you really want to micro-manage extent allocation (for some special situation), you can even specify multiple groups of extents as either source or destination:

pvmove /dev/mpath/mpath1:0-999 /dev/mpath/mpath2:0-99:200-1999

This will move the first 1000 extents of mpath1 to mpath2, leaving a gap of 100 extents at mpath2 extents 100-199.


If you plan to move something to specific extents on the destination, you'd better be sure you know which extents are free and which are not. "pvdisplay -m" and "lvdisplay -m" will help here.

The output of "pvdisplay -m" adds to normal pvdisplay output a list of LV allocations on that PV:

--- Physical Segments ---
Physical extent 0 to 1023:
Logical volume /dev/vg0/lvol0
Logical extents 0 to 1023
Physical extent 1024 to 3071:
Logical volume /dev/vg0/lvol1
Logical extents 0 to 2047
Physical extent 3072 to 4607:
Logical volume /dev/vg0/lvol2
Logical extents 0 to 1535
Physical extent 4608 to 7102:
FREE

(If you're familiar with HP-UX, this is sort of like HP-UX "pvdisplay -v" output, only in more compact form.)

"lvdisplay -m" works in the same way.

MK
MK
MikeL_4
Super Advisor

Re: pvmove - coding [DestinationPhysicalVolume[:PE[-PE]...]

Thanks for the great explaination...