Mount Network File systems (NFS,Samba) in Ubuntu

Sponsored Link


Network File System (NFS), a protocol originally developed by Sun Microsystems in 1984 and defined in RFCs 1094, 1813, and 3530 (obsoletes 3010) as a distributed file system, allows a user on a client computer to access files over a network as easily as if attached to its local disks. NFS, like many other protocols, builds on the Open Network Computing Remote Procedure Call system (ONC RPC).


Samba is a free software re-implementation of SMB/CIFS networking protocol released under the GNU General Public License. As of version 3, Samba not only provides file and print services for various Microsoft Windows clients but can also integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a Domain Member. It can also be part of an Active Directory domain.

Samba runs on most Unix and Unix-like systems, such as GNU/Linux, Solaris, and the BSD variants, including Apple's Mac OS X Server (it was added to the OS X workstation edition with version 10.2). It is standard on nearly all distributions of Linux and is commonly included as a basic system service on other Unix-based systems as well.

If you want to mount your NFS and samba file systems on ubuntu client machines you need to use the /etc/fstab file (short for filesystem table) keeps track of filesystems that you want to mount in static locations.

fstab file looks like below

# /etc/fstab
# <device> <mountpoint> <filesystemtype> <options> <dump> <fsckorder>

/dev/hdb5 / ext2 defaults 1 1
/dev/hdb2 /home ext2 defaults 1 2
/dev/hdc /mnt/cdrom iso9660 noauto,ro,user 0 0
/dev/hda1 /mnt/dos/c msdos defaults 0 0
/dev/hdb1 /mnt/dos/d msdos defaults 0 0
/dev/fd0 /mnt/floppy ext2 noauto,user 0 0
/dev/hdb4 none ignore defaults 0 0

none /proc proc defaults
/dev/hdb3 none swap sw

Note that this system has two IDE partitions, one which is used as /, and the other used as /home. It also has two DOS partitions which are mounted under /mnt. Note the user option provided for the cdrom, and the floppy drive. This is one of the many default parameters you can specify. In this case it means that any user can mount a cdrom, or floppy disk. Other options will be dealt with later.

Mount NFS and smb File systems

Network filesystems use slightly different syntax than ordinary partitions.Specifically, the syntax you use to describe the filesystem is different.

For this example, we have an NFS share on host server1 at /mnt/apps, and a SMB file share on host server2 called accounts. We want to mount the NFS share at /mnt/software and the SMB share at /mnt/music.

Before mount these file systems we need to create a directory where we are going to mount these shares, In this example i am going to create software and music two shares using the following commands

sudo mount /mnt/software

sudo mount /mnt/music

To mount both of these partitions at boot time you need to add the following lines to your /etc/fstab file

server1:/mnt/apps /mnt/software nfs defaults 0 0
//server2/music /mnt/music smb defaults 0 0

In the above example explained as follows

For NFS shares follow the hostname:/path/to/share syntax,

For SMB shares follow the //hostname/share syntax.

Other than that, the remaining fields are same for this example and If you want to use NFS or SMB options you can use in the options field.

If you don't want a partition to mount at boot time , add the noauto option to the list of options.

If you want to know more available options you can check fstab man page and mount man page

Sponsored Link

Incoming search terms:

Related posts

13 thoughts on “Mount Network File systems (NFS,Samba) in Ubuntu

  1. I believe the commands listed under the “Before mount these file systems” paragraph should be:

    sudo mkdir /mnt/software

    sudo mkdir /mnt/music

  2. #discover shares within local network

    #using nautilus

    #using smbclient and smbmount
    sudo mkdir /mnt/mountshare
    smbclient -L
    Anonymous login successful
    Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.6]

    Sharename Type Comment
    ——— —- ——-
    IPC$ IPC IPC Service (Samba Server)
    ADMIN$ IPC IPC Service (Samba Server)

    sudo smbmount \\\\\\DAILY_LOGS /mnt/guard/ -o username=guard

  3. Thank god!
    comment #2 helped me a lot, using acer aspire one with crunchbang linux and i have always used nautilus do to things.
    So damn difficult when you dont know what to do :p

  4. This command
    sudo smbmount \\\\\\DAILY_LOGS /mnt/guard/ -o username=guard

    helped me a lot thanx, btw. is there a way to implement this to fstab? and I don’t mind if pswd going to show up,

    Thanks again

  5. Of NFS the original article says “..over a network as easily as if attached to its local disks”. But one major facility seems to be missing: using the Ubuntu graphical file browser, Nautilus, to view and modify the files.

    Nautilus works with smb shares but not, seemingly, with the more Uni(x)fied NFS.

    Please tell me I am wrong and have missed something.

  6. Dear ALL
    i habe ubuntu os i have some facing problem ,if mount any sharing folder then not permanently mount please helf

  7. @Nigel

    it is almost as sad as you have said.
    I just installed Ubuntu Netbook Remix 9.10 and I had to do an
    # apt-get install am-utils

    Because something as basic as mounting nfs exports through automounter seams no longer standard, only after that yield a cd to
    the expacted result (works likewise from within the file browser)


  8. In Xubuntu 9.10 i was able to mount samba shares using Gigolo(installed by default). Additionally to this to work i installed gvfs-fuse and fusesmb packages.

  9. Hi guyz!! i m using ubuntu lucid lynx inside windows vista..I have two partitions one for OS and another for recovery..Now i need 2 access my folders,files present in the OS drive.(i.e)I need to mount my OS drive..Previous commands are not applicable.I dont know why?If anybody see dis i kindly request u to reply.Thx a lot

  10. Nigel:

    NFS is not a “browsable” protocol, like SMB. Just do as h4d suggests. If you want to make sure it’s mounted all the time, you can add an entry to your /etc/fstab to have it mounted at boot time.

    to help, a product named autofs that mounts shares auto at boot or per attempt. can also unmount after delay of disuse.

  11. either this howto is erronous or it is not up to date!

    in fstab the filesystem type has to be “smbfs” not smb

    and one should mention, that you have to install the package smbfs!

  12. dear Rajesh if u want permanently mount of any folder then you need to entry in fstab (vi /etc/fstab)
    But remember i think the share folder system should be always connected otherwise your system will be corrupt

Leave a comment

Your email address will not be published. Required fields are marked *