Shri Vaishnav Institute of
Technology & Science
Indore
Session:2016-17
Ditributed File SystemDitributed File System
(NFS,AFS,VFS)(NFS,AFS,VFS)
 What is File System?
 What is Network File System?
 Version of NFS
 NFS Architecture
 Advantages of NFS
 Disadvantages of NFS
 What is Andrew File System?
 Components of AFS
 AFS Namespace
 Advantages of AFS
 Disadvantages of AFS
 Difference between NFS and AFS
 What is Virtual File System?
 VFS Inode
 VFS Superblock
 Implementation
 Advantages
 Disadvantages
• A file system is a hierarchical structure (file tree) of
files and directories.
• This file tree uses directories to organize data and
programs into groups, allowing the management of
several directories and files at one time.
• Some tasks are performed more efficiently on a file
system than on each directory within the file system.
What is Network File System?
• NFS developed by SUN Microsystems for use on its UNIX-
based workstations.
• A distributed file system
• Allows users to access files and directories located on remote
computers
• But, data potentially stored on another machine.
• NFS builds on the Open Network Computing Remote Procedure
Call (ONC RPC) system
Mechanism for storing files on a network.
Allows users to ‘Share’ a directory.
NFS most commonly used with UNIX systems.
Other software platforms:
-Mac OS, Microsoft Windows, Novell NetWare, etc.
Major Goals:
-simple crash recovery
-reasonable performance :80% of a local drive
Three versions of NFS are in use:
• NFSv1
• NFSv2
• NFSv3
• NFSv4
There are three ways to implement network file system:
◦ Upper kernel layer
◦ Lower kernel layer
◦ Middle kernel layer (vnode layer)
Important aspect of NFS implementation –
implementing effective cache mechanism to boost
performance.
RPC request Action
CREATE Creates (or truncates) a file in the directory
LINK Creates a hard link
LOOKUP Looks up a file in the directory
MKDIR Makes a directory
READADDR Reads the contents of a directory
REMOVE Removes a file in the directory
RENAME Renames a file in the directory
RMDIR Removes a directory
SYMLINK Creates a symbolic link
RPC request Action
GETATTR Get file attribute
SETATTR Set file attribute
LOOKUP File name search
ACCESS Check access
READ Read file
WRITE Write to the file
CREATE Create file
REMOVE Remove file
RENAME Rename file
 Stateless server and client
 Server can be rebooted and user on client might be
unaware of the reboot
 Client/Server distinction occurs at the application/user level
not the system level
 Highly flexible, so we need to be disciplined in our
administration/configuration
 Uses RPC authentication
◦ easily spoofed
 File system data is transmitted in cleartext
◦ Data could be copied
 Network slower than local disk
 Complexity, Security issues.
 Stateful Servers
 Keep persistent information about client.
 Improved performance
 Expensive recovery
 Must track clients
 Stateless Servers
 Does not keep state of clients
 Limited client state
 Can change own state without informing clients
 Increased communication.
 A distributed computing environment (Andrew) under development
since 1983 at Carnegie-Mellon University(cmu), purchased by IBM
and released as Transarc DFS, now open sourced as OpenAFS.
 The Andrew File System heavily influenced Version 4 of Sun
Microsystems' popular Network File System (NFS)
GOALS OF AFS:
 uniform name space, scalability
 location-independent file sharing,
 client-side caching (with cache consistency),
 secure authentication (via Kerberos)
 Also includes server-side caching (via replicas), high availability
 AFS is implemented as two software components that exist
at UNIX processes called Vice and Venus.
 Vice: The server side process that resides on top of the
unix kernel, providing shared file services to each client
 Venus: The client side cache manager which acts as an
interface between the application program and the Vice
Venus
Workstations Servers
Venus
VenusUser
program
Network
UNIX kernel
UNIX kernel
Vice
User
program
User
program
Vice
UNIX kernel
UNIX kernel
UNIX kernel
Distribution of processes in the Andrew File System
 The files available to user processes running on
