Well, I can't be bothered to read up on that other thread and ZFS happens to be my favorite filesystem. So here goes...
Just using
zpool import
(without any arguments) will make the system check the currently attached storage media and if it finds a valid ZFS signature then the pool name will be listed. This command
does not automatically import and mount filesystems, all it does is detect them.
After you got a name you can then proceed to the actual import process. Let's assume our pool is called
zroot (a mostly common name). There are 2 important things to keep in mind: a pool always contains a filesystem. In other words: the pool is also a filesystem on its own. Because of that it'll need a mount point. Second: ZFS is an intelligent filesystem, it keeps track of its history. Therefor you may need to force the import because it will otherwise detect a different environment.
Because
/mnt is a commonly used mountpoint this leads us to:
# zpool import -fR /mnt zroot
.
After that you should be able to access your filesystem(s) in
/mnt.
However... there is more to this story:
Code:
peter@zefiris:/home/peter $ zfs get mountpoint,canmount zroot
NAME PROPERTY VALUE SOURCE
zroot mountpoint / local
zroot canmount on default
A normal filesystem doesn't know where it should be mounted in an hierarchy, this is only determined by
/etc/fstab (or the individual mount command). ZFS on the other hand doesn't use
/etc/fstab at all and instead its filesystem(s) keep track of the proper place on a per-filesystem basis. Through the properties listed above. Which is the main reason why we used
-R in the
zpool import
command: to make sure the system realized that its filesystem(s) should be accessible using a different path than their normal one.
Next stop, very important when you have a ZFS pool automatically set up by the installer, is the
canmount property. This is set to off by the FreeBSD installer for your root filesystems, and as a result they will not automatically mount after you imported your ZFS pool. The reason for doing that is to cater to
sysutils/beadm, a decision which I personally consider ridiculous and only showcasing a bad design. But that's offtopic here.
But as a result it is possible that you won't be able to access your filesystem(s) after successfully importing a pool. You can check that they're still available by using:
zfs list
, this should list all the available filesystems in the currently imported pool(s).
If you need to mount those "hidden" filesystems just use:
# zfs mount zroot
(for example). Or to give a proper example of a default setup:
# zfs mount zroot/root/DEFAULT
. Just list the available filesystems and you'll soon see what you should use.
You don't have to worry with specifying a mount point or anything because all filesystems will be mounted under the virtual root (which we set to
/mnt in the example above).
And that's how you mount a ZFS filesystem.
It is noteworthy that you can also use the normal
mount command, but I would recommend against this. Simply because you'd need to know the ZFS filesystem name before you can do this, meaning that you'd be using the
zfs command anyway, seems pointless to suddenly switch to
mount.
Hope this can help.