Upload
frederica-lang
View
221
Download
1
Tags:
Embed Size (px)
Citation preview
File Systems (2)
Readings
Silbershatz et al: 11.8
Network-Attached Storage
Client machines may also have storage
Do this ….
Login into two different linux machines You should see your home directory Now go to /tmp on one of the machines Create a file with your last name and
put your full name in the file on that machine
Now go to the other machine
Virtual File System
How does an operating system allow multiple types of file systems to be integrated into a directory structure?
Data structures and procedures are used to isolate the basic system-call functionality from implementation
Virtual File System
Three layers File system interface: open(), read(), write() Virtual file system (VFS): Layer
• VFS allows the same system call interface (the API) to be used for different types of file systems.
• The API is to the VFS interface, rather than any specific type of file system
Schematic View of Virtual File System
Network File Systems
I’m on a Linux machine I go to another Linux machine
I see the same files in my home directory Why?
This is because you are using a networked file system (NFS)
NFS also provides the protocols needed for an integrated view of directories
The Sun Network File System (NFS)
An implementation and a specification of a software system for accessing remote files across Local area networks (LANs)
The implementation is part of the Solaris and SunOS operating systems running on Sun workstations using an unreliable datagram protocol (UDP/IP or TCP protocol) and Ethernet
NFS An NFS file server runs on a machine
(which may have large disks) that has a local file system.
An NFS client runs on an arbitrary machine and access the files on machines that run NFS servers.
NFS Directories can be mounted which
means that they can appear in the tree structure The directories can be on remote machines The remote machines may use a different
OS than the client machine
NFS Structures Export List
Maintained by server Information:
• List of local directories that server exports for mounting
• Names of machines that are permitted to mount them
File handle Refers to a set of information
• Identifier• An inode number to identify the mounted
directory
NFS Mount Protocol Establishes initial logical connection
between server and client Client sends a mount request message
to a server Request includes name of remote directory
to be mounted and name of server machine storing it
NFS Mount Protocol Following a mount request that
conforms to its export list, the server returns a file handle—a key for further accesses
The mount operation changes only the user’s view and does not affect the server side
NFSSupport access to files on remote serversMust support concurrency
Make varying guarantees about locking, who “wins” with concurrent writes, etc...
Must gracefully handle dropped connections
NFS When an application program calls
open() to obtain access to a file it is making a call to the NFS client
If the path refers to a local file, the system uses the computer’s standard file system software to access the file
If the path refers to a remote file, the system uses NFS client software to access the remote file through the NFS server
NFS
The NFS server handles incoming client requests
These requests are mapped to local file system operations
NFS Protocol All requests have a sequence number,
allowing the server to determine if a request is duplicated or if any are missing
Modern implementations use TCP/IP
What is UDP and TCP/IP? TCP provides reliable delivery of messages in
the network UDP does not
NFS Files are assumed to be shared by
multiple clients Synchronization is needed Problem
There is a performance problem if every time a client wants to access a file it has to go to the server
Thus clients are allowed to keep a local copy of the file while they are reading and writing its contents• This is referred to as caching
Now Try this
Go to /faculty/hanan Open the file helloThere Edit the file by adding your name and
then save and close.
NFS
UNIX Semantics When a read follows a write the read returns
the value just written When two writes happen in quick succession
followed by a read, the value read is the value stored by the last write
In a centralized systems this is easy to implement
If there is no caching in NFS then this is also easy to implement
NFS
NFS allows clients to cache for performance reasons
How then is UNIX semantics provided? Approach 1:
Propagate all changes to cached files back to the server as they happen
Not efficient• Lots of network traffic
NFS
Approach 2: Change the semantics NFS implements session semantics
• Changes to an open file are initially visible only to the process that modified the file
Implementation• When a process closes the file, it sends a copy to
the NFS server so that subsequent reads get the new value
What if two clients are caching and modifying the file at the same time?
NFS Client CachingNFS Clients are allowed to cache copies of
remote files for subsequent accessesSupports close-to-open cache consistency
When client A closes a file, its contents are synchronized with the server (which has the master copy), and timestamp is changed
When client B opens the file, it checks that local timestamp agrees with server timestamp. If not, it discards local copy
Other
SUN ZFS
Linux Btrfs
• ZFS for Linux• Still in prototype stage
ZFS
Integrated into Solaris 10 (2006)
The major feature that distinguishes ZFS from other file systems is ZFS’s focus on data integrity
ZFS
Data integrity Assume mirrored disk Application tries the first disk Checksum reveals the block is corrupt on
the disk ZFS tries the second disk Checksum indicates that the block is good ZFS delivers the data to the application and
repairs the first disk Before ZFS the file system didn’t use
checksum
Summary
Studied NFS