workstations are either local or shared.
 Local files :are handled as normal UNIX files. They are
stored on the workstation’s disk and are available only to
local user processes.
 Shared files: are stored on servers, and copies of them are
cached on the local disks of workstations.
/ (root)
tmp bin cmuvmunix. . .
bin
SharedLocal
Symbolic
links
File name space seen by clients of AFS
It is a conventional UNIX
directory hierarchy, with a
specific subtree (called
cmu) containing all of the
shared files.
This splitting of the file name
space into local and shared
files leads to some loss of
location transparency, but
this is hardly noticeable to
users other than system
administrators.
UNIX file
system calls
Non-local file
operations
Workstation
Local
disk
User
program
UNIX kernel
Venus
UNIX file system
Venus
The basic file operations
between venus and vice
can be described more
completely as:
Open a file
Read and Write
Close a file
These are the remote calls to execute a process.
Files are grouped into volumes for ease of location and movement.
The representation of fids includes the volume number for the volume
containing
An NFS file handle identifying the file within the volume
Each file and directory in the shared file space is identified by a
unique, 96-bit file
Uniquifier to ensure that file identifiers are not reused.
identifiers are not reused
To solve this,
all Workstations carries copy of file
all clients with copies of a file being modified by another
client are not informed the moment the client makes changes.
That client thus updates its copy, and the changes are
reflected in the distributed file system only after the client
closes the file.
Various terms related to this concept in AFS are:
Whole File Serving: The entire file is transferred in one go,
limited only by the maximum size UDP/IP supports.
Whole File Caching: The entire file is cached in the local
machine cache, reducing file-open latency, and frequent
read/write requests to the server.
Write On Close: Writes are propagated to the server side
copy only when the client closes the local copy of the file.
 AFS has stateful servers, whereas NFS has stateless servers.
 AFS provides both :
1. location independence (the physical storage location of
the file can be changed, without having to change the path of
the file, etc.)
2. location transparency (the file name does not hint at its
physical storage location). But as was seen in the last lecture,
NFS provides only location transparency.
 Callback : Stateful servers in AFS allow the server to inform all
clients with open files about any updates made to that file by
another client.
 Callbacks to all clients with a copy of that file is ensured as
a callback promise is issued by the server to a client when it
requests for a copy of a file.
1. Cache Manager
2. Location independence
3. Scalability(whole file cache & whole file serving)
4.Improved security : Firstly, AFS makes use of Kerberos(Kerberos is
a network authentication protocol.Uses Symmetric : same key
encryption) to authenticate users. This improves security for
several reasons:
1.Encrypted passwords
2.AFS uses mutual authentication - both the service provider and
service requester prove their identities
5.Replicated AFS volumes
6.Improved robustness(strong) to server crash : The Cache Manager
maintains local copies of remotely accessed files in cache So in
case of failure client can access file via cache memory.
 In case the application had not updated the copy before it closed
it, it may continue to work on the same copy.
 The clocks will have to be synchronized.
 Writes are made to server. Cache miss -> Server():Slow
 Server is single point of failure
 Write through on close().No changes are seen until close.
 Multiple Users Modifying Files? : last saved is propogated
 broken callback ? : receiver donot know of updated file until next update
 Component in the kernel that handles file-systems, directory
and file access.
 Abstracts common tasks of many file-systems.
 Presents the user with a unified interface, via the file-related
system calls (open, stat, chmod etc.).
 File system-specific operations:- vector them to the file
system in charge of the file.
 A superblock is a record of the characteristics of a file
system, including its size, the block size, the empty and the
filled blocks and their respective counts, the size and location
of the inode tables, the disk block map and usage
information, and the size of the block groups.
It contains the fields such as:
 Device:
It is the device identifier for the block device that this file
system is contained in.
 Inode pointers:
