Read-only zpools have now been implemented in the source as proposed in PSARC/2010/306.
Previously individual filesystem have could be mounted as read-only, but now the whole pool can be imported this way:
# zool import -o readonly=on zpool01
When importing a pool with read-only, no writes will be performed to any of the devices in the pool, they are even opened read-only.
From the PSARC:
"When the 'readonly' property is 'on' (read-only) the following actions are performed:
1). pool is loaded but transaction processing is disabled
2). all filesystems and zvols are mounted in read-only mode
3). any intent-log replays are deferred (any pending synchronous
writes will be replayed once the pool is imported read-write)
The following restrictions apply when a pool is read-only:
1). Attempts to set additional zpool-level properties during import
2). All filesystem mounts are converted to include the 'ro'
3). Additional mount options may be set on a temporary basis.
A pool which has been imported read-only can be restored back to read-write by exporting and reimporting it."
PSARC/2010/306 Read-only ZFS pools
From Prometheus to Sisyphus
4 months ago