Is there a way to prevent autoimport?

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

Is there a way to prevent autoimport?

Postby nodarkthings » Fri Mar 03, 2017 12:26 pm

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?
nodarkthings
 
Posts: 174
Joined: Mon Jan 26, 2015 10:32 am

Re: Is there a way to prevent autoimport?

Postby stumble » Fri Mar 03, 2017 1:22 pm

Code: Select all
sudo zfs set mountpoint=/ my-dataset


works, although it's a little inelegant!
stumble
 
Posts: 37
Joined: Thu May 15, 2014 7:05 pm

Re: Is there a way to prevent autoimport?

Postby lundman » Sun Mar 05, 2017 4:36 pm

What about disabling the launchctl that does the import?
User avatar
lundman
 
Posts: 1335
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Is there a way to prevent autoimport?

Postby nodarkthings » Sun Mar 05, 2017 4:55 pm

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. ;)
nodarkthings
 
Posts: 174
Joined: Mon Jan 26, 2015 10:32 am

Re: Is there a way to prevent autoimport?

Postby stumble » Sun Mar 05, 2017 6:04 pm

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.
stumble
 
Posts: 37
Joined: Thu May 15, 2014 7:05 pm

Re: Is there a way to prevent autoimport?

Postby nodarkthings » Mon Mar 06, 2017 2:15 am

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"?
nodarkthings
 
Posts: 174
Joined: Mon Jan 26, 2015 10:32 am

Re: Is there a way to prevent autoimport?

Postby stumble » Mon Mar 06, 2017 12:52 pm

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.
stumble
 
Posts: 37
Joined: Thu May 15, 2014 7:05 pm

Re: Is there a way to prevent autoimport?

Postby nodarkthings » Tue Mar 07, 2017 8:39 am

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.
nodarkthings
 
Posts: 174
Joined: Mon Jan 26, 2015 10:32 am

Re: Is there a way to prevent autoimport?

Postby stumble » Tue Mar 07, 2017 12:14 pm

Yes, good. I agree.
stumble
 
Posts: 37
Joined: Thu May 15, 2014 7:05 pm

Re: Is there a way to prevent autoimport?

Postby nodarkthings » Sat Apr 14, 2018 4:47 am

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...)
nodarkthings
 
Posts: 174
Joined: Mon Jan 26, 2015 10:32 am


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 8 guests