Root on ZFS, FreeBSD and Linux back and forth

Trond Endrestøl Trond.Endrestol at
Tue Aug 2 15:47:23 UTC 2016

On Tue, 2 Aug 2016 08:17-0700, Rares Vernica wrote:

> Hello,
> I have two hard drives. One has root-on-ZFS created by FreeBSD (on
> installation) and one with Linux. I wonder if it is safe and reliable to
> use the root-on-ZFS disk back and forth between FreeBSD and Linux. On Linux
> I plan to use ZFS-on-Linux. Both FreeBSD and ZFS-on-Linux seem to use
> version 5000.
> To import the zpool in Linux, it seems it needs to be forced. FreeBSD does
> not export it on shutdown and I am not sure how or if I should do it.
> How would FreeBSD deal with the zpool if it notices that Linux imported it?
> Will FreeBSD force the import on boot? Do I have to take special
> precautions for FreeBSD to import the ZFS disk and boot from it once Linux
> has touched it?

I guess the FreeBSD kernel would refuse to access an exported root 
pool, leading to a panic à la "mountroot: unable to (re-)mount root.".

If you want to share a zpool between FreeBSD and Linux, you should 
create a dedicated pool.

Use custom startup and shutdown scripts for importing and exporting 
the shared pool on both systems. Be prepared for manual intervention 
in case of a crash on either system, or craft your scripts to 
forcefully import the pool if it fails to import on the first attempt.

Also, try to keep the enabled features to a minimum.
Create the shared pool like this:

zpool create -d sharedpool ...

Enable only the features you need and supported on both systems.

> Also, is ZFS-on-Linux trustworthy enough not to mess up the disk?

Don't know. Maybe someone does.

| Vennlig hilsen,               | Best regards,                      |
| Trond Endrestøl,              | Trond Endrestøl,                   |
| IT-ansvarlig,                 | System administrator,              |
| Fagskolen Innlandet,          | Gjøvik Technical College, Norway,  |
| tlf. mob.   952 62 567,       | Cellular...: +47 952 62 567,       |
| sentralbord 61 14 54 00.      | Switchboard: +47 61 14 54 00.      |

More information about the freebsd-questions mailing list