How do you auto mount ZFS when dual booting?

  • Distribution & Version Linux Mint 20. Cinnamon and POP_OS 20.10
  • Kernel information 5.4 and 5.8

Hello,

I have set up a mirrored pair of 4tb drives with ZFS to store data. I run LM 20 Cinnamon and dual boot POP_OS which my daughter uses. ZFS works fine for one or the other but requires commands to import the pool and mount to data sets if you boot into the other OS.

I’m trying to figure out how to make the process of unmounting/exporting and importing/mounting automatic. I have scripts to do these things but they required sudo. I assume that means they would would need to be run in the root part of the boot/shutdown processes to be automatic.

My questions:

  1. Am I missing something? I would have thought this use case would be addressed in ZFS but I can’t find it explained anywhere. Is it so blindingly obvious that nobody ever had to ask the question? (This possibility seems likely to me.)

  2. If my assumptions are correct about having to add the commands (or my scripts) to the startup/shutdown routines, where do I insert the zpool import and zfs mount / zfs unmount and zpool export commands so they are run with proper privileges?

Thank you for any thoughts or advice.

I can’t answer your question but I can suggest you send this question to either the “BSD Now” or “2.5 Admins” podcasts. Allan Jude hosts on both shows and is an openZFS developer.

Hopefully you can find an answer before waiting around for an episode of either but it’s an option.

Ethanol, thank you for the suggestion. I’m listening to the back catalog of 2.5 Admins. Given the ZFS love on that podcast they may just be open to the question.

I’ll see if I can figure out how to pose it there.

I figure someone may find this thread looking for an answer to the question, so here is the rest of the story:

I got no love from 2.5 Admins, but I found a solution that may not be correct, but works:

I enabled overlay to “fix” the mount point not empty error:

Check the status of overlay on the pool:

 ~$ zfs get overlay <nameofpool> 
NAME      PROPERTY  VALUE    SOURCE
<nameofpool>  overlay   off       local

Tell zfs to turn on overlay for the pool:

~$ zfs set overlay=on <nameofpool>

Check your work:

~$ zfs get overlay <nameofpool> 
NAME      PROPERTY  VALUE    SOURCE
<nameofpool>  overlay   on       local

That has led to successful mounting of the pool on multiple installs across multiple reboots. I assume it isn’t causing all my data to die or giving me fatal halitosis. So far so good.

1 Like