0

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:

  1. Add a new, smaller, physical drive to the drive group
  2. Use pvmove to move the extents from the old drive to the new drive
  3. 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?

ibrewster
  • 377
  • 1
  • 4
  • 15
  • I was able to get this working by following the guide https://dsavenko.me/migrating-centos-system-from-hdd-to-smaller-ssd-on-xfs-filesystem/. In short, create a new, separate disk and use xfsdump to move the data. – ibrewster Mar 26 '20 at 20:54

1 Answers1

0

First of all you can't shrink root volume online. Reducing the logical volume on the root file system must be done in rescue mode.

Centos 7 has a default filesystem of XFS which cannot be reduced in size. please refer the link.

I would suggest, convert this volume as thin provision volume if possible.

Bright
  • 50
  • 1
  • 9
  • Yes, I'm aware you can't shrink XFS. That's why I came up with the procedure I suggested. However, if I can convert to a thin provisioned volume, that would work. – ibrewster Mar 26 '20 at 18:53