Synopsis #
Attach an existing ZFS pool’s disks to another FreeBSD system, import the pool read-only, and copy files out. An alternate root keeps its datasets away from the running system’s normal mount points.
Use a FreeBSD release that supports the pool’s enabled features. For damaged or failing disks, make disk images before attempting recovery. This procedure reads an intact pool; it does not repair corruption or recover deleted files.
Identify the pool #
Shut down the original system or export the pool there before moving its disks. Never import a pool that another system is still using.
On the recovery system, identify the attached devices and available pools:
# geom disk list
# zpool import
Check the pool’s name, numeric ID, disks, and reported state. Use its numeric ID if another pool has the same name. Do not create a pool or run an installer on these disks.
Import without mounting datasets #
Create an empty recovery directory. Replace POOL_ID with the ID reported above:
# mkdir -p /mnt/recovery
# zpool import -N -o readonly=on -R /mnt/recovery POOL_ID
# zpool status
# zpool get readonly,altroot POOL
# zfs list -r -o name,mountpoint,canmount POOL
Replace POOL with the imported pool’s name. Confirm readonly is on and altroot is /mnt/recovery before mounting anything. If import reports an unsupported feature, missing devices, or a pool still in use, resolve that condition first. Do not add force or rewind options merely to get past the error.
Mount and copy the needed files #
Mount a specific filesystem dataset, using the name from zfs list:
# zfs mount POOL/data
# zfs mount
Confirm the resulting mount is beneath /mnt/recovery. A dataset whose normal mount point is /data appears at /mnt/recovery/data. Datasets with legacy mount points need an explicit read-only mount; encrypted datasets need their keys before they can be mounted.
Copy the required files to a different, writable disk. For example, with /backup on that disk:
# cp -Rp /mnt/recovery/data/documents /backup/
Check that the copied files are readable. Once finished, leave the recovery directory, close programs using it, and export the pool:
# cd /
# zpool export POOL