Page 1 of 1

Is there a way to prevent autoimport?

PostPosted: Fri Mar 03, 2017 12:26 pm
by nodarkthings
Hello!
Yes, autoimport is great but not always, so is there some way (like in hfs with the file /private/etc/fstab) to set a pool not to automount?

Re: Is there a way to prevent autoimport?

PostPosted: Fri Mar 03, 2017 1:22 pm
by stumble
Code: Select all
sudo zfs set mountpoint=/ my-dataset


works, although it's a little inelegant!

Re: Is there a way to prevent autoimport?

PostPosted: Sun Mar 05, 2017 4:36 pm
by lundman
What about disabling the launchctl that does the import?

Re: Is there a way to prevent autoimport?

PostPosted: Sun Mar 05, 2017 4:55 pm
by nodarkthings
Thanks for the answer, but I want some pools to automount and others, intended for occasional backups, to mount only when needed.
As I mentioned, I use this trick in hfs with the file /private/etc/fstab, would be nice if something similar existed in zfs. ;)

Re: Is there a way to prevent autoimport?

PostPosted: Sun Mar 05, 2017 6:04 pm
by stumble
nodarkthings wrote:I want some pools to automount and others, intended for occasional backups, to mount only when needed.


My method (above) achieves that.

Mind you, I don't LIKE my method, and I hope there's a more elegant way.

Re: Is there a way to prevent autoimport?

PostPosted: Mon Mar 06, 2017 2:15 am
by nodarkthings
Thanks!
I wasn't quite sure I understood your method, that's why I waited to read other answers... :oops:
So, just to be sure, "my-dataset" is the name of the dataset, and I have to do that for every dataset I don't want to automount?
And "set mountpoint=/" creates a confusion to the system, so it doesn't mount them, right?
Or is it that "mountpoint=/" is equivalent to "mountpoint=none" or "mountpoint=legacy"?

Re: Is there a way to prevent autoimport?

PostPosted: Mon Mar 06, 2017 12:52 pm
by stumble
nodarkthings wrote:So, just to be sure, "my-dataset" is the name of the dataset, and I have to do that for every dataset I don't want to automount?
And "set mountpoint=/" creates a confusion to the system, so it doesn't mount them, right?


Right (on both points). That's two reasons why it's inelegant. Still waiting for a better method, but I use this one and it works.

Re: Is there a way to prevent autoimport?

PostPosted: Tue Mar 07, 2017 8:39 am
by nodarkthings
According to https://docs.oracle.com/cd/E19253-01/819-5461/gbaln/index.html, mountpoint=legacy was meant to do this, and indeed the pool doesn't mount... but I haven't found the right syntax to mount it manually (
Code: Select all
zfs mount my-dataset
gives an error "cannot mount 'Videos': legacy mountpoint
use mount(1M) to mount this filesystem"
— I've tried various ways without success)
Note that according to Oracle, vfstab was used like fstab for HFS, but I suppose this doesn't apply to "OpenZFS on OS X"...

EDIT: well, of course
Code: Select all
sudo zfs set mountpoint=/Volumes/my-dataset my-dataset
is working, so writing a script to toggle between the two mountpoints is an option. ;)
But I definitely think that mountpoint=legacy or none is preferable than mountpoint=/ even if the latter doesn't seem to create problems.

Re: Is there a way to prevent autoimport?

PostPosted: Tue Mar 07, 2017 12:14 pm
by stumble
Yes, good. I agree.

Re: Is there a way to prevent autoimport?

PostPosted: Sat Apr 14, 2018 4:47 am
by nodarkthings
I'm digging up this old thread because I happened to need this trick and I could see that "mountpoint=legacy" has issues when you try to set a new mountpoint afterwards.
The correct syntax should be zfs set mountpoint=none my-dataset to avoid it mounting, then sudo zfs set mountpoint=/Volumes/my-dataset my-dataset to remount it.
(sudo is not needed for the first command — it gives an error but it unmounts it all the same...)