NFS - Pasargad Realm
Download
Report
Transcript NFS - Pasargad Realm
NFS
Presented by: mohamad amin Rastgoo
Published under Term of GPL
What is file System?
A disk drive by itself provides a place to store data,
and nothing more. In fact, by itself, the only way to
access data on a hard drive is by either specifying
the data's physical location (in terms of cylinder,
head, and sector), or by its logical location (the
65,321st block) on the disk.
What is needed is a way to more easily keep track
of things stored on hard drives; a way of filling
information in an easilyaccessible way.
That is the role of the file system.
Published under Term of GPL
An Overview of File Systems
File systems, as the name implies, treat different sets of
information as files. Each file is separate from every other.
Over and above the information stored within it, each file
includes additional information:
The file's name
The file's access permissions
The time and date of the file's creation, access, and
modification.
While file systems in the past have included no more
complexity than that already mentioned, presentday file
systems include mechanisms to make it easier to group
related files together. The most commonly used mechanism is
the directory. Often implemented as a special type of file,
directories make it possible to create hierarchical structures of
files and directories.
Published under Term of GPL
What is NFS?
As the name implies, the Network File System (more commonly
known as NFS) is a file system that may be accessed via a network
connection.
The Network File System (NFS) was developed to allow machines to
mount a disk partition on a remote machine as if it were on a local
hard drive. This allows for fast, seamless sharing of files across a
network With other file systems, the storage device must be directly
attached to the local system. However, with NFS this is not a
requirement, making possible a variety of different configurations,
from centralized file system servers, to entirely diskless computer
systems
However, unlike the other file systems discussed here, NFS does not
dictate a specific ondisk format. Instead, it relies on the server
operating system's native file system support to control the actual I/O
to local disk drive(s). NFS then makes the file system available to
any operating system running a compatible NFS client.
Published under Term of GPL
NFS & SAMBA
Samba uses the SMB protocol to share files and printers
across a network connection.
Operating systems that support this protocol include Microsoft
Windows, OS/2, and Linux
From a basic point of view, NFS and Samba are very similar.
Both have a client and server application. Both allow a server
to share files with clients. Both have clients and servers on
almost every platform. The big difference is the Windows PCs
have Samba-compatible clients and servers as part of their
default network support and Windows requires third party
software to support NFS. Conversely, UNIX systems usually
come with and use NFS by default with Samba being used to
provide file sharing with Windows PCs.
SMB is a protocol used by the Microsoft Windows operating
system to share files on a network. NFS is a protocol used
primarily on UNIX platforms for sharing
Published under Term of GPL
Why Use NFS?
NFS is useful for sharing directories of files
between multiple users on the same network.
For example, a group of users working on the same
project can have access to the files for that project
using a shared directory of the NFS file system
(commonly known as an NFS share) mounted in
the directory /myproject. To access the shared files,
the user goes into the /myproject directory on his
machine. There are no passwords to enter or
special commands to remember. Users work as if
the directory is on their local machine
Published under Term of GPL
Useful usage
It can be used for Networked Backups:
The theory of NFS backup is relatively
simple: mount each host to the NFS
server, write a .tar backup script, and check
that the following permission
sets conform on both machines:
1. Read Write access.
2. Mount permissions.
3. GID/UID.
Published under Term of GPL
Protocols
There are several revisions—or protocols—of NFS. Version 3 of NFS (NFSv3)
is rapidly becoming the default version on most Linux systems. This version is
available in the latest Linux 2.2 and 2.4 kernels
Version 4 in under develop and going to remove lacks:
NFS Versions 2 and 3 are stateless protocols, but NFS Version 4 introduces state.
NFS Version 4 introduces support for byterange
locking and share reservation.
NFS Version 4 introduces file delegation.
NFS Version 4 uses compound RPCs.
NFS Version 4 specifies a number of sophisticated security mechanisms, and
mandates their implementation by all conforming clients.
NFS Version 4 standardizes the use and interpretation of ACLs across Posix and
Windows environments.
NFS Version 4 combines the disparate NFS protocols (stat, NLM, mount, ACL,
and NFS)
NFS Version 4 introduces protocol support for file migration and replication.
NFS Version 4 requires support of RPC over streaming network transport
protocols such as TCP.
For more information on the NFS Version 4 protocol, read RFC 3530.
Published under Term of GPL
NFS (Network File System)
NFS developed by Sun Microsystems
Native method for file sharing between Unix/Linux
systems
Stateless protocol(2&3):
Means server keeps no state:
Renders server crashes `easily recoverable‘
Should be compatible with all Unix like systems
Best in trusted environment, not highly secure
Best where all user/group IDs are same
Often used with Information Services (NIS) to
synchronise user/group IDs
Published under Term of GPL
NFS (Network File System)
Systems are clients, servers or both
Clients import shared filesystems
Servers export shared filesystems
Servers easy to implement via network
daemons
Clients require kernel modifications
Linux systems normally work as both
already
NFS is NOT Unix/Linux specific (e.g.
PCNFS)
Published under Term of GPL
Exporting File Systems
Exporting handled by daemons .nfsd and Must be
running for NFS export to work
Exported file systems listed in /etc/exports, format
is:
Example:
hostname(flags) [hostname(flags)]
/tmp *.blah.co.uk(ro)
Exports /tmp to all systems belonging to domain read only
J1
Important flags:
(read only)
(read/write)
Published under Term of GPL
Exporting File Systems
_squash (map all uid/gid to something)
(specify user ID to map to)
(specify group ID to map to)
After changing /etc/exports, restart NFS
killall -HUP rpc.nfsd
killall -HUP mount
or
/etc/rc.d/init.d/nfs restart
Published under Term of GPL
Viewing exports
● Use showmount:
$ showmount -e
$ showmount -e hostname
Export list for
landlord.gbdirect.co.uk:
/usr/local/gbdirect/cvsroot
roti.gbdirect.co.uk
/home/adamg
roti.gbdirect.co.uk
/home/andylong
Published under Term of GPL
Exporting File Systems
along2.gbdirect.co.uk
/home/mikeb
kebab.gbdirect.co.uk
/mnt/cdrom <anon
clnt>
● uses a to handle requests
● This must be running (and you must have access to it) to
use
● Check that hosts.allow contains an entry to permit you
access, e.g.
● : ALL or
● : my.ip.network.
Published under Term of GPL
Importing File Systems
Mount a remotely exported directory Usually have
to be superuser:
$ mount
hostname:/sharename /local/directory
If successful, the export named /sharename on
host hostname is mounted on
our mountpoint /local/directory Files accessed
just as if local Remote host must be exporting the
directory
You must have access permission
Your local mountpoint must exist
Exactly like mounting a device
Published under Term of GPL