[CentOS] CentOS 7 - xfs shrink & expand

Wed May 13 23:29:32 UTC 2020
Mark Milhollan <mlm at pixelgate.net>

Correct, XFS filesystems cannot be shrunk (reduced) dynamically, like 
ext2/3/4 can, only grown.  You need to create another, smaller 
filesystem (XFS too usually) then copy the existing content which can be 
done with tools like xfsdump & xfsrestore (iff both are XFS), rsync, pax 
(spax), or tar, typically while the system is in single user mode so 
that no changes can occur (and be lost).  Which exact steps depend, as 
usual.  If there's nothing on that USB drive you want then you can 
expand the VG onto it (gdisk, pvcreate then vgextend), make a new, 
smaller LV (lvcreate) and filesystem (mkfs), copy the content, remove 
the old LV (lvremove), then move the new LV off the USB array onto your 
normal storage (pvmove) then remove the USB array from the VG 
(vgreduce), at which point you should be able to grow (lvextend) your 
root.


/mark