fsadm
Resize file systems safely and easily
TLDR
Check a filesystem for errors
Perform a dry-run resize to a specific size (no changes made)
Grow a filesystem to fill the entire device (omit the size)
Resize the filesystem and the underlying logical volume together
For ext2/3/4, unmount and resize offline
SYNOPSIS
fsadm [-v] [-d] [-x] [-h] [-V] {check|resize|grow|shrink} filesystem_or_device [size[MGTPE]]
PARAMETERS
-v
Enables verbose output, showing more details about the operations being performed.
-d
Enables debug output, providing highly detailed information useful for troubleshooting.
-x
Prints the command that would be executed, but does not actually run it (dry run).
-h
Displays a help message and exits.
-V
Displays version information and exits.
check
Checks the integrity of the specified filesystem for errors.
resize
Resizes the filesystem to the specified size. This command can grow or shrink the filesystem.
grow
Grows the filesystem to the specified size, or to the maximum available space if no size is provided. This typically requires the underlying partition/LV to be already expanded.
shrink
Shrinks the filesystem to the specified size. This operation can be dangerous and should only be performed after careful consideration and backup. The underlying partition/LV must be shrunk afterwards.
filesystem_or_device
The path to the filesystem mount point (e.g., /home) or the device path (e.g., /dev/sda1, /dev/mapper/vg0-lv0).
size[MGTPE]
The target size for resize operations. Can be specified in bytes or with a unit suffix: M (MiB), G (GiB), T (TiB), P (PiB), E (EiB).
DESCRIPTION
fsadm is a high-level utility designed to streamline common filesystem administration tasks, including checking integrity and resizing filesystems. It serves as a universal wrapper, abstracting the complexities of different filesystem types by automatically detecting the filesystem (e.g., ext4, XFS, Btrfs) and invoking the appropriate underlying low-level tool (such as resize2fs, xfs_growfs, or btrfs filesystem resize). This consistent interface simplifies operations for administrators, eliminating the need to memorize specific commands or syntax for each filesystem type.
fsadm aims to provide a safer and more user-friendly experience when performing critical operations like growing a filesystem to utilize expanded underlying storage, or cautiously shrinking one to free up space. It is particularly useful in environments with diverse filesystem deployments or when scripting automated maintenance routines, enhancing efficiency and reducing potential errors associated with manual, type-specific command execution.
CAVEATS
As a wrapper, fsadm relies on the specific underlying filesystem tools. Any limitations or risks associated with those tools (e.g., data loss during shrinking) apply.
Shrinking a filesystem is inherently risky and can lead to data loss if the specified size is smaller than the actual data stored. Always back up critical data before attempting to shrink a filesystem.
For resize operations, fsadm only modifies the filesystem itself. The underlying partition or Logical Volume (LV) must be resized separately using tools like fdisk, parted, or lvresize. When growing, extend the partition/LV before using fsadm grow. When shrinking, use fsadm shrink before shrinking the partition/LV.
WRAPPER FUNCTIONALITY
fsadm intelligently detects the filesystem type of the target device or mount point. Based on this detection, it then executes the appropriate low-level, filesystem-specific utility. This design makes fsadm highly adaptable and avoids the need for it to implement complex filesystem-specific logic internally.
INTERACTION WITH LVM
While fsadm can operate on Logical Volumes (LVs), it's crucial to understand that it only modifies the filesystem residing on the LV. To resize the LV itself, separate LVM commands like lvresize must be used. For growing a filesystem, the LV must be extended before using fsadm grow. For shrinking, fsadm shrink must be run before shrinking the LV with lvresize.
HISTORY
fsadm is a component of the util-linux project, a comprehensive collection of fundamental system utilities for Linux. It was introduced to address the fragmentation of filesystem administration tools, providing a single, consistent command-line interface for tasks that previously required users to remember and use different utilities for each filesystem type (e.g., resize2fs for ext4, xfs_growfs for XFS). Its development aimed to simplify scripting and general system administration by offering a unified approach to common filesystem operations.
SEE ALSO
resize2fs(8), xfs_growfs(8), btrfs-filesystem(8), fdisk(8), parted(8), lvm(8), lvresize(8), mkfs(8), mount(8)