I want to remove a PV from a Volume Group on a system where a large amount of data is written to the disks all the time. I can use pvmove
to move all of the PV's physical extents to another PV and I did this a few times on lightly loaded systems where only a small amount of data is written to disks. In those cases when I finished moving all of the physical extents to another PV, the original PV was completely free and it could be removed from the volume group.
My concern is that on a heavily written volume when I finish pvmoving
all of the physical extents, LVM will reallocate space on the currently freed PV because it is still part of the Volume Group.
Is there a way to set the PV as readable, but not writable (or some kind of copy-on-write mode) so LVM won't try to write new data to the freed PV?
In other words, can I move all PE-s from a PV to another PV and remove the freed up PV from the Volume Group in an atomic operation?