Freezing a file system temporarily blocks all I/O operations to a file system and then performs a sync
on the file system. Current operations are completed and the file system is synchronized to disk. Freezing a file system is a necessary step for obtaining a stable and consistent image of the file system at the volume level.
Consistent volume-level file system images can be obtained and used with a file system snapshot tool. The freeze operation flushes all buffers and pages in the file system cache that contain dirty metadata and user data. The operation then suspends any new activity on the file system until the file system is thawed.
VxFS provides ioctl interfaces to application programs to freeze and thaw VxFS file systems. The interfaces are VX_FREEZE
, VX_FREEZE_ALL
, and VX_THAW
.
The VX_FREEZE
ioctl operates on a single file system. The program performing this ioctl can freeze the specified file system and block any attempts to access the file system until it is thawed. The file system thaws once the time-out value, specified with the VX_FREEZE
ioctl, has expired, or the VX_THAW
ioctl is operated on the file system.
The VX_THAW
ioctl operates on a frozen file system. It can be used to thaw the specified file system before the freeze time-out period has elapsed.
The VX_FREEZE_ALL
ioctl interface freezes one or more file systems. The VX_FREEZE_ALL
ioctl operates in an atomic fashion when there are multiple file systems specified with a freeze operation. VxFS blocks access to the specified file systems simultaneously and disallows a user-initiated write operation that may modify more than one file system with a single write operation. Because VX_FREEZE_ALL
can be used with a single file system, VX_FREEZE_ALL
is the preferred interface over the VX_FREEZE
ioctl.
The execution of the VX_FREEZE
or VX_FREEZE_ALL
ioctls results in a clean file system image that can be mounted after the image is split off from the file system device. In response to a freeze request, all modified file system metadata is flushed to disk with no pending file system transactions in the log that must be replayed before mounting the split off image.
Both the VX_FREEZE
and VX_FREEZE_ALL
interfaces can be used to freeze locally mounted file systems, or locally or remotely mounted cluster file systems.
The following table shows freeze/thaw compatibility with VxFS releases:
When freezing a file system, care should be taken with choosing a reasonable time-out value for freeze to reduce impact to external resources targeting the file system. User or system processes and resources are blocked while the file system is frozen. If the specified time-out value is too large, resources are blocked for an extended period of time.
During a file system freeze, any attempt to get a file descriptor from the root directory of the file system for use with the VX_THAW
ioctl causes the calling process to be blocked as the result the frozen state of the file system. The file descriptor must be acquired before issuing the VX_FREEZE_ALL
or VX_FREEZE
ioctl.
Use the VX_THAW ioctl to thaw file systems frozen with VX_FREEZE_ALL ioctl before the timeout period has expired.
The programming interface is as follows:
* A common mistake is to pass the address of "timeout".
* Do not pass the address of timeout, as that would be
* interpreted as a very long timeout period
if (ioctl(vxfs_fd, VX_FREEZE, timeout))
{perror("ERROR: File system freeze failed");
int vxfs_fd[NUM_FILE_SYSTEMS];
struct vx_freezeall freeze_info;
freeze_info.num = NUM_FILE_SYSTEMS
freeze_info.timeout = timeout;
freeze_info.fds = &vxfs_fd[0];
if (ioctl(vxfs_fd[0], VX_FREEZE_ALL, &freeze_info))
{perror("ERROR: File system freeze failed");
for (i = 0; i < NUM_FILE_SYSTEMS; i++)
if (ioctl(vxfs_fd[i], VX_THAW, NULL))
{perror("ERROR: File system thaw failed");