Debian Admin - Your way to Debian World

December 22, 2006

Mount Network File systems (NFS,Samba) in Ubuntu

by @ 10:00 am. Filed under Other Linux

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Introduction

NFS

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

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

Tags: , , , , ,

You may also be interested in...

Leave a Reply

Subscribe RSS Feed

subscribe to the Debian Admin RSS feed

Internal links:

Sponsors:



Categories:

Support Debian Admin

Amount $:
Website(Optional):

Sponsors:

Archives:

Related Links:


Favourite Sites:

Wordpress Collection
Windows Reference
Ubuntu Geek
DebianHelp
All About Debian Tutorials
Power Electrical
Check Your IP Here
Debian,Ubuntu News
DebCentral
Tuxmachines
Capnkirby
Libervis
Nuxifield
Linux Horizon
Linux Appfinder
Debuntu
GNU/Linux For Everyone
Free Penguin
DebianAdmin is not related to the Debian Project.
This site is copyright © 2006,2007 Debian Admin
All Trademarks are the property of their respective owners.
The contents of this website may not be mirrored or archived without the express written permission of DebianAdmin Site Owner.

DISCLAIMER: All the information, troubleshooting methods, utilities offered in this website is provided AS-IS, without any warranties. Though I strive for perfection, and always test the validity and effectiveness of the troubleshooting content in various systems, I assume no responsibility for your use of these Fixes, Utilities and other troubleshooting advice. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason. All use is completely at your own risk. Changes to the existing content and new additions are made to this website periodically, without notification.
Rodney's Kontera DynamiContext Plugin plugged in.