Lecture 25: Distributed File Systems

Slides:



Advertisements
Similar presentations
More on File Management
Advertisements

CS-550: Distributed File Systems [SiS]1 Resource Management in Distributed Systems: Distributed File Systems.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 27: Distributed File Systems All slides © IG.
CMPT Dr. Alexandra Fedorova Lecture VII: Distributed File Systems.
Other File Systems: LFS and NFS. 2 Log-Structured File Systems The trend: CPUs are faster, RAM & caches are bigger –So, a lot of reads do not require.
Chapter 10: File-System Interface
University of Pennsylvania 11/21/00CSE 3801 Distributed File Systems CSE 380 Lecture Note 14 Insup Lee.
Distributed File Systems Concepts & Overview. Goals and Criteria Goal: present to a user a coherent, efficient, and manageable system for long-term data.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed File Systems Steve Ko Computer Sciences and Engineering University at Buffalo.
CSC 456 Operating Systems Seminar Presentation (11/13/2012) Leon Weingard, Liang Xin The Google File System.
Networked File System CS Introduction to Operating Systems.
Distributed File Systems
Distributed File Systems Case Studies: Sprite Coda.
Distributed File Systems Overview  A file system is an abstract data type – an abstraction of a storage device.  A distributed file system is available.
What is a Distributed File System?? Allows transparent access to remote files over a network. Examples: Network File System (NFS) by Sun Microsystems.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Page 110/19/2015 CSE 30341: Operating Systems Principles Chapter 10: File-System Interface  Objectives:  To explain the function of file systems  To.
1 Chap8 Distributed File Systems  Background knowledge  8.1Introduction –8.1.1 Characteristics of File systems –8.1.2 Distributed file system requirements.
CSE 486/586 CSE 486/586 Distributed Systems Distributed File Systems Steve Ko Computer Sciences and Engineering University at Buffalo.
DISTRIBUTED FILE SYSTEMS Pages - all 1. Topics  Introduction  File Service Architecture  DFS: Case Studies  Case Study: Sun NFS  Case Study: The.
Lecture 27-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) December 3, 2013 Lecture 27 Distributed File Systems.
Information Management NTU Distributed File Systems.
File Systems cs550 Operating Systems David Monismith.
Lecture 24 Sun’s Network File System. PA3 In clkinit.c.
Manish Kumar,MSRITSoftware Architecture1 Remote procedure call Client/server architecture.
Distributed File Systems Group A5 Amit Sharma Dhaval Sanghvi Ali Abbas.
Review CS File Systems - Partitions What is a hard disk partition?
Distributed File Systems Questions answered in this lecture: Why are distributed file systems useful? What is difficult about distributed file systems?
Chapter Five Distributed file systems. 2 Contents Distributed file system design Distributed file system implementation Trends in distributed file systems.
1 Section 9: Project 3 – The Buffer Cache Network File Systems.
CSE 486/586 Distributed Systems Distributed File Systems
Lecture 22 Sun’s Network File System
Distributed File Systems
Andrew File System (AFS)
Lecture 25: Distributed File Systems
NFS and AFS Adapted from slides by Ed Lazowska, Hank Levy, Andrea and Remzi Arpaci-Dussea, Michael Swift.
Distributed File Systems
Slides for Chapter 8: Distributed File Systems
Distributed File Systems
Today: Coda, xFS Case Study: Coda File System
Directory Structure A collection of nodes containing information about all files Directory Files F 1 F 2 F 3 F 4 F n Both the directory structure and the.
Distributed File Systems
CSE 451: Operating Systems Winter Module 22 Distributed File Systems
CSE 451: Operating Systems Autumn Module 22 Distributed File Systems
Distributed File Systems
Distributed File Systems
Outline Announcements Lab2 Distributed File Systems 1/17/2019 COP5611.
CSE 451: Operating Systems Spring Module 21 Distributed File Systems
DESIGN AND IMPLEMENTATION OF THE SUN NETWORK FILESYSTEM
Distributed File Systems
Lecture 25: Distributed File Systems
Distributed file system
Distributed File Systems
CSE 451: Operating Systems Winter Module 22 Distributed File Systems
CSE 451: Operating Systems Distributed File Systems
Chapter 15: File System Internals
Today: Distributed File Systems
CSE 486/586 Distributed Systems Distributed File Systems
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Outline Review of Quiz #1 Distributed File Systems 4/20/2019 COP5611.
THE GOOGLE FILE SYSTEM.
Distributed File Systems
CSE 451: Operating Systems Autumn Module 22 Distributed File Systems
Distributed File Systems
CSE 486/586 Distributed Systems Distributed File Systems
Lecture 4: File-System Interface
Distributed File Systems
Network File System (NFS)
Introduction to Operating Systems
Presentation transcript:

