Root on ZFS, FreeBSD and Linux back and forth

Jim Ohlstein jim at ohlste.in
Tue Aug 2 15:57:43 UTC 2016


Hello,

> On Aug 2, 2016, at 11:47 AM, Trond Endrestøl <Trond.Endrestol at fagskolen.gjovik.no> wrote:
> 
>> 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.

I've used it on a Debian box for a year or so. Just a simple mirrored pool. No problems. Have never tried sharing the pool. 

--
Jim


More information about the freebsd-questions mailing list