NFS mount properties

Mikolaj Golub to.my.trociny at gmail.com
Sat Jan 30 22:55:26 UTC 2010


On Thu, 28 Jan 2010 08:46:33 -0800 Alan Aldrich wrote:

> I am trying to determine how to examine the actual properties of an
> nfs mount in FreeBSD
> In CentOS one can 'cat /proc/mounts' to determine all of the mount
> properties.
> Specifically I am trying to confirm whether the mount is using TCP or
> UDP as I want it to
> be TCP . Is there some similar way to tell in FreeBSD?
>
> My fstab entry says this
> 192.168.44.55:/mcp/home /net    nfs     rw,async,-d,-3,-s,-i,noatime,- 
> T 0 0
> It mounts fine,
> but I want to confirm that it is actually mounting with TCP and not
> UDP and cannot figure out
> what tool will tell me this.
>
> 'mount' tells me this
> 192.168.44.55:/mcp/home on /net (nfs, asynchronous, noatime)
>
> but not whether it is mounted TCP or UDP

If it is mounted with TCP u UDP you can find out with netstat, checking tcp
connections to 2049 port. If you see established connections like below

tcp4       0      0 10.0.0.110.895         10.0.100.2.2049        ESTABLISHED

then tcp is used. Certainly if you have several mounts on the same ip it
complicates the situation :-)

I don't know any such tools that would report this info and would glad to hear
about them, but if I really needed this info I could use the universal tool --
kgdb :-)

zhuzha:~% sudo kgdb
(kgdb) set print pretty
(kgdb) p *mountlist.tqh_first.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next
$26 = {
...
  mnt_list = {
    tqe_next = 0xc5e9a78c, 
    tqe_prev = 0xc5e9acac
  }, 
...
  mnt_opt = 0xc61f7760, 
...
  mnt_stat = {
    f_version = 537068824, 
    f_type = 4, 
    f_flags = 0, 
    f_bsize = 512, 
    f_iosize = 32768, 
    f_blocks = 284354052, 
    f_bfree = 137997300, 
    f_bavail = 115248976, 
    f_files = 18394110, 
    f_ffree = 16921938, 
    f_syncwrites = 0, 
    f_asyncwrites = 0, 
    f_syncreads = 0, 
    f_asyncreads = 0, 
    f_spare = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 
    f_namemax = 255, 
    f_owner = 0, 
    f_fsid = {
      val = {67174148, 4}
    }, 
    f_charspare = '\0' <repeats 79 times>, 
    f_fstypename = "nfs", '\0' <repeats 12 times>, 
    f_mntfromname = "srv01.ua1:/var/public\000\004(\000\000\000\000\000\214\004\b\003\000\000\000\003\000\000\000P\000\000\000X\002\000\000\200╩\000\000\000пBф\000\000\000\000 \a \aю\a7ф \a7фюx\037ф╟x\037ф\004\000\000\000\v\000\000", 
    f_mntonname = "/mnt/0", '\0' <repeats 81 times>
  }, 
...
}
(kgdb) p *mountlist.tqh_first.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_opt.tqh_first
$27 = {
  link = {
    tqe_next = 0xc6370560, 
    tqe_prev = 0xc61f7760
  }, 
  name = 0xc61f7770 "rw", 
  value = 0xc61f7780, 
  len = 1, 
  pos = 0, 
  seen = 0
}
(kgdb) p *mountlist.tqh_first.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_opt.tqh_first.link.tqe_next
$28 = {
  link = {
    tqe_next = 0xc6370580, 
    tqe_prev = 0xc6370520
  }, 
  name = 0xc61f77a0 "soft", 
  value = 0xc61f77b0, 
  len = 1, 
  pos = 1, 
  seen = 1
}
(kgdb) p *mountlist.tqh_first.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_opt.tqh_first.link.tqe_next.link.tqe_next
$29 = {
  link = {
    tqe_next = 0xc63705a0, 
    tqe_prev = 0xc6370560
  }, 
  name = 0xc61f77c0 "intr", 
  value = 0xc61f7810, 
  len = 1, 
  pos = 2, 
  seen = 1
}
(kgdb) p *mountlist.tqh_first.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_opt.tqh_first.link.tqe_next.link.tqe_next.link.tqe_next
$30 = {
  link = {
    tqe_next = 0xc63705e0, 
    tqe_prev = 0xc6370580
  }, 
  name = 0xc61f77d0 "rsize", 
  value = 0xc61f77e0, 
  len = 6, 
  pos = 3, 
  seen = 1
}
(kgdb) p *mountlist.tqh_first.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_opt.tqh_first.link.tqe_next.link.tqe_next.link.tqe_next.link.tqe_next
$31 = {
  link = {
    tqe_next = 0xc6370620, 
    tqe_prev = 0xc63705a0
  }, 
  name = 0xc61f77f0 "wsize", 
  value = 0xc61f7800, 
  len = 6, 
  pos = 4, 
  seen = 1
}
(kgdb) p *mountlist.tqh_first.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_list.tqe_next.mnt_opt.tqh_first.link.tqe_next.link.tqe_next.link.tqe_next.link.tqe_next.link.tqe_next
$32 = {
  link = {
    tqe_next = 0xc6370640, 
    tqe_prev = 0xc63705e0
  }, 
  name = 0xc61f7820 "tcp", 
  value = 0xc61f7830, 
  len = 1, 
  pos = 5, 
  seen = 1
}

If I needed to do this frequently I would write a gdb script taking as an
example nice scripts from jhb :-)

http://people.freebsd.org/~jhb/gdb/

-- 
Mikolaj Golub


More information about the freebsd-net mailing list