Lecture 25: Distributed File Systems CS 425 / ECE 428 Distributed Systems Fall 2016 Indranil Gupta (Indy) Nov 15, 2016 Lecture 25: Distributed File Systems All slides © IG

File System Contains files and directories (folders) Higher level of abstraction Prevents users and processes from dealing with disk blocks and memory blocks 2

File Contents Typical File Header Block 0 Block 1 … Block N-1 File contents are in here Timestamps: creation, read, write, header File type, e.g., .c, .java Ownership, e.g., edison Access Control List: who can access this file and in what mode Reference Count: Number of directories containing this file May be > 1 (hard linking of files) When 0, can delete file 3

What about Directories? They’re just files! With their “data” containing The meta-information about files the directory contains Pointers (on disk) to those files 4

Unix File System: Opening and Closing Files Uses notion of file descriptors Handle for a process to access a file Each process: Needs to open a file before reading/writing file OS creates an internal datastructure for a file descriptor, returns handle filedes=open(name, mode) mode = access mode, e.g., r, w, x filedes=creat(name, mode) Create the file, return the file descriptor close(filedes) 5

Unix File System: Reading and Writing error=read(filedes, buffer, num_bytes) File descriptor maintains a read-write pointer pointing to an offset within file read() reads num_bytes starting from that pointer (into buffer), and automatically advances pointer by num_bytes error returns the number of bytes read/written, or 0 if EOF, or -1 if error (errno is set) error=write(filedes, buffer, num_bytes) Writes from buffer into file at position pointer Automatically advances pointer by num_bytes pos=lseek(filedes, offset, whence) Moves read-write pointer to position offset within file whence says whether offset absolute or relative (relative to current pointer) 6

Unix File System: Control Operations status=link(old_link, new_link) Creates a new link at second arg to the file at first arg Old_link and new_link are Unix-style names, e.g., “/usr/edison/my_invention” Increments reference count of file Known as a “hard link” Vs. “Symbolic/Soft linking” which creates another file pointing to this file; does not change reference count status=unlink(old_link) Decrements reference count If count=0, can delete file status=stat/fstat(file_name, buffer) Get attributes (header) of file into buffer 7

Distributed File Systems (DFS) Files are stored on a server machine client machine does RPCs to server to perform operations on file Desirable Properties from a DFS Transparency: client accesses DFS files as if it were accessing local (say, Unix) files Same API as local files, i.e., client code doesn’t change Need to make location, replication, etc. invisible to client Support concurrent clients Multiple client processes reading/writing the file concurrently Replication: for fault-tolerance 8

Concurrent Accesses in DFS One-copy update semantics: when file is replicated, its contents, as visible to clients, are no different from when the file has exactly 1 replica At most once operation vs. At least once operation Choose carefully At most once, e.g., append operations cannot be repeated Idempotent operations have no side effects when repeated: they can use at least once semantics, e.g., read at absolute position in file 9

Security in DFS Authentication Authorization Verify that a given user is who they claim to be Authorization After a user is authenticated, verify that the file they’re trying to access is in fact allowed for that user Two popular flavors Access Control Lists (ACLs) = per file, list of allowed users and access allowed to each Capability Lists = per user, list of files allowed to access and type of access allowed Could split it up into capabilities, each for a different (user,file) 10

Let’s Build a DFS! We’ll call it our “Vanilla DFS” Vanilla DFS runs on a server, and at multiple clients Vanilla DFS consists of three types of processes Flat file service: at server Directory service: at server, talks to (i.e., “client of”) Flat file service Client service: at client, talks to Directory service and Flat file service 11