The mounted inode pointer points at the first inode in this
file system.
 Blocksize:
The block size in bytes of this file system.
 Superblock operations:
 A pointer to a set of superblock routines for this file
system.
 File System type:
 A pointer to the mounted file
system's file_system_type data structure
 File System specific:
 A pointer to information needed by this file system
 The inode is a data structure in a file system that describes
a file system object such as a file or a directory. Each inode
stores the attributes and disk block location(s) of the object's
data.
 It contains the fields such as:
 Device, inode number :
unique within VFS.
 owner uid
 permission information
 i_op :
pointer to inode operations.
 lock:
This field is used to lock the VFS inode .
 As each file system is initialized it registers itself with VFS at the
system boot time.
 When a file system is mounted ,it has a root file system, each file
system superblock read routines and map that information on to the
VFS superblock data structure.
 VFS keeps a list of mounted file system with VFS superblock.
 Each VFS superblock contains information and pointer to routines
that perform particular functions.
 This inode read routine ,fills out the fields in a VFS inode .
 Each VFS superblock contains a pointer to the first VFS
inode .
 As the system processes access directories ,routines are
called which traverses the VFS inodes in the system
 Pathname is used by the VFS to search through the directory
(pathname to device number, block number).
 Calls the lookup() method (file system specific) of the
parent directory inode to look up the inode.
 Caches the directory entries during this traversal. (DCache)
 Check for permissions and if ok then proceed.
 Allocates a file structure with a pointer to its dentry and to
file specific operations.
 File structure is placed into the file descriptor table for the
process.
 Read, write etc. will use this user-space file descriptor.
 Speed up accesses to commonly used directories.
 Hash table:- device number and directory's name to
calculate the hash value
 Only short directory entries (up to 15 characters long) are
cached. eg./usr/X11R6/bin
 Dcache replacement policy:- two level LRU cache list.
 Is similar to Dcache in implementation.
 It is implmeneted as a hash table whose entries are pointers
to lists of VFS inode which have the same hash value.
 The hash value of an inode is calculated from its inode
number and from the device identifier .
 This gives it a pointer to a list of inodes with the same hash
value.
 The Linux file systems regard block devices as a linear
collections of blocks irrespective of the underlying physical
disk's geometry.
 Device driver maps a particular block of its device into track,
sector and cylinder etc.
 As blocks are accessed, they are put into the Buffer Cache

 Also helps manage the asynchronous interface with the block
device drivers.
 Shared between all of the physical block devices.
 Block buffers within the cache are identfied by the device
identifier and the block number.
 2 functional parts:
◦ lists of free block buffers (of different sizes)
◦ the cache (hash table).
 House-keeping of the buffer cache: pdflush
 The major advantantage is that it is very simple to add new
drivers.
 Further, it allows the per process per user configuration,
which is a key aspect.
 It works right now and solve a real problem which is the
transparent access to floppy and CDs.
 It is fragile. A program statically linked won't co-operate
with Virtualfs. It will operate as if Virtualfs was not
installed.
 It is a little slower. The processing needed to intercept a
file operation and decided if further processing is needed is
slowing down a bit.
 Virtualfs does not deal properly with symbolic links.
 New technologies open up new possibilities for
network file systems
 Cost of increased traffic over Ethernet may cause
problems for xFS, cooperative caching.
 www.compnetworking.com
 www.internetslang.com
 www.linux.com
Presentation on nfs,afs,vfs

