How to reduce XFS file system



Environment

  • Red Hat Enterprise Linux 5, 6, 7
  • LVM
  • XFS (Add-on as per RHEL5 and 6 / part of RHEL7)

Issue

  • How to reduce the size a partition formatted with xfs filesystem?
  • How can I reduce the size a LVM partition formatted with xfs filesystem?

Resolution

  • It is currently not possible to reduce the size of a partition or logical volume with the xfs filesystem. If you are interested in this functionality please contact Red Hat support and reference Red Hat bugzilla 1062667, provide your use-case for needing XFS reduction / shrinking, and the reason(s) the below workarounds are not feasible.

Workarounds

  • In some cases, the following workarounds may be acceptable:
    • Use thin provisioned LVM volumes below the XFS filesystem.
    • Use some backup / restore solution, such as xfsdump / xfsrestore. This may be useful especially if the filesystem is mostly empty.

Root Cause

While the XFS file systems can be grown while mounted, their size cannot be reduced. This feature has been discussed on the upstream xfs mailing lists for over 10 years, but the feature is deemed to be complex and risky, and limited critical use cases are believed to exist.

Diagnostic Steps

·         This limitation is mentioned in product documentation, Check the NOTE section from product documentation here How to resize xfs filesytem.
·         Also, refer the upstream link which gives more information about Shrinking Support of xfs filesystem.

1 comment:

Anonymous said...

good article