Vanilla DFS: Flat File Service API Read(file_id, buffer, position, num_bytes) Reads num_bytes from absolute position in file file_id into buffer File_id is not a file descriptor, it’s a unique id of that file No automatic read-write pointer! Why not? Need operation to be idempotent (at least once semantics) No file descriptors! Why not? Need servers to be stateless: easier to recover after failures (no state to restore!) In contrast, Unix file system operations are neither idempotent nor stateless 12

Vanilla DFS: Flat File Service API (2) write(file_id, buffer, position, num_bytes) Similar to read create/delete(file_id) get_attributes/set_attributes(file_id, buffer) 13

Vanilla DFS: Directory Service API file_id = lookup(dir, file_name) file_id can then be used to access file via Flat file service add_name(dir, file_name, buffer) Increments reference count un_name(dir, file_name) Decrements reference count; if =0, can delete list=get_names(dir, pattern) Like ls –al or dir, followed by grep or find 14

Can we Build a Real DFS Already? Next: Two popular distributed file systems NFS and AFS 15

NFS Network File System Sun Microsystems, 1980s Used widely even today 16

NFS Architecture Client Server Process Virtual File System Unix Client system Local Disk Client Server system Server 17

NFS Client and Server Systems NFS Client system Similar to our “Client service” in our Vanilla DFS Integrated with kernel (OS) Performs RPCs to NFS Server system for DFS operations NFS Server system Plays the role of both Flat file service + Directory service from our Vanilla DFS Allows mounting of files and directories Mount /usr/tesla/inventions into /usr/edison/my_competitors => Now, /usr/edison/my_competitors/foo refers to /usr/tesla/inventions/foo Mount: Doesn’t clone (copy) files, just point to that directory now 18

Virtual File System Module Allows processes to access files via file descriptors Just like local Unix files! So, local and remote files are indistinguishable (i.e., gives transparency) For a given file access, decides whether to route to local file system or to NFS client system Names all files (local or remote) uniquely using “NFS file handles” Keeps a data structure for each mounted file system Keeps a data structure called v-node for all open files If local file, v-node points to local disk block (called i-node) If remote, v-node contains address of remote NFS server 19

Server Optimizations Server caching is one of the big reasons NFS is so fast with reads Server Caching = Store, in memory, some of the recently-accessed blocks (of files and directories) Most programs (written by humans) tend to have locality of access Blocks accessed recently will be accessed soon in the future Writes: two flavors Delayed write: write in memory, flush to disk every 30 s (e.g., via Unix sync operation) Fast but not consistent Write-through: Write to disk immediately before ack-ing client Consistent but may be slow 20

Client Caching Client also caches recently-accessed blocks Each block in cache is tagged with Tc: the time when the cache entry was last validated. Tm: the time when the block was last modified at the server. A cache entry at time T is valid if (T-Tc < t) or (Tm client = Tm server). t=freshness interval Compromise between consistency and efficiency Sun Solaris: t is set adaptively between 3-30 s for files, 30-60 s for directories When block is written, do a delayed-write to server 21

Andrew File System (AFS) Designed at CMU Named after Andrew Carnegie and Andrew Mellon, the “C” and “M” in CMU In use today in some clusters (especially University clusters) 22

Interesting Design Decisions in AFS Two unusual design principles: Whole file serving Not in blocks Whole file caching Permanent cache, survives reboots Based on (validated) assumptions that Most file accesses are by a single user Most files are small Even a client cache as “large” as 100MB is supportable (e.g., in RAM) File reads are much more often that file writes, and typically sequential 23

AFS Details Clients system = Venus service Server system = Vice service Reads and writes are optimistic Done on local copy of file at client (Venus) When file closed, writes propagated to Vice When a client (Venus) opens a file, Vice: Sends it entire file Gives client a callback promise Callback promise Promise that if another client modifies then closes the file, a callback will be sent from Vice to Venus Callback state at Venus only binary: valid or canceled 24

Summary Distributed File systems Vanilla DFS NFS AFS Widely used today Vanilla DFS NFS AFS Many other distributed file systems out there today! 25

Announcements