How to share a ZFS file system between a global zone and a non global zone?
Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547
Rep:
How to share a ZFS file system between a global zone and a non global zone?
Hi.
I wanted to share a ZFS file system, managed in the global zone, in another zone. From what I've read, I understand that I could either loopback mount the ZFS file system in the non-global zone and in this case the mountpoint property must be "legacy", or mount via NFS the file system in the non-global zone.
Is there any difference between these two methods? It seems easier to me mounting the filesystem via NFS, because the other way I should mount the file system in the "legacy way" in the global zone.
What's your suggestion? Are there issues I'm not considering or I'm not aware of?
Thanks,
Enrico.
EDITED: I just found this http://www.opensolaris.org/jive/thre...essageID=28645
which explains the problems I had yesterday when experimenting with the zone.
It seems I was lucky enough to hit the deadlock at first attempt.
Last edited by crisostomo_enrico; 11-26-2007 at 08:44 AM.
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547
Original Poster
Rep:
I've been googling around after reading the bug I've posted earlier and one thing isn't clear to me, yet: are ZFS mounts affected by this? Does nybody know?
Q: How can I add a filesystem to an existing zone?
A: There are four methods. The following list uses UFS examples, but other types of file systems, such as HSFS and VxFS, can be used in the zonecfg "fs" resource type property or attached by mount(1M).
1. Create and mount the filesystem in the global zone and use LOFS to mount it into the non-global zone (very safe)
2. Create the filesystem in the global zone and use zonecfg to mount the filesystem into the zone as a UFS filesystem (very safe)
3. [...]
4. Mount a UFS filesystem directly into the non-global zone's directory structure (allows dynamic modifications to the mount without rebooting the non-global zone)
I'm digging the administration guide and it suggests to configure the zone with a lofs mount:
Quote:
zonecfg:my-zone> add fs
zonecfg:my-zone:fs> set dir=/path/to/mount/to
zonecfg:my-zone:fs> set special=/path/to/mount/from
zonecfg:my-zone:fs> set type=lofs
zonecfg:my-zone:fs> end
When I read point 1., even if zonecfg isn't explicitly named, I suppose they refer to the method suggested in the administration guide. There's no other way for a zone to mount a file system mounted in the global zone, is it?
Nevertheless, point 2. suggests to create the file system in the global zone and use zonecfg to mount a file system as UFS. What would be the advantage of this? And how would I do it? If the file system is not mounted in the global zone, and point 4. excludes that the file system it's into the non-global zone's directory structure, how can the non-global zone know about it (we're excluding access to the devices, which was point 3.)?
Thanks,
Enrico.
Last edited by crisostomo_enrico; 11-27-2007 at 09:23 AM.
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by crisostomo_enrico
When I read point 1., even if zonecfg isn't explicitly named, I suppose they refer to the method suggested in the administration guide. There's no other way for a zone to mount a file system mounted in the global zone, is it?
There is point 2 which is another way.
Quote:
Nevertheless, point 2. suggests to create the file system in the global zone and use zonecfg to mount a file system as UFS. What would be the advantage of this?
You are removing one layer of indirection, the zone deals with UFS instead of LOFS on top of UFS (or whatever). You can use tools like ufsdump/ufsrestore and ufs snapshots while you can't with lofs.
Quote:
And how would I do it?
set type=ufs
set special=/dev/dsk/c0t0d0s7
set raw=/dev/rdsk/c0t0d0s7
Quote:
If the file system is not mounted in the global zone, and point 4. excludes that the file system it's into the non-global zone's directory structure, how can the non-global zone know about it (we're excluding access to the devices, which was point 3.)?
The non-global zone doesn't knows about the mount but because it is done in the global zone. The non global zone accesses the files in the mount anyway.
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547
Original Poster
Rep:
Thanks jlliagre, things are clearer, just some doubts more.
About point 2: I didn't know about using the raw device, I excluded because I thought I had to propagate the device but it makes sense. This way, nonetheless, the zone configuration lets me mount a fs in the non-global zone but once mounted this way, it is not shared with global zone, right? Or better, it must not be mounted in global zone, right?
This approach is not possible with ZFS, I suppose. What I wanted to do was share some ZFS fs with a non-global zone and was looking for the best way to do this, that's why I first thought about NFS, before discovering that it's unsupported. With the options we discussed, it seems like the one option is lofs mounting the ZFS file systems into the zone. Can you confirm my suspicion?
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by crisostomo_enrico
About point 2: I didn't know about using the raw device, I excluded because I thought I had to propagate the device but it makes sense. This way, nonetheless, the zone configuration lets me mount a fs in the non-global zone but once mounted this way, it is not shared with global zone, right? Or better, it must not be mounted in global zone, right?
Yes, you can't mount it nor see its content from the global zone.
Quote:
This approach is not possible with ZFS, I suppose. What I wanted to do was share some ZFS fs with a non-global zone and was looking for the best way to do this, that's why I first thought about NFS, before discovering that it's unsupported. With the options we discussed, it seems like the one option is lofs mounting the ZFS file systems into the zone. Can you confirm my suspicion?
Yes, lofs allows sharing a directory between zones regardless of the underlying filesystems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.