mount -p and NFS options

Dan Nelson dnelson at allantgroup.com
Tue Feb 5 20:08:09 UTC 2008


In the last episode (Feb 04), Mike Andrews said:
> Is there anything like "mount -p" that will print the current NFS
> options in use?  TCP vs UDP, v2 vs v3, read/write sizes etc.  It
> doesn't have to be in fstab format; I just need to be able to see
> what the flags are for an active mount.
> 
> This would be useful in tracking down an irritating NFS problem I've
> been experiencing with diskless systems in every 6.x release and
> 7.0-RC1, namely libc.so.6 appears to be truncated or corrupt to the
> client at somewhat random times...  I think it may be related to
> mount options, hence the question.

Theoretically, any filesystem that uses nmount(2) should have its
options recored in an easy-to-extract format, since one of the
arguments to nmount is an array of options.  I patched my kernel and
/sbin/mount binary to do this (borrowing the f_charspare field in
struct statfs), and it mostly works.  The stuff below in <> brackets
are from the options array.  You can see that cd9660 was mounted with
the option "ssector=0":

 (root at dan) /root># mount
 local/root on / (zfs, NFS exported, local, <rw,noro>)
 devfs on /dev (devfs, local, <>)
 /dev/ufs/boot on /.boot (ufs, local, soft-updates, <rw,noro>)
 procfs on /proc (procfs, local, <rw,noro>)
 /dev/md0 on /tmp (ufs, NFS exported, local, <>)
 /dev/cd0 on /cdrom (cd9660, NFS exported, local, read-only, <ro,ssector=0>)

Unfortunately, mount_nfs simply calls nmount with a single "nfs_args"
option whose value is the same binary "struct nfs_args" it used to call
mount(2) with :(  The fix would be to make nfs_vfsops.c and mount_nfs.c
use the options array instead of a custom struct, but
nfs_vfsops.c:nfs_decode_args scares me off every time I look at it.

-- 
	Dan Nelson
	dnelson at allantgroup.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mountopts.diff
Type: text/x-diff
Size: 1988 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20080205/b420cce6/mountopts.bin


More information about the freebsd-stable mailing list