Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2004 21:59:20 +1100
From:      Tony Frank <tfrank@optushome.com.au>
To:        dap <dap99@i-55.com>
Cc:        questions@freebsd.org
Subject:   Re: NFS and different exports to the same host
Message-ID:  <20040221105920.GI98919@marvin.home.local>
In-Reply-To: <008601c3f829$fd0533b0$6401a8c0@yourqqh4336axf>
References:  <008601c3f829$fd0533b0$6401a8c0@yourqqh4336axf>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi there,

On Fri, Feb 20, 2004 at 09:17:37PM -0600, dap wrote:
> Per the FreeBSD handbook, I have to follow the rule that for a specific host
> I have to export everything the same for a particular filesystem. So let's
> say I have one filesystem, /.
> 
> So I can't have:
> 
> /export1    -ro    server1 server2
> /export2             server1
> 
> Instead, I need:
> 
> /export1 \
> /export2 \
> server1
> 
> Is there a way around this?

Each filesystem can only be exported with one set of attributes to a particular host.
If both /export1 and /export2 are directories of / then you would do:

/export1 /export2 -ro server1
/export1 -ro server2

But note that the same attributes apply - ie both ro or both rw.
If you need to give ro on one and rw to the other then you need to make them separate
filesystems.  See below for a way to do this.

>From the handbook:
%%%%
In /etc/exports, each line represents the export information for one filesystem to one host. 
A remote host can only be specified once per filesystem, and may only have one default entry. 
For example, assume that /usr is a single filesystem. The following /etc/exports would be invalid:

/usr/src   client
/usr/ports client

One filesystem, /usr, has two lines specifying exports to the same host, client. 

The correct format for this situation is:

/usr/src /usr/ports  client

The properties of one filesystem exported to a given host must all occur on one line. 
Lines without a client specified are treated as a single host. 
This limits how you can export filesystems, but for most people this is not an issue.
%%%%

eg I have in my /etc/exports file:

%%%%
/data/ad2 -alldirs -maproot=root -network 192.168.0.0 -mask 255.255.0.0
/data/ad3 -alldirs -maproot=root -network 192.168.0.0 -mask 255.255.0.0
/usr -alldirs -ro -network 192.168.0.0 -mask 255.255.0.0
/usr /usr/local -maproot=0:10 group1
/usr -ro -mapall=nobody
/tmp -maproot=root group1
/tmp group2
/cdrom -alldirs,quiet,ro -network 192.168.3.0 -mask 255.255.255.0
%%%%

So you can export the one filesystem (/usr or /tmp here) to different
places with different attributes.
You cannot have different attributes for same filesystem + same host.
So if I had a host in both group1 and group2 in this example it would 
break.

> I have found that it works best for us to have a /exports, where we dump
> things like /exports/www, /exports/mail, and so on, rather than having
> filesystems for each of those. This is important since FreeBSD has a
> limitation on the number of possible slices, and we are running with one big
> RAID-1 storage system.

If you want to break up a single "disk" into many pieces you might want to
look at using vinum for this.
If you are using hardware raid already you can make the virtual disk a vinum
drive and then break it up into as many subdisks as you like.
Eg a config like:

%%%%
drive hwraid1 device /dev/da0s1h

volume www
 plex org concat
  sd drive hwraid1 len 2G

volume mail
 plex org concat
  sd drive hwraid1 len 2G

%%%%

While it adds an extra layer it should not be too much of an overhead.
You can also then add as many filesystems as you like, but they cannot
share the same total disk.
You could however add extra subdisks if more space is needed and run
growfs to increase room if it is needed.

> Also, I found that this generates errors (by mountd -r):
> 
> /export1 -maproot=nobody \
> /export2 -maproot=root \
> server1
> 
> While this works:
> 
> /export1 \
> /export2 \
> -maproot=root \
> server1
> 
> That's no good. Is there a solution to this problem?

Each "line" should be made of 3 parts:
1 - directory/filesystems to export
2 - attributes
3 - hosts

First one does not follow this layout.

You can make each directory it's own filesystem using the vinum idea.

> By the way, I have found that FreeBSD is a solid NFS server. Other than this
> limitation NFS has worked great.
> 
> Handbook on NFS:
> http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-nfs.html

Hope that helps,

Tony



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040221105920.GI98919>