zforce
Force a .gz file to have a .gz extension
TLDR
Add a .gz extension to the supplied Gzip files (Note: Other files are ignored)
SYNOPSIS
zforce [-r] filesystem
PARAMETERS
-r
Recursively applies the force-readonly operation to all descendant filesystems within the specified pool or dataset.
filesystem
The name of the ZFS filesystem or pool to operate on. If a pool is specified without -r, only the top-level dataset of the pool is affected.
DESCRIPTION
zforce is a ZFS utility command used to force a ZFS filesystem or an entire pool's filesystems into a read-only state. This command is primarily employed in scenarios where a ZFS filesystem is marked as writable but cannot be mounted read-write due to underlying issues like corruption, errors, or a degraded/faulted pool.
By setting the `readonly` property, zforce allows administrators to potentially import a problematic pool or mount a specific filesystem in a safe, read-only mode for diagnostic purposes or data extraction, even if it's otherwise unmountable. It does not perform any data repair or modification; it simply changes the filesystem's metadata property to prevent writes, thus avoiding further damage or mount failures. This is often a critical step in a recovery process for damaged ZFS datasets.
CAVEATS
zforce does not actually mount the filesystem; it merely modifies the `readonly` property of the dataset's metadata. The pool containing the filesystem must be imported, even if it's in a degraded or faulted state, for zforce to operate.
This command is considered a last-resort tool for problematic datasets. Misuse or incorrect application can prevent legitimate write access until the `readonly` property is manually reverted using `zfs set readonly=off filesystem`. Always exercise caution as it can impact data integrity if not used properly in a recovery context. Root privileges are required to execute this command.
<B>USAGE SCENARIO</B>
Imagine a ZFS pool that is degraded and you cannot mount a specific filesystem because it claims to be writable but the underlying storage issues prevent writes. Running `zforce mypool/myfilesystem` would set that filesystem's `readonly` property to `on`, allowing you to then attempt to mount it read-only, potentially recovering data or diagnosing the issue without risking further corruption.
<B>REVERTING READ-ONLY STATE</B>
To revert a filesystem from the read-only state imposed by zforce, you must manually set the `readonly` property back to `off` using the command: `zfs set readonly=off filesystem_name`. This can only be done once the underlying issues preventing write access have been resolved.
HISTORY
zforce is an integral part of the ZFS filesystem utilities. ZFS, originally developed by Sun Microsystems, was open-sourced as OpenZFS after Oracle acquired Sun. The zforce command emerged as a necessary tool within the ZFS ecosystem to handle difficult recovery scenarios for datasets, evolving with the robust and complex nature of ZFS itself. Its functionality has remained consistent as ZFS matured across various Unix-like operating systems.