File Systems Operating Systems 1 Computer Science Dept Va Tech August 2007 ©2007 Back File Systems & Fault Tolerance Failure Model – Define acceptable.

Slides:



Advertisements
Similar presentations
4/8/14CS161 Spring FFS Recovery: Soft Updates Learning Objectives Explain how to enforce write-ordering without synchronous writes. Identify and.
Advertisements

4/8/14CS161 Spring Journaling File Systems Learning Objectives Explain log journaling/logging can make a file system recoverable. Discuss tradeoffs.
More on File Management
Lectures on File Management
Concepts about the file system 2. The disk structure 3. Files in disk – The ext2 FS 4. The Virtual File System (c) 2013, Prof. Jordi Garcia.
Garbage Collecting the World Bernard Lang Christian Queinnec Jose Piquer Presented by Yu-Jin Chia See also: pp text.
CSCI 3140 Module 8 – Database Recovery Theodore Chiasson Dalhousie University.
File Systems Examples.
Ext2/Ext3 Linux File System Reporter: Po-Liang, Wu.
Lecture 18 ffs and fsck. File-System Case Studies Local FFS: Fast File System LFS: Log-Structured File System Network NFS: Network File System AFS: Andrew.
The design and implementation of a log-structured file system The design and implementation of a log-structured file system M. Rosenblum and J.K. Ousterhout.
Crash recovery All-or-nothing atomicity & logging.
CS510 Advanced OS Seminar Class 10 A Methodology for Implementing Highly Concurrent Data Objects by Maurice Herlihy.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Crash recovery All-or-nothing atomicity & logging.
Lecture 17 FS APIs and vsfs. File and File Name What is a File? Array of bytes. Ranges of bytes can be read/written. File system consists of many files,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
File System Reliability. Main Points Problem posed by machine/disk failures Transaction concept Reliability – Careful sequencing of file system operations.
The Design and Implementation of a Log-Structured File System Presented by Carl Yao.
File System. NET+OS 6 File System Architecture Design Goals File System Layer Design Storage Services Layer Design RAM Services Layer Design Flash Services.
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
File Implementation. File System Abstraction How to Organize Files on Disk Goals: –Maximize sequential performance –Easy random access to file –Easy.
IT 344: Operating Systems Winter 2008 Module 16 Journaling File Systems Chia-Chi Teng CTB 265.
CS 3204 Operating Systems Godmar Back Lecture 26.
CS 4284 Systems Capstone Godmar Back Disks & File Systems.
Log-structured File System Sriram Govindan
26-Oct-15CSE 542: Operating Systems1 File system trace papers The Design and Implementation of a Log- Structured File System. M. Rosenblum, and J.K. Ousterhout.
1 File Systems: Consistency Issues. 2 File Systems: Consistency Issues File systems maintains many data structures  Free list/bit vector  Directories.
Reliability and Recovery CS Introduction to Operating Systems.
1 Shared Files Sharing files among team members A shared file appearing simultaneously in different directories Share file by link File system becomes.
Log-Structured File Systems
CS 153 Design of Operating Systems Spring 2015 Lecture 22: File system optimizations.
CSE 451: Operating Systems Spring 2012 Journaling File Systems Mark Zbikowski Gary Kimura.
Advanced file systems: LFS and Soft Updates Ken Birman (based on slides by Ben Atkin)
Project 6 Unix File System. Administrative No Design Review – A design document instead 2-3 pages max No collaboration with peers – Piazza is for clarifications.
1 Week 13 FAT32 Utility Operations Guide: rm and rmdir Classes COP4610 / CGS5765 Florida State University.
CS333 Intro to Operating Systems Jonathan Walpole.
Lecture 21 LFS. VSFS FFS fsck journaling SBDISBDISBDI Group 1Group 2Group N…Journal.
UNIX File System (UFS) Chapter Five.
Outline for Today Journaling vs. Soft Updates Administrative.
I MPLEMENTING FILES. Contiguous Allocation:  The simplest allocation scheme is to store each file as a contiguous run of disk blocks (a 50-KB file would.
CS 3204 Operating Systems Godmar Back Lecture 21.
File Systems 2. 2 File 1 File 2 Disk Blocks File-Allocation Table (FAT)
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
Transactions and Reliability Andy Wang Operating Systems COP 4610 / CGS 5765.
Lecture 20 FSCK & Journaling. FFS Review A few contributions: hybrid block size groups smart allocation.
File System Performance CSE451 Andrew Whitaker. Ways to Improve Performance Access the disk less  Caching! Be smarter about accessing the disk  Turn.
CS 3204 Operating Systems Godmar Back Lecture 25.
W4118 Operating Systems Instructor: Junfeng Yang.
Chapter 39 File and Directory Chien-Chung Shen CIS/UD
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
Journaling versus soft updates: asynchronous meta-data protection in file systems Landon Cox April 8, 2016.
File System Consistency
FFS: The Fast File System
Jonathan Walpole Computer Science Portland State University
Transactions and Reliability
CS703 - Advanced Operating Systems
Local file systems Landon Cox March 31, 2017.
CS 5204 Operating Systems Disks & File Systems Godmar Back.
Journaling File Systems
EECE.4810/EECE.5730 Operating Systems
Lecture 20 LFS.
CSE 451: Operating Systems Spring 2011 Journaling File Systems
Printed on Monday, December 31, 2018 at 2:03 PM.
CSE 451 Fall 2003 Section 11/20/2003.
CSE 451: Operating Systems Spring 2008 Module 14
CS703 - Advanced Operating Systems
CS703 - Advanced Operating Systems
CSE 451: Operating Systems Spring 2010 Module 14
Presentation transcript:

File Systems Operating Systems 1 Computer Science Dept Va Tech August 2007 ©2007 Back File Systems & Fault Tolerance Failure Model – Define acceptable failures (disk head hits dust particle, scratches disk – you will lose some data) – Define which failure outcomes are unacceptable Define recovery procedure to deal with unacceptable failures: – Recovery moves from an incorrect state A to correct state B – Must understand possible incorrect states A after crash! – A is like “snapshot of the past” – Anticipating all states A is difficult

File Systems Operating Systems 2 Computer Science Dept Va Tech August 2007 ©2007 Back Methods to Recover from Failure On failure, retry entire computation – Not a good model for persistent file systems Use atomic changes – Problem: how to construct larger atomic changes from the small atomic units available (i.e., single sector writes) Use reconstruction – Ensure that changes are so ordered that if crash occurs after every step, a recovery program can either undo change or complete it – proactive to avoid unacceptable failures – reactive to fix up state after acceptable failures

File Systems Operating Systems 3 Computer Science Dept Va Tech August 2007 ©2007 Back Sensible Invariants In a Unix-style file system, want that: – File & directory names are unique within parent directory – Free list/map accounts for all free objects n all objects on free list are really free – All data blocks belong to exactly one file (only one pointer to them) – Inode’s ref count reflects exact number of directory entries pointing to it – Don’t show old data to applications Q.: How do we deal with possible violations of these invariants after a crash?

File Systems Operating Systems 4 Computer Science Dept Va Tech August 2007 ©2007 Back Crash Recovery (fsck) After crash, fsck runs and performs the equivalent of mark-and-sweep garbage collection Follow, from root directory, directory entries – Count how many entries point to inode, adjust ref count Recover unreferenced inodes: – Scan inode array and check that all inodes marked as used are referenced by dir entry – Move others to /lost+found Recompute free list: – Follow direct blocks+single+double+triple indirect blocks, mark all blocks so reached as used – free list/map is the complement In following discussion, keep in mind what fsck could and could not fix!

File Systems Operating Systems 5 Computer Science Dept Va Tech August 2007 ©2007 Back Example 1: file create On create(“foo”), have to 1. Scan current working dir for entry “foo” (fail if found); else find empty slot in directory for new entry 2. Allocate an inode #in 3. Insert pointer to #in in directory: (#in, “foo”) 4. Write a) inode & b) directory back What happens if crash after 1, 2, 3, or 4a), 4b)? Does order of inode vs directory write back matter? Rule: never write persistent pointer to object that’s not (yet) persistent

File Systems Operating Systems 6 Computer Science Dept Va Tech August 2007 ©2007 Back Example 2: file unlink To unlink(“foo”), must 1. Find entry “foo” in directory 2. Remove entry “foo” in directory 3. Find inode #in corresponding to it, decrement #ref count 4. If #ref count == 0, free all blocks of file 5. Write back inode & directory Q.: what’s the correct order in which to write back inode & directory? Q.: what can happen if free blocks are reused before inode’s written back? Rule: first persistently nullify pointer to any object before freeing it (object=freed blocks & inode)

File Systems Operating Systems 7 Computer Science Dept Va Tech August 2007 ©2007 Back Example 3: file rename To rename(“foo”, “bar”), must 1. Find entry (#in, “foo”) in directory 2. Check that “bar” doesn’t already exist 3. Remove entry (#in, “foo”) 4. Add entry (#in, “bar”) This does not work, because?

File Systems Operating Systems 8 Computer Science Dept Va Tech August 2007 ©2007 Back Example 3a: file rename To rename(“foo”, “bar”), conservatively 1. Find entry (#i, “foo”) in directory 2. Check that “bar” doesn’t already exist 3. Increment ref count of #i 4. Add entry (#i, “bar”) to directory 5. Remove entry (#i, “foo”) from directory 6. Decrement ref count of #i Worst case: have old & new names to refer to file Rule: never nullify pointer before setting a new pointer

File Systems Operating Systems 9 Computer Science Dept Va Tech August 2007 ©2007 Back Example 4: file growth Suppose file_write() is called. – First, find block at offset Case 1: metadata already exists for block (file is not grown) – Simply write data block Case 2: must allocate block, must update metadata (direct block pointer, or indirect block pointer) – Must write changed metadata (inode or index block) & data Both writeback orders can lead to acceptable failures: – File data first, metadata next – may lose some data on crash – Metadata first, file data next – may see previous user’s deleted data after crash (very expensive to avoid – would require writing all data synchronously)

File Systems Operating Systems 10 Computer Science Dept Va Tech August 2007 ©2007 Back FFS’s Consistency Berkeley FFS (Fast File System) formalized rules for file system consistency FFS acceptable failures: – May lose some data on crash – May see someone else’s previously deleted data n Applications must zero data out if they wish to avoid this + fsync – May have to spend time to reconstruct free list – May find unattached inodes  lost+found Unacceptable failures: – After crash, get active access to someone else’s data n Either by pointing at reused inode or reused blocks FFS uses 2 synchronous writes on each metadata operation that creates/destroy inodes or directory entries, e.g., creat(), unlink(), mkdir(), rmdir() – Updates proceed at disk speed rather than CPU/memory speed