How to share/mount ZFS in two non-global zones?

Hi All, first time here. :o

I need a some assistance with ZFS.

I have two ZFS pools:

zoneA/nfs_export
zoneB/nfs_export

Each dataset is mounted in a particular zone (zoneA and zoneB respectively).

I have created a new dataset "zoneA/nfs_tmp" which I want to mount or share between the two zones so that if a user in zoneA "touches" a file in "/nfs_tmp" the file is "visible" in zoneB.

zoneA/nfs_export
zoneA/nfs_tmp 
zoneB/nfs_export

So far I have tried changing the default mountpoint of "zoneA/nfs_tmp " to "/zoneA/root/nfs_tmp" and altough the FS gets mounted successfully I'm not able to figure out how to make it visible in the other zone.

Thanks. :b:

-Gab

you can't mount a filesystem twice on different servers (not without problems or not at all) and a zpool can only be owned by one host (at a time). mounting a filesystem across multiple hosts is a job for a "cluster" filesystem.
but in your case, a NFS share would be an easier option. share a fielsystem in the globel (or inside a local zone; does this work yet?) zone with NFS and mount the share inside the zones.

unless you use lofs mounts.

This wont work. A non global zone can't be a NFS server. A global zone can be a NFS server but having a non global zones as its NFS client is definitely unsupported. The simple workaround is to use lofs to share filesystems between zones.

As already been said, there are two ways to get your goal:

1.) Attach the dataset to global zone and as LOFS to local zone:

add fs
set dir=<path_in_zone>
set spezial=<path_in_global>
set type=lofs
set options=nodevices

2.) Use NFS share, using normal /etc/dfs/dfstab in global and /etc/vfstab in zone.

However, using LOFS to share one dataset into two local zones can be risky as hell, if both zones work on same data (read-write), Therefore I would use second opinion only.

This doesn't make sense. Having multiple processes accessing the same file in r/w mode might be risky regardless of whether the file system is local or not and regardless of the accessing processes running on the same kernel or not. You can lofs mount in read-only mode should you want to avoid that specific issue. On the other hand, it is extremely common to have NFS, cifs or lofs shares in r/w mode and this definitely serves a purpose. File locking is the usual way to avoid multiple processes concurrently accessing the same file.

You really shouldn't. This is not supported (see NOTES in the mount_nfs manual page). It is well know to create kernel deadlocks, which are much "riskier as hell" than the previous solution you discarded.

Bug ID: 6811806 automounter should prevent zone-to-global-zone mounts

Thanks you guys.

I opted for the NFS approach (r/w). I know it's barely supported by Sun but I will only be using the datased for a few days. :slight_smile:

-Gab

I'm always perplexed when people opt to implement a solution which is unsupported, slower and more complex than the supported one. Oh well ...

That`s what they call an adventures :slight_smile: What approach would have you take in similar requirements?

I would used lofs mounts (see blicki posting for the syntax).

This can also be done on line with two commands to avoid rebooting the zones:

mount -F lofs -o nodevices <common-path-in-global-zone> <zone1-path>/root<path-in-zone1>
mount -F lofs -o nodevices <common-path-in-global-zone> <zone2-path>/root<path-in-zone2>