freeze
Freeze XFS filesystem
TLDR
Generate an image of code based on a file
Specify the output path
Generate an image of terminal output
Interactively customize the output image
Select a theme for syntax highlighting
Use a base configuration template
Capture a specific range of line numbers
Show line numbers
SYNOPSIS
fsfreeze [-f | -u] mountpointfsfreeze -h | -V
PARAMETERS
-f, --freeze
Freezes I/O on the specified mountpoint. All writes are suspended until the filesystem is unfrozen. The command will wait until all pending operations complete before freezing.
-u, --unfreeze
Unfreezes I/O on the specified mountpoint. Resumes normal read/write operations that were suspended by a previous freeze command.
-V, --version
Displays version information for fsfreeze and exits.
-h, --help
Displays a help message showing usage and options, then exits.
DESCRIPTION
The fsfreeze command is used to suspend or resume all access to a filesystem, effectively pausing all I/O operations on it. This functionality is crucial for creating consistent snapshots of filesystems, especially when performing backups or creating Logical Volume Manager (LVM) snapshots. When a filesystem is frozen, all pending writes are committed, and no new writes are allowed until it is unfrozen. This ensures that any subsequent snapshot captures the filesystem in a consistent state without any ongoing modifications, thereby preventing data corruption or inconsistencies in the backup.
It operates on a specified mountpoint, interacting with the kernel's filesystem freezing interface. Successful execution requires superuser privileges.
CAVEATS
Freezing a filesystem for an extended period can lead to system instability, applications hanging, or even data loss if not managed properly, as they will be unable to perform I/O operations. It is typically used for very brief durations, just long enough to create a consistent snapshot.
fsfreeze requires root privileges to execute; non-root users will receive a permission denied error.
Not all filesystems support freezing. While common journaling filesystems like XFS, ext4, and Btrfs generally do, older or less common ones might not.
If the system crashes or fsfreeze -u is not called after a freeze, the filesystem may remain frozen after a reboot, potentially requiring manual intervention or specific recovery steps. However, modern kernels often detect and automatically unfreeze filesystems during boot.
USAGE WITH LVM SNAPSHOTS
fsfreeze is commonly employed in a workflow that involves LVM snapshots. The typical sequence is to first freeze the origin logical volume's filesystem using fsfreeze -f. Immediately after freezing, an LVM snapshot is created from the origin volume. Once the snapshot is created, the origin filesystem is promptly unfrozen using fsfreeze -u. This ensures that the snapshot is consistent, and the backup can then be safely taken from the newly created snapshot volume without impacting the live system.
KERNEL INTERFACE
Underneath, the fsfreeze command interacts with the Linux kernel through specific ioctl calls: FIFREEZE to suspend filesystem I/O and FITHAW to resume it. These system calls are what actually suspend and resume filesystem operations at a low level within the kernel.
HISTORY
The concept of freezing filesystem I/O originated with specific filesystem utilities, such as xfs_freeze, which provided this capability exclusively for XFS filesystems. As the need for consistent snapshots across various journaling filesystems grew, fsfreeze was developed as a more generic interface, often integrated into the util-linux package. Its primary purpose has consistently been to facilitate reliable filesystem snapshots for backup and disaster recovery strategies, particularly in conjunction with Logical Volume Manager (LVM) capabilities.
SEE ALSO
mount(8), umount(8), lvm(8), xfs_freeze(8)


