XFS is an open-source (GPL) journaling file system originally developed by Silicon Graphics. The suport for XFS file system is available on most Linux distros nowadays. In fact, XFS has become the default file system adopted by the latest CentOS/RHEL 7. One of its many features is "online resizing", where an existing XFS file system can be expanded while it is mounted. Support for shrinking an XFS file system is not available though.
To expand an existing XFS file system, you can use a command line utility called xfs_growfs, which is available by default on most Linux distros. Since XFS supports online resizing, the target file system can be mounted or unmounted.
Here is the basic usage of xfs_growfs:
As the destination XFS file system to expand, you can specify either a mountpoint, a disk partition, or logical volume (in case of LVM). You specify the size of a new XFS file system as the number of data blocks. You can use xfs_info command-line tool to check data block size and the number of data blocks:
To extend the size of an XFS file system to 1986208:
If you do not specify size with "-D" option, xfs_growfs will automatically expand an XFS file system to the largest possible size.
Note that when you expand an existing XFS file system, you must prepare added space for the XFS file system to grow beforehand. It may be obvious, but if there is no free space available in the underlying partition or disk volume, xfs_growfs will not do anything. Also, if you attempt to extend XFS file system size beyond the size of disk partition or volume, xfs_growfs will fail.
Subscribe to Ask Xmodulo
Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!