1

We have to regularly copy quite huge files from Solaris to Linux (using network). It currently takes almost half a day for one file. The files in Solaris are on a ZFS filesystem.

So I thought what a heck - we could probably mount that ZFS on Linux.

But ZFS is not a clustered (or clusterable) filesystem.

Hypothesis: So I thought we could since we're just copying from Solaris - we can mount that same ZFS filesystem read-only, so it doesn't have to be clustered in this case? As writes will be only on Solaris side (we can't unmount it there).

That Solaris box is very busy and network NICs almost always are very busy too. So by moving file copy to FC it should be way faster.

That Linux box is a virtual guest on a VMWare host. So yes, it's possible to present the same FC fabric to that Linux guest.

Thoughts? I think that hypothesis piece is most where I look for feedback on. Not sure if it's possible to do ZFS read-only mount on Linux + simultaneous read-write mount on Solaris.

  • 1
    If possible, I'd definitely map the FC LUN read-only from the SAN controller to the Linux host before trying. I also wouldn't try with a production LUN - test it first with a LUN you can afford getting corrupted. I'm pretty sure ZFS "read-only" isn't as "read-only" as other file systems. – Andrew Henle Sep 29 '16 at 8:52
3

What prevents this is the fact that ZFS caches metadata in memory because it assumes that it's the only one changing disk state. Whatever host is mounted read/write should be fine. On another host that's mounted read-only, the metadata will be changing out from under it and, at some point (fairly quickly), it will read a block from the disk in a location that it thought had valid metadata, but was overwritten by the other system.

You could try the lun-cloning method outlined by BitsOfNix, or you could try setting up a periodic snapshot/send/recv script to try to keep up to date. Or you could try sharing the dataset from the solaris host and mount it via NFS on the Linux host.

  • Thank you for the details. I haven't thought about caching. Yeah, it makes sense. Files we are copying will not be changed while we copy them, but still with caching on read-write site I can think of scenarios when it can not be reliable to read-only site. @BitsOfNix suggested to look at cloning. Can we snapshot and mount snapshot as read-only - would that do? – Tagar Sep 29 '16 at 18:27
  • 2
    I've never tried that. It might work, but I'm doubtful. The reason being that ZFS has a hidden dataset called the "MOS" which it uses to look up information about all other datasets in the pool. The MOS changes frequently. If your read-only site needs to re-read data from the MOS it might do so through cached metadata. I'd be interested to know if this works, but I wouldn't want to use it on a production system. – mmusante Sep 30 '16 at 19:43
  • thank you for explaining of "why" and low-level details of what may break from that standpoint - really valuable. it makes sense. accepted the answer. – Tagar Oct 3 '16 at 16:17
4

That is not possible at all. ZFS does not allow for being mounted on two hosts at the same time regardless of the read/right permissions. If you try to mount it on linux while mounted on Solaris you will have to force it. If you do that Solaris will crash with kernel panic. I had this happenning with two Solaris when forcing the import on the second solaris box while it was mounted on the first box. Moreover, the ZFS version will also play a role if you can import or not the zpool on linux. If you want to try I suggest the following:

  1. Clone the lun on the storage
  2. Map the cloned lun to the Linux box
  3. Try to mount the zpool on linux
  • Cloning is an interesting idea. Can we snapshot and mount snapshot as read-only - would that do? – Tagar Sep 29 '16 at 18:24
  • 2
    not really, if you do an ZFS snapshot it is still within the same zpool. What you can do alternativaly is map a new lun to Solaris, perform snapshot and send it to the new lun in a new zpool. export the zpool and import on linux. assuming no problems will arise due to the ZFS version. – BitsOfNix Sep 30 '16 at 9:49
  • thank you - although my understanding of "export the zpool and import on linux" would take quite some time for huge filesystems? then we wouldn't save much from the standpoint of cutting time (see my 1st post above). – Tagar Oct 3 '16 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.