I am running on CentOS 7, lvm, with an XFS formatted root drive. As originally set up, the server had a single large root volume that contained both the OS and the data. The data has now grown, and I would like to move it off to a separate drive. This is simple enough, but at the end of the process it will leave a fairly large root drive almost empty. As this is a VM (proxmox server), and I would like to free up the host drive space, I want to "shrink" the root drive. So far the best procedure I have come up with is the following:
- Add a new, smaller, physical drive to the drive group
- Use
pvmove
to move the extents from the old drive to the new drive - Remove the old physical volume and discard the image
The problem I am having is with step 2: based on my knowledge, it will fail because there are fewer physical extents available on the new volume than are used on the old volume. I could move only a portion of the extents, but how do I know which ones actually contain the data? How can I best accomplish this?