Page 1 of 1

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

PostPosted: Tue Nov 27, 2018 7:04 am
by Wowfunhappy
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.

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

PostPosted: Tue Nov 27, 2018 4:15 pm
by lundman
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.

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

PostPosted: Wed Nov 28, 2018 4:38 pm
by Wowfunhappy
...I’ll be honest, I feel pretty stupid for not thinking of that! Thank you!