Mounting nfs in DFly versus linux
Oliver Fromme
check+ib8eb600rsu6u7te at fromme.com
Tue Feb 1 04:58:10 PST 2005
walt <wa1ter at xxxxxxxxxxxxx> wrote:
> A little background first: when I nfs-mount a read-only fs in linux,
> 'mount' will wrongly list the mount as read-write unless I specifically
> use the '-o ro' flag when doing the mount. Userland then fails when
> attempting inappropriate writes to that read-only fs.
There are two different things involved: The export from
the NFS server, and the NFS mount on the client. Both can
be specified to be read-only (independently from each other),
and if either one (or both) is read-only, then you cannot
write to the NFS filesystem. You can only write to file
system if _both_ allow read-write.
1. If an NFS server exports a file system read-only (i.e.
"-ro" in /etc/exports), it doesn't matter whether you
mount it read-only on the client. The NFS server will
always deny write requests.
2. If you mount an NFS filesystem read-only ("mount -o ro"),
it doesn't matter whether the server exports it read-only
or not. All write attempts will be denied locally on the
client.
In both cases, write attempts will return the errno EROFS and
print "Read-only file system".
> In DFly (I just noticed) 'mount' does not tell me whether a fs is
> mounted rw or ro.
It does. However, it does not tell you whether the FS is
exported read-only from the server. (In fact, an NFS client
doesn't need to know that at all.)
> My question is: is the whole mechanism different between the two
> OS's for determining the write status of a mounted fs?
I think it's not different.
> And for nfs in particular, does the nfs server tell the client
> system about read-write status at mount-time -- i.e. is there
> any reason that the read-write status should ever be ambiguous?
No, AFAIK the NFS server doesn't tell at mount-time, and in
theory the server could export _some_ parts of the FS read-
only and other parts of it read+write (DF and FreeBSD don't
support that, though), so there is no simple way to tell
the client about the read/write status of the exported FS.
In practice, I recommend that read-only exports should also
be mounted read-only on the client, so you will see the
status in the output from mount(8) explicitely.
Best regards
Oliver
--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany
``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
More information about the Users
mailing list