Growing an XFS File System

Use the xfs_growfs command to increase the size of an XFS file system if space is available on the underlying devices to accommodate the change.

Note:

You can't grow an unmounted XFS file system. Also, no command exists to shrink an XFS file system.

The xfs_growfs command doesn't have any effect on the layout or size of the underlying devices.

If you're using Logical Volume Manager (LVM), you can use the vgextend command to increase the storage that's available to an LVM volume group and lvextend to increase the size of the logical volume that contains the file system.

You can't use the parted command to resize a partition that contains an XFS file system. You must instead re-create the partition with a larger size and restore its contents from a backup if you deleted the original partition or from the contents of the original partition if you didn't delete it to free up disk space.

You can either increase the size of the file system to a specified size expressed in file system blocks, or you can increase the size to use the maximum available space on the device.

  • Increase the size of the file system to a specified size by using the xfs_growfs -D <size> command.

    For example, you would increase the size of /mnt to 4 TB, assuming a block size of 4 KB, as follows:

    sudo xfs_growfs -D 1073741824 /mnt
  • Increase the size of the file system to the maximum size that the underlying device supports by using the xfs_growfs -d command.

    To increase the size of the file system to the maximum size that the underlying device supports, specify the -d option:

    sudo xfs_growfs -d /mnt