Closed swapdisk closed 3 months ago
Here's another example reproducer. This one is using latest Fedora 40...
root@fedora:~# uname -r
6.9.7-200.fc40.x86_64
root@fedora:~# rpm -qf $(which pvmove)
lvm2-2.03.23-1.fc40.x86_64
root@fedora:~# vgcreate testvg /dev/vdb5
Physical volume "/dev/vdb5" successfully created.
Creating devices file /etc/lvm/devices/system.devices
Volume group "testvg" successfully created
root@fedora:~# lvcreate -l 6 -n lv1 testvg
Logical volume "lv1" created.
root@fedora:~# lvcreate -l 6 -n lv2 testvg
Logical volume "lv2" created.
root@fedora:~# pvdisplay -m /dev/vdb5
--- Physical volume ---
PV Name /dev/vdb5
VG Name testvg
PV Size 100.00 MiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 24
Free PE 12
Allocated PE 12
PV UUID PWI6f9-spby-F3Qj-mxXH-1Z7I-L4Yl-f2DXIB
--- Physical Segments ---
Physical extent 0 to 5:
Logical volume /dev/testvg/lv1
Logical extents 0 to 5
Physical extent 6 to 11:
Logical volume /dev/testvg/lv2
Logical extents 0 to 5
Physical extent 12 to 23:
FREE
root@fedora:~# pvmove --alloc anywhere /dev/vda5:4-7
Cannot use /dev/vda5: device not found
Run `pvmove --help' for more information.
root@fedora:~# pvmove --alloc anywhere /dev/vdb5:4-7
Internal error: Referenced LV pvmove0 not listed in VG testvg.
root@fedora:~# echo $?
Fixed with upstream commit https://github.com/lvmteam/lvm2/commit/07b6174f7cb3ac70df2791d54f654d6d5ca36169 Thanks for noticing.
I've run into what looks like a bug with the
pvmove
utility. I have managed to narrow it down the following easy reproducer. Thepvmove
fails with "Internal error" if given a PE range that happens to include LE's from more that one LV. For example...The given PE range 250-260 includes some LE's from
lv1
and some fromlv2
and that's the condition that reproduces the issue.Observed behavior
The
pvmove
fails with "Internal error: Referenced LV pvmove0 not listed in VG" and exit status 5.Expected behavior
With plenty of free PE's available, the
pvmove
command should happily move the requested range of PE's.Manual workaround
The expected behavior can be achieved by running
pvmove
more than once giving PE ranges that include LE's from only one LV at a time, for example:More info
Kindly let me know if there's any further information you need.