How do I mount a ZFS pool?

Sorry for asking an Ubuntu concerning question, but I hope that someone here has some experience with that.

I have to mount the zfs pool I created with freenas8 on Ubuntu. I tried it as described here.

I was able to run that command without error:

sudo zpool import data

and the status of my zpool is like this:

user@server:~$ sudo zpool status
  pool: data
 state: ONLINE
status: The pool is formatted using an older on-disk format.  The pool can
        still be used, but some features are unavailable.
action: Upgrade the pool using 'zpool upgrade'.  Once this is done, the
        pool will no longer be accessible on older software versions.
 scan: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        data        ONLINE       0     0     0
          sda2      ONLINE       0     0     0
          sdb2      ONLINE       0     0     0

errors: No known data errors

so it looks good to me. but, i dont know how to access the pool. in my eyes i have to mount it, but i dont know how.


Solution 1:

If you run the command sudo zfs get all it should list all the properties of you current zfs pools and file systems. One of those properties, if correctly set, should be mountpoint=.

enter image description here

Zfs will mount the pool automatically, unless you are using legacy mounts, mountpoint tells zfs where the pool should be mounted in your system by default. If not set you can do so with

sudo zfs set mountpoint=/foo_mount data

That will make zfs mount your data pool in to a designated foo_mount point of your choice.

After that is done and since root owns the mount point you can change the owner of the mount with

sudo chown -R user:user /foo_mount

That will make the user user and the group user own the mount point and everything inside it, adjust the command to assign correct user:group privileges to the mount point.

Solution 2:

I had a similar problem and, indeed, canmount was on but the pool+dataset didn't mount on boot nor when going online, etc.

My solution, after zpool import and zpool online the pool, was:

  1. zfs mount poolname

  2. zfs mount poolname/datasetname

Yes, zfs instead of zpool with the poolname and then poolname/datasetname.

Hope this help someone.