[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lvm2 - question about pvmove



On 2009-07-13 14:24, Boyd Stephen Smith Jr. wrote:
In <[🔎] 4A5B841E.7010900@cox.net>, Ron Johnson wrote:
In your case, you'll have to add at least 3 of the new PVs to the VG
before pvmove will let you begin. Are you going to move swap onto LVM? If not, make sure your partition table for the new drive still has space
for swap.
So pvmove will spread the blocks across any empty devices?

1. Read the manpage.
2. You can specify a destination or destinations if you like. You can also limit the source to a single LV.
3. Yes.

Like others, I think having multiple PVs on a single physical disk is a
bit silly, but I don't foresee it causing any issues.
Is there an lvmove or vgmove?

There is no lvmove or vgmove, nor is there a need for them. Moving a VG to different physical media is handled via pvmove. Moving a LV to different physical media is handled via pvmove. Moving a PV to different phyical media doesn't make sense (usually) and is NOT handled via pvmove.

If you have a VG that is on /dev/sda2 and /dev/sdb and you want to move it (and, of course, all the LVs it contains) to /dev/sdc1, /dev/sdc2, /dev/sdc3, and /dev/sdc4, you do:
pvcreate /dev/sdc1
pvcreate /dev/sdc2
pvcreate /dev/sdc3
pvcreate /dev/sdc4
vgextend $vg /dev/sdc1
vgextend $vg /dev/sdc2
vgextend $vg /dev/sdc3
vgextend $vg /dev/sdc4

Here's the difference: your example assumes inserting the new hard drive and then moving the old data to it.

I don't yet have the new hard drive, and want to get all the data off of the old drive first.

So, I simply tried "pvmove $FAILING_PARTITION" but it instantly threw me an error.

Sadly, I didn't save it.

pvmove /dev/sda2
pvmove /dev/sdb
vgreduce $vg /dev/sda2
vgreduce $vg /dev/sdb
pvremove /dev/sda2
pvremove /dev/sdb

If your VG contains /dev/md1, a RAID-0 device, and /dev/sdb, a hardware RAID-6 device, and part of LV "home" was allocated to /dev/md1 accidentally or temporarily you can move that data to /dev/sdb with:
pvmove /dev/md1 -n home /dev/sdb


--
Scooty Puff, Sr
The Doom-Bringer


Reply to: