I would like to pvmove
a logical volume to a smaller, but faster drive, leaving the excess part on the original drive. Can that be easily accomplished?
I've been going through the process of reducing the size of a Centos 6.10 image by reducing an lvmgroup. I'm at the point where I've been able to run this command:
pvresize -tv --setphysicalvolumesize 1600G /dev/md125p2
And it's giving me the following error message:
/dev/md125p2: cannot resize to 409599 extents as later ones are allocated.
I'm trying to understand how to construct the pvmove command to get rid of the error, but I don't quite get the concept.
Here is the output of this command pvs -v --segments /dev/md125p
PV VG Fmt Attr PSize PFree Start SSize LV Start Type PE Ranges
/dev/md125p2 vg_centos6svr lvm2 a--u 1.86t 320.11g 0 384000 lv_mysql 0 linear /dev/md125p2:0-383999
/dev/md125p2 vg_centos6svr lvm2 a--u 1.86t 320.11g 384000 81947 0 free
/dev/md125p2 vg_centos6svr lvm2 a--u 1.86t 320.11g 465947 12800 lv_root 0 linear /dev/md125p2:465947-478746
/dev/md125p2 vg_centos6svr lvm2 a--u 1.86t 320.11g 478747 1998 lv_swap 0 linear /dev/md125p2:478747-480744
/dev/md125p2 vg_centos6svr lvm2 a--u 1.86t 320.11g 480745 7500 lv_home 0 linear /dev/md125p2:480745-488244
I know the move command has to look something like this:
pvmove --alloc anywhere /dev/md125p2 vg_centos6svr:yyyy-end
I'm just not clear how to calculate the yyyy-end part. I figure it means move that 81947 (blocks?) that start at 384000, but what is "yyyy" and "end"?
So, I had disk failure and was moving LVs from the failing disk, to the new PVs. Some LVs were moved successfully, some not. Afterwards I ended up with following state: - two locked LVs - volume group with missing PV
When I try to remove PV, I get:
vgreduce --removemissing --force vg3
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Removing partial LV var.
Can't remove locked LV var
lvremove -fff vg3/var
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Can't remove locked LV var
pvmove --abort
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Cannot change VG vg3 while PVs are missing.
Consider vgreduce --removemissing.
Skipping volume group vg3
I also tried executing vcfgbackup and then restore after editing the locks out, but to no avail:
vgcfgrestore --force vg3
Couldn't find device with uuid RQr0HS-17ts-1k6Y-Xnex-IZwi-Y2kM-vCc5mP.
Cannot restore Volume Group vg3 with 1 PVs marked as missing.
Restore failed.
So I went even further, and inserted the disk back - its failed, but it is detectabled for a bit.
vgreduce --removemissing vg3
/dev/vg3/var: read failed after 0 of 4096 at 9638445056: Input/output error
/dev/vg3/var: read failed after 0 of 4096 at 9638502400: Input/output error
WARNING: Partial LV var needs to be repaired or removed.
WARNING: Partial LV pvmove1 needs to be repaired or removed.
There are still partial LVs in VG vg3.
To remove them unconditionally use: vgreduce --removemissing --force.
Proceeding to remove empty missing PVs.
lvremove -fff vg3/var
/dev/vg3/var: read failed after 0 of 4096 at 9638445056: Input/output error
/dev/vg3/var: read failed after 0 of 4096 at 9638502400: Input/output error
Can't remove locked LV var
pvmove --abort
/dev/vg3/var: read failed after 0 of 4096 at 9638445056: Input/output error
/dev/vg3/var: read failed after 0 of 4096 at 9638502400: Input/output error
Cannot change VG vg3 while PVs are missing.
Consider vgreduce --removemissing.
Skipping volume group vg3
And this is the moment, at which I am out of ideas.
I ran into an interesting error when attempting to address a particular problem.
We had an issue where we have to move the extents over to new physical volumes because the metadata size was too small (255 sectors or 128k). We have increased the pvmetadatasize in /etc/lvm.conf to 32768 and use the size of 4K for the metadatasize on the new physical volumes, so we believe are good in that aspect. But then, as we were moving the last couple of volumes (they were about 500 gigs of data per volume), we ran got this error:
metadata too large for circular buffer
Which is curious, given the setting we made. We did eventually worked around the problem by re-running the pvmove command on to the various volumes until we moved on the data, though.
Looking at the man page, we see this:
1. A temporary pvmove logical volume is created to store details of all the data movements required.
My question is: Which default metadata size is used during the pvmove process? Is it the source PV, the destination PV or setting used in /etc/lvm.conf?
The systems are running CentOS 5.6, and most of the volumes we used are around 500 Gigs per PV.
I ran pvmove to migrate extents from an old LVM disk to a new one but I forgot to create the partition structure on the new disk first:
pvmove /dev/sdb1 /dev/sdc
Everything seems to be fine, but I'm wondering if I should move it off the new disk again, create the partition structure, then back on? It seems like the only caveat to not doing this is that someone else might look at the disk & realize there's no partition structure on it & format it. I'm the only one who manages them at all at this point.
Also, is there a way to do this that doesn't involve more pvmoves?