What to do when you need files off the root file system of a zpool?
If you store files in the root file system of a zpool, it’s probably not so straightforward to access them from a different system, e.g. a live CD/DVD. Don’t panic. Here’s how.
According to the recent discussion on the freebsd-stable mailing list, in the thread named “Help! :( ZFS panic on boot, importing pool after server crash.”, this is the way to do it:
- Import the zpool with both the no mount option and the altroot option:
zpool import -N -R /tmp/zfs poolname
You might even consider importing the zpool read-only:zpool import -N -R /tmp/zfs -o readonly=on poolname
- Manually mount the root file system using the system
mount
command, not thezfs mount
command:mount -t zfs poolname /tmp/zfs
- Finally, mount the remaining file systems under the
/tmp/zfs
mount point using thezfs mount
command:zfs mount -a
Thanks goes to Volodymyr Kostyrko for providing the right answer and to Dr. Josef Karthauser for raising this issue in the first place.
I guess it’s still debateable whether it’s wiser to create new file systems below the root file system of a zpool, rather than using the initial file system provided by the zpool.