Using ZFS Alternate Root Pools

When a pool is created, it is intrinsically tied to the host
system. The host system maintains information about the pool so that it can
detect when the pool is unavailable. Although useful for normal operations, this information can
prove a hindrance when you are booting from alternate media or creating a
pool on removable media. To solve this problem, ZFS provides an alternate root pool
feature. An alternate root pool does not persist across system reboots, and all
mount points are modified to be relative to the root of the pool.

Creating ZFS Alternate Root Pools

The most common reason for creating an alternate root pool is for
use with removable media. In these circumstances, users typically want a single file system,
and they want it to be mounted wherever they choose on the
target system. When an alternate root pool is created by using the zpool create-R option, the mount point of the root file system is automatically set
to /, which is the equivalent of the alternate root value.

In the following example, a pool called morpheus is created with /mnt as
the alternate root path:

Note the single file system, morpheus, whose mount point is the alternate root
of the pool, /mnt. The mount point that is stored on disk is
/ and the full path to /mnt is interpreted only in this
initial context of the pool creation. This file system can then be exported
and imported under an arbitrary alternate root pool on a different system by
using -Ralternate root value syntax.

Importing Alternate Root Pools

Pools can also be imported using an alternate root. This feature allows for
recovery situations, where the mount points should not be interpreted in context of
the current root, but under some temporary directory where repairs can be performed.
This feature also can be used when you are mounting removable media as
described in the preceding section.

In the following example, a pool called morpheus is imported with /mnt as
the alternate root path. This example assumes that morpheus was previously exported.