xfs_growfs
Enlarge an XFS filesystem
SYNOPSIS
xfs_growfs [ options ] mount-point
PARAMETERS
mount-point
The path where the XFS filesystem to be grown is currently mounted. This is a mandatory argument.
-D size
Specifies the new size for the filesystem's data section, in filesystem blocks. If this option is omitted, the data section will be grown to the maximum size supported by the underlying device.
-L size
Specifies the new size for the filesystem's log section, in filesystem blocks. Resizing the log section is less common than the data section and typically done for performance tuning.
-R size
Specifies the new size for the filesystem's realtime section, in filesystem blocks. This section is used for applications requiring guaranteed bandwidth and low latency.
-d DataSectionOptions
Allows modifying advanced parameters of the data section, such as agcount N (number of allocation groups) or maxpct N (maximum percentage of space for inode allocation). This option is for advanced tuning, not direct size growth.
-l LogSectionOptions
Allows modifying advanced parameters of the log section, such as size N (log size in blocks) or maxpct N. This is typically used for performance tuning rather than primary resizing.
-r RealtimeSectionOptions
Allows modifying advanced parameters of the realtime section, such as extsize Nblocks (realtime extent size). This is used for fine-tuning realtime data allocation characteristics.
DESCRIPTION
The xfs_growfs command is a powerful utility used to expand the size of an existing XFS filesystem. Unlike many other filesystem resizing tools, xfs_growfs can perform its operation while the filesystem is mounted and in active use, making it an ideal choice for production environments requiring high availability.
It's crucial to understand that xfs_growfs does not resize the underlying block device (e.g., a disk partition or an LVM logical volume). Instead, it extends the XFS filesystem to utilize the newly available space on a block device that has already been resized beforehand. This tool primarily allows for growing the data section, but can also resize the log or realtime sections, either to a specified size or to fill the entire available space on the underlying storage.
CAVEATS
- The underlying block device (e.g., partition, LVM logical volume) must be extended first before running xfs_growfs.
- xfs_growfs can only extend an XFS filesystem; it cannot shrink it.
- The filesystem must be mounted to be grown.
- This command is specific to XFS filesystems and will not work with other filesystem types (e.g., ext4, Btrfs).
COMMON USAGE SCENARIO
The typical workflow for expanding an XFS filesystem involves two main steps:
1. Extend the underlying block device: Use tools like lvresize (for LVM logical volumes) or partition management tools (e.g., fdisk, parted) to increase the size of the partition or logical volume that hosts the XFS filesystem.
2. Run xfs_growfs: Execute xfs_growfs on the mounted XFS filesystem. For example, sudo xfs_growfs /mnt/mydata
will expand the filesystem to use all available space on the underlying device. Alternatively, specify a target size with sudo xfs_growfs -D new_size_in_blocks /mnt/mydata
.
3. Verify: Use df -h or xfs_info to confirm the filesystem's new size.
ONLINE OPERATION
One of the key advantages of xfs_growfs is its ability to perform online resizing. This means that the filesystem can remain mounted and accessible to applications and users during the expansion process, minimizing downtime. This capability is particularly beneficial for critical systems where service interruption must be avoided.
HISTORY
XFS (eXtended File System) was originally developed by Silicon Graphics, Inc. (SGI) for its IRIX operating system in the early 1990s. Its robust features, including online defragmentation and online resizing capabilities like xfs_growfs, made it attractive. XFS was ported to Linux in 2001 and has since become a widely adopted journaling filesystem, especially in enterprise environments where its scalability and online management features are highly valued.