How to mount NFS and SMB under Ubuntu

If you want to mount your NFS or Samba file systems at boot time under Ubuntu, edit the file: /etc/fstab

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

First we have to create the mount points:

mkdir /mnt/software
mkdir /mnt/music

Now add the following lines to file /etc/fstab:

# Mounting NFS share
server1:/mnt/apps /mnt/software nfs defaults 0 0
# Mounting SMB share
//server2/music /mnt/music smb defaults 0 0

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