Dual boot: how to automatically mount ZFS pool in both OS's

All your general support questions for OpenZFS on OS X.

Dual boot: how to automatically mount ZFS pool in both OS's

Postby Wowfunhappy » Tue Nov 27, 2018 7:04 am

I have a machine which dual boots macOS X and Linux. When I boot into Linux, my zfs pool does not get imported automatically; I have to run "zpool import -f myPoolName" first.

I know the correct way to avoid this problem is to export the pool before changing OS's, but I'm never going to remember to do this. I would like to avoid the extra step. And as far as I know, there's no way to tell macOS to automatically run a script on shut down.

Is there a way to remove this safety check? Because I'm dual booting on a single machine, I am not in danger of accidentally importing a pool on two systems simultaneously.
Wowfunhappy
 
Posts: 8
Joined: Sat Jul 21, 2018 11:58 am

Re: Dual boot: how to automatically mount ZFS pool in both O

Postby lundman » Tue Nov 27, 2018 4:15 pm

It is down to the hostid, which differs on both systems.

So you could simply put "import -f" somewhere in the early boot scripts on both machines. On OsX in the launchctl script we have for auto-import, and in Linux, maybe off some /etc/rc.local script (or whatever linux has).

You could also set the hostid (to be the same as linux) on OsX *before* the kexts load, but that could be tricky, as the kext loads early. I don't know if Linux lets you set the hostid.
User avatar
lundman
 
Posts: 505
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Dual boot: how to automatically mount ZFS pool in both O

Postby Wowfunhappy » Wed Nov 28, 2018 4:38 pm

...I’ll be honest, I feel pretty stupid for not thinking of that! Thank you!
Wowfunhappy
 
Posts: 8
Joined: Sat Jul 21, 2018 11:58 am


Return to General Help

Who is online

Users browsing this forum: No registered users and 3 guests