Mount Network File systems (NFS,Samba) in Ubuntu
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
# <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.