Saturday, June 24, 2006

Mounting nfs share

When my nfs server is running, it would be nice to mount this share. I use Ubuntu 5.10 as one mounting the nfs share. In fact, I have access to few Ubuntu based servers, so my experience is mainly base on Ubuntu distribution.

Firts of all, to mount on Ubuntu you need root privilages. Asummig you have them, mounting is childish.

Actual mounting can be made in two ways:

  1. Manually - as root you mount using mount command:
    mount -t nfs 196.17.43.65:/home/me/mynfs /home/menew/mounted_nfs
    where:
    • -t nfs - we mount nfs
    • 196.17.43.65:/home/me/mynfs - IP and sheared folder
    • /home/menew/mounted_nfs - where this share should be installed on our local file system
  2. Using /etc/fstab
    Add one line to /etc/fstab describing your nfs volume e.g.: 196.17.43.65:/home/mwolski/mynfs /home/menew/mounted_nfs nfs noauto,rw,users,owner 0 0
    Thanks to this to mount you as a normal user can execute
    mount /home/menew/mounted_nfs

To unmount nfs partition, you invoke umount /home/menew/mounted_nfs just like normal other partition.

Used options in fstab

  • noauto - the nfs is mounted only explicitly,insead of being mount at bootup
  • users - normal user can mount this volume
  • owner - only owner of local directory (/home/menew/mounted_nfs) can mount
  • rw - mount is read/write