Presentation on nfs,afs,vfs

  • 1.
    Shri Vaishnav Instituteof Technology & Science Indore Session:2016-17
  • 2.
    Ditributed File SystemDitributedFile System (NFS,AFS,VFS)(NFS,AFS,VFS)
  • 3.
     What isFile System?  What is Network File System?  Version of NFS  NFS Architecture  Advantages of NFS  Disadvantages of NFS  What is Andrew File System?  Components of AFS  AFS Namespace  Advantages of AFS  Disadvantages of AFS  Difference between NFS and AFS  What is Virtual File System?  VFS Inode  VFS Superblock  Implementation  Advantages  Disadvantages
  • 4.
    • A filesystem is a hierarchical structure (file tree) of files and directories. • This file tree uses directories to organize data and programs into groups, allowing the management of several directories and files at one time. • Some tasks are performed more efficiently on a file system than on each directory within the file system.
  • 5.
    What is NetworkFile System? • NFS developed by SUN Microsystems for use on its UNIX- based workstations. • A distributed file system • Allows users to access files and directories located on remote computers • But, data potentially stored on another machine. • NFS builds on the Open Network Computing Remote Procedure Call (ONC RPC) system
  • 6.
    Mechanism for storingfiles on a network. Allows users to ‘Share’ a directory. NFS most commonly used with UNIX systems. Other software platforms: -Mac OS, Microsoft Windows, Novell NetWare, etc. Major Goals: -simple crash recovery -reasonable performance :80% of a local drive
  • 7.
    Three versions ofNFS are in use: • NFSv1 • NFSv2 • NFSv3 • NFSv4
  • 9.
    There are threeways to implement network file system: ◦ Upper kernel layer ◦ Lower kernel layer ◦ Middle kernel layer (vnode layer) Important aspect of NFS implementation – implementing effective cache mechanism to boost performance.
  • 10.
    RPC request Action CREATECreates (or truncates) a file in the directory LINK Creates a hard link LOOKUP Looks up a file in the directory MKDIR Makes a directory READADDR Reads the contents of a directory REMOVE Removes a file in the directory RENAME Renames a file in the directory RMDIR Removes a directory SYMLINK Creates a symbolic link
  • 11.
    RPC request Action GETATTRGet file attribute SETATTR Set file attribute LOOKUP File name search ACCESS Check access READ Read file WRITE Write to the file CREATE Create file REMOVE Remove file RENAME Rename file
  • 12.
     Stateless serverand client  Server can be rebooted and user on client might be unaware of the reboot  Client/Server distinction occurs at the application/user level not the system level  Highly flexible, so we need to be disciplined in our administration/configuration
  • 13.
     Uses RPCauthentication ◦ easily spoofed  File system data is transmitted in cleartext ◦ Data could be copied  Network slower than local disk  Complexity, Security issues.
  • 14.
     Stateful Servers Keep persistent information about client.  Improved performance  Expensive recovery  Must track clients  Stateless Servers  Does not keep state of clients  Limited client state  Can change own state without informing clients  Increased communication.
  • 15.
     A distributedcomputing environment (Andrew) under development since 1983 at Carnegie-Mellon University(cmu), purchased by IBM and released as Transarc DFS, now open sourced as OpenAFS.  The Andrew File System heavily influenced Version 4 of Sun Microsystems' popular Network File System (NFS) GOALS OF AFS:  uniform name space, scalability  location-independent file sharing,  client-side caching (with cache consistency),  secure authentication (via Kerberos)  Also includes server-side caching (via replicas), high availability
  • 16.
     AFS isimplemented as two software components that exist at UNIX processes called Vice and Venus.  Vice: The server side process that resides on top of the unix kernel, providing shared file services to each client  Venus: The client side cache manager which acts as an interface between the application program and the Vice
  • 17.
    Venus Workstations Servers Venus VenusUser program Network UNIX kernel UNIXkernel Vice User program User program Vice UNIX kernel UNIX kernel UNIX kernel Distribution of processes in the Andrew File System
  • 18.
     The filesavailable to user processes running on workstations are either local or shared.  Local files :are handled as normal UNIX files. They are stored on the workstation’s disk and are available only to local user processes.  Shared files: are stored on servers, and copies of them are cached on the local disks of workstations.
  • 19.
    / (root) tmp bincmuvmunix. . . bin SharedLocal Symbolic links File name space seen by clients of AFS It is a conventional UNIX directory hierarchy, with a specific subtree (called cmu) containing all of the shared files. This splitting of the file name space into local and shared files leads to some loss of location transparency, but this is hardly noticeable to users other than system administrators.
  • 20.
    UNIX file system calls Non-localfile operations Workstation Local disk User program UNIX kernel Venus UNIX file system Venus The basic file operations between venus and vice can be described more completely as: Open a file Read and Write Close a file These are the remote calls to execute a process.
  • 21.
    Files are groupedinto volumes for ease of location and movement. The representation of fids includes the volume number for the volume containing An NFS file handle identifying the file within the volume Each file and directory in the shared file space is identified by a unique, 96-bit file Uniquifier to ensure that file identifiers are not reused. identifiers are not reused
  • 22.
    To solve this, allWorkstations carries copy of file all clients with copies of a file being modified by another client are not informed the moment the client makes changes. That client thus updates its copy, and the changes are reflected in the distributed file system only after the client closes the file.
  • 23.
    Various terms relatedto this concept in AFS are: Whole File Serving: The entire file is transferred in one go, limited only by the maximum size UDP/IP supports. Whole File Caching: The entire file is cached in the local machine cache, reducing file-open latency, and frequent read/write requests to the server. Write On Close: Writes are propagated to the server side copy only when the client closes the local copy of the file.
  • 24.
     AFS hasstateful servers, whereas NFS has stateless servers.  AFS provides both : 1. location independence (the physical storage location of the file can be changed, without having to change the path of the file, etc.) 2. location transparency (the file name does not hint at its physical storage location). But as was seen in the last lecture, NFS provides only location transparency.  Callback : Stateful servers in AFS allow the server to inform all clients with open files about any updates made to that file by another client.  Callbacks to all clients with a copy of that file is ensured as a callback promise is issued by the server to a client when it requests for a copy of a file.
  • 25.
    1. Cache Manager 2.Location independence 3. Scalability(whole file cache & whole file serving) 4.Improved security : Firstly, AFS makes use of Kerberos(Kerberos is a network authentication protocol.Uses Symmetric : same key encryption) to authenticate users. This improves security for several reasons: 1.Encrypted passwords 2.AFS uses mutual authentication - both the service provider and service requester prove their identities 5.Replicated AFS volumes 6.Improved robustness(strong) to server crash : The Cache Manager maintains local copies of remotely accessed files in cache So in case of failure client can access file via cache memory.
  • 26.
     In casethe application had not updated the copy before it closed it, it may continue to work on the same copy.  The clocks will have to be synchronized.  Writes are made to server. Cache miss -> Server():Slow  Server is single point of failure  Write through on close().No changes are seen until close.  Multiple Users Modifying Files? : last saved is propogated  broken callback ? : receiver donot know of updated file until next update
  • 27.
     Component inthe kernel that handles file-systems, directory and file access.  Abstracts common tasks of many file-systems.  Presents the user with a unified interface, via the file-related system calls (open, stat, chmod etc.).  File system-specific operations:- vector them to the file system in charge of the file.
  • 29.
     A superblockis a record of the characteristics of a file system, including its size, the block size, the empty and the filled blocks and their respective counts, the size and location of the inode tables, the disk block map and usage information, and the size of the block groups. It contains the fields such as:  Device: It is the device identifier for the block device that this file system is contained in.  Inode pointers: The mounted inode pointer points at the first inode in this file system.  Blocksize: The block size in bytes of this file system.
  • 30.
     Superblock operations: A pointer to a set of superblock routines for this file system.  File System type:  A pointer to the mounted file system's file_system_type data structure  File System specific:  A pointer to information needed by this file system
  • 31.
     The inodeis a data structure in a file system that describes a file system object such as a file or a directory. Each inode stores the attributes and disk block location(s) of the object's data.  It contains the fields such as:  Device, inode number : unique within VFS.  owner uid  permission information  i_op : pointer to inode operations.  lock: This field is used to lock the VFS inode .
  • 32.
     As eachfile system is initialized it registers itself with VFS at the system boot time.  When a file system is mounted ,it has a root file system, each file system superblock read routines and map that information on to the VFS superblock data structure.  VFS keeps a list of mounted file system with VFS superblock.  Each VFS superblock contains information and pointer to routines that perform particular functions.
  • 33.
     This inoderead routine ,fills out the fields in a VFS inode .  Each VFS superblock contains a pointer to the first VFS inode .  As the system processes access directories ,routines are called which traverses the VFS inodes in the system
  • 35.
     Pathname isused by the VFS to search through the directory (pathname to device number, block number).  Calls the lookup() method (file system specific) of the parent directory inode to look up the inode.  Caches the directory entries during this traversal. (DCache)
  • 36.
     Check forpermissions and if ok then proceed.  Allocates a file structure with a pointer to its dentry and to file specific operations.  File structure is placed into the file descriptor table for the process.  Read, write etc. will use this user-space file descriptor.
  • 38.
     Speed upaccesses to commonly used directories.  Hash table:- device number and directory's name to calculate the hash value  Only short directory entries (up to 15 characters long) are cached. eg./usr/X11R6/bin  Dcache replacement policy:- two level LRU cache list.
  • 39.
     Is similarto Dcache in implementation.  It is implmeneted as a hash table whose entries are pointers to lists of VFS inode which have the same hash value.  The hash value of an inode is calculated from its inode number and from the device identifier .  This gives it a pointer to a list of inodes with the same hash value.
  • 40.
     The Linuxfile systems regard block devices as a linear collections of blocks irrespective of the underlying physical disk's geometry.  Device driver maps a particular block of its device into track, sector and cylinder etc.  As blocks are accessed, they are put into the Buffer Cache   Also helps manage the asynchronous interface with the block device drivers.
  • 41.
     Shared betweenall of the physical block devices.  Block buffers within the cache are identfied by the device identifier and the block number.  2 functional parts: ◦ lists of free block buffers (of different sizes) ◦ the cache (hash table).  House-keeping of the buffer cache: pdflush
  • 42.
     The majoradvantantage is that it is very simple to add new drivers.  Further, it allows the per process per user configuration, which is a key aspect.  It works right now and solve a real problem which is the transparent access to floppy and CDs.
  • 43.
     It isfragile. A program statically linked won't co-operate with Virtualfs. It will operate as if Virtualfs was not installed.  It is a little slower. The processing needed to intercept a file operation and decided if further processing is needed is slowing down a bit.  Virtualfs does not deal properly with symbolic links.
  • 44.
     New technologiesopen up new possibilities for network file systems  Cost of increased traffic over Ethernet may cause problems for xFS, cooperative caching.
  • 45.

Editor's Notes

  • #20 Local files are used only for temporary files (/tmp) : essential symbolic links from local directories to files held in the shared space. Users’ directories are in the shared space, enabling users to access their files from any workstation. for workstation startup .Other standard UNIX files (such as those normally found in /bin,/lib and so on) are implemented as
  • #21 The basic file operations can be described more completely as: Open a file: Venus traps application generated file open system calls, and checks whether it can be serviced locally (i.e. a copy of the file already exists in the cache) before requesting Vice for it. It then returns a file descriptor to the calling application. Vice, along with a copy of the file, transfers a callback promise, when Venus requests for a file. Read and Write: Reads/Writes are done from/to the cached copy. Close a file: Venus traps file close system calls and closes the cached copy of the file. If the file had been updated, it informs the Vice server which then replaces its copy with the updated one, as well as issues callbacks to all clients holding callback promises on this file. On receiving a callback, the client discards its copy, and works on this fresh copy.