-   Linux - Software (
-   -   Logical Volume Management "pvmove" Question (

jamida 02-10-2008 12:53 PM

Logical Volume Management "pvmove" Question
Apologies in advance if this is not the right forum, but I can't figure out where else to ask this.

I'm in an argument with another Linux user and we're disagreeing on how PVMOVE works. Say you have a 4 500G disk (linear (non-striped)) volume which currently has 700Gigs of free space. I thought I could run pvmove to remove one of the disks and pvmove would copy that device's contents (if any) to free space anywhere. My friend believes that pvmove moves data to an unassigned disk. So I'd have to first add a new disk then do the pvmove.

One of the disks in my batch of 4 has gone faulty and I'm trying to remove it from the volume before I add a replacement, (I've had problems with this in the past but that's a subject for a diff question) so it's rather hard for me to try both methods. So I'm wondering if someone on this board knows for sure.



rayfordj 02-23-2008 09:56 AM

I have used pvmove (RHEL4 mostly but also RHEL5) at least a dozen times.

You'll need enough storage on disks other than the one you are moving extents off of.

say you have 4 disks each with one partition that is Linux LVM (sd[bcde]1) and sdc is the one going south on you and you have enough free PEs on on the remaining 3 disks to move the extents from sdc1.

NOTE: you can use lvdisplay's "--maps" option to identify where the LogicalVolume's extents are located to confirm before and/or after


pvmove -b /dev/sdc1
In my trials (and i'm glad i tested it a few times on a spare system) i found that if i did not use the -b when starting the pvmove i ended up with head-aches (i'm sure due to user-error). Since then i always start it with -b and have had no outages or problems during the process.

you can view the progress by running pvmove with the -i <seconds> option to see how much longer you have to wait ;) so my typical invocation of this entire process looks something like this


pvmove -b /dev/sdc1
pvmove -i 10

and then i'll detach from screen after watching it out of the corner of my eye for a couple of minutes, checking in on it from time to time just to see how it's doing.

then once the pvmove has been successfully completed, confirm that no LV extents are on sdc1, proceed with vgreduce, pvremove, ...

if you want to move all extents to a specific PV in the VG then you can specify it in your pvmove, otherwise, it'll move to any available extents on any of the other PVs.

Short answer:
If you have enough extents available on other PVs in this VG you may successfully use pvmove without adding another PV to this VG.

If you do not have enough extents available on the other PVs in this VG you will need to either free up extents (deleting/reducing LVs) or create more extents by adding PV(s)

jamida's the winner of the argument, no?

All times are GMT -5. The time now is 01:29 AM.