[linux-lvm] will pvmove'ing (an LV at a time) defragment?

Brian J. Murrell brian at interlinx.bc.ca
Sat May 1 13:26:35 UTC 2010

Brian J. Murrell <brian <at> interlinx.bc.ca> writes:
> If I currently have a volume group consisting of two drives and I add a third 
> drive and them pvmove from the two existing drives to the new drive, will that 
> defragment my LVs?  i.e.:
> # pvmove /dev/sda2 /dev/sdb /dev/sdc

As was pointed out, this syntax does not even work.

But moving a single LV at a time, first moving the "chunks" off of the first
disk then the second, is resulting in the defragmentation that I was hoping
for.  I guess this works reasonably straighforwardly because the second disk
was added as a result of the first disk being full and there has been no mass 
freeing of volumes on the first disk to cause future volume expansions to be
done on the first disk after expansions were done to the second disk.

That said, it is quite easy to move portions of an LV, so hooking pvmove into
a disk defragmentation algorithm shouldn't be difficult, if one can find a good 
defragmentation algorithm.

TBH, I'm surprised nobody has done such a thing, or if they have, too bad they 
did not contribute it back to the LVM project.  :-(


More information about the linux-lvm mailing list