freezefs(2)freezefs(2)NAMEfreezefs - The freezefs() API causes the specified fileset's domain to
enter into a metadata stable state, causes a previously frozen file‐
set's domain to resume normal activity, or queries the freeze state of
the fileset's domain. All the filesets in the AdvFS domain are
affected.
SYNOPSIS
#include <sys/mount.h>
int freezefs {
char *mountPoint,
u_long optionFlags,
int timeout };
);
PARAMETERS
Points to a null-terminated string that contains the appropriate mount
point of the file system. Specifies what action to take on the speci‐
fied file system.
FS_Q_QUERY
Queries the freeze state and indicates whether or not the domain
is frozen by way of the return code.
FS_Q_FREEZE
Places the filesystem in a metadata consistent state and guaran‐
tees that it stays that way until thawed. All metadata, which
could be spread across multiple volumes or logical units (LUNS),
is flushed to disk and does not change for the duration of the
freeze.
FS_Q_THAW
Causes a previously frozen fileset's domain to resume normal
activity.
timeout
Specifies the maximum time allowed for the fileset's domain to
remain frozen:
> 0
Specifies the timeout value in seconds.
= 0
Uses the default timeout specified in the vfs stanza of
/etc/sysconfigtab as freezefs_default_timeout. If not specified
in /etc/sysconfigtab, freezefs uses 60 seconds.
< 0
Specifies no timeout. The fileset's domain remains frozen until
explicitly thawed.
Certain system events on a cluster will cause automatic thaws regard‐
less of timeout value. See DESCRIPTION for more information.
DESCRIPTION
To allow coherent hardware snapshots in multivolume domain configura‐
tions, filesystem metadata must be consistent across all volumes when
the individual volumes are snapped or cloned. These configurations
include both multivolume AdvFS domains and multivolume LSM logical vol‐
umes.
The FS_Q_FREEZE option to the freezefs API places the filesystem in a
metadata-consistent state and guarantees that it stays that way until
thawed. All metadata, which could be spread across multiple volumes or
logical units (LUNs), is flushed to disk and does not change for the
duration of the freeze.
The filesystem thaws either by timing out or explicitly with the
FS_Q_THAW option to the freezefs() API. If you are running a cluster
configuration, shutting down any node or the failure of any node will
also thaw the filesystem.
The exact nature of the freezefs API depends on whether you are running
on a single system or a cluster.
Single System
When you freeze a filesystem, any in-process metadata updates are
allowed to finish. Filesystem operations that do not modify metadata
are allowed while frozen. Some operations will work normally even if
the target fileset's domain is frozen, for example: Read No-extending
write Stat
Filesystem operations that modify metadata are blocked. The following
operations will block if the target fileset's domain is frozen, for
example: Mount of fileset rmvol Extending write mkfset / rmfset
The following filesystem operations will fail immediately if the target
filesystem (that is, domain) is frozen: Mount update of fileset Unmount
of fileset
Cluster
When you freeze a filesystem in a clustered configuration, all in-
process filesystem operations are allowed to complete. Some filesystem
operations are allowed while frozen. The following operations, which do
not require metadata updates, will work normally even if the target
filesystem is frozen. Read Stat
Most new filesystem operations are blocked when the filesystem is
frozen. Operations that have the potential for requiring metadata
updates will block if the target filesystem is frozen, for example:
Write chmod Link
Some filesystem operations will fail immediately if the target domain
is frozen, for example: Unmount of fileset Mount (update) of fileset
User-initiated planned relocation User-initiated forced unmount addvol
rmvol
The freezefs() API posts an event manager (EVM) event when a file sys‐
tem is frozen or thawed. Use the evmwatch and evmshow commands to
determine if any file systems in the cluster are frozen. See EXAMPLES.
NOTES
At present, freezefs and thawfs functionality is only implemented for
AdvFS filesystems.
Using the freezefs() API for a single mount point affects all filesets
in the domain.
In a cluster configuration, some system events may cause an automatic
thaw regardless of the timeout option. See the DESCRIPTION section for
more information.
RESTRICTIONS
You must be root user to run freezefs and thawfs. The /, /usr and /var
file systems cannot be frozen.
EXIT STATUS
Success FS_Q_FREEZE and FS_Q_THAW
Not frozen FS_Q_QUERY Frozen FS_Q_QUERY An error occurred.
ERRORS
The freezefs is not supported by the filesystem specified. The
filesystem is not mounted. Not enough memory. The file system is
already frozen freezefs, or
The file system is not frozen thawfs. The caller does not have
root privilege. Option not supported.
EXAMPLES
To freeze a file system: #include
extern errno;
...
char *mp;
u_long flags;
int timeout, rc;
...
mp = "/oracle"; /* filesystem to freeze */
flags = FS_Q_FREEZE; /* freeze flag */
timeout = 0; /* use default timeout */
...
errno = 0;
rc = freezefs(mp, flags, timeout);
if (rc = -1) {
error
}
.
.
.
PERFORM WORK ON FROZEN FILE SYSTEM
.
.
.
flags = FS_Q_THAW; /* thaw flag */
errno = 0;
rc = freezefs(mp, flags, timeout);
if (rc = -1) { /* If error on thaw, cannot rely on the
intial freeze */
error
}
SEE ALSO
Commands: freezefs(8), thawfs(8)freezefs(2)