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.

Slides:



Advertisements
Similar presentations
More on File Management
Advertisements

Chapter 4 : File Systems What is a file system?
File Systems.
File Systems Examples.
COS 318: Operating Systems File Layout and Directories
Ext2/Ext3 Linux File System Reporter: Po-Liang, Wu.
Jonathan Walpole Computer Science Portland State University
A Fast File System for UNIX McKusick, Joy, Leffler, and Fabry ACM Transactions on Computer Systems, 2:3, August 1984, pp Describes changes from.
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
File System Implementation: beyond the user’s view A possible file system layout on a disk.
Operating Systems File Systems (in a Day) Ch
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Ceng Operating Systems
Chapter 12: File System Implementation
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts Amherst Operating Systems CMPSCI 377 Lecture.
File Systems. Main Points File layout Directory layout.
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
File Systems We need a mechanism that provides long- term information storage with following characteristics: 1.Possible to store large amount of INFO.
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
File Implementation. File System Abstraction How to Organize Files on Disk Goals: –Maximize sequential performance –Easy random access to file –Easy.
1Fall 2008, Chapter 11 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
IT 344: Operating Systems Winter 2008 Module 16 Journaling File Systems Chia-Chi Teng CTB 265.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
Log-structured File System Sriram Govindan
1 File Systems: Consistency Issues. 2 File Systems: Consistency Issues File systems maintains many data structures  Free list/bit vector  Directories.
CS 153 Design of Operating Systems Spring 2015 Lecture 22: File system optimizations.
File System Implementation
CS 153 Design of Operating Systems Spring 2015 Lecture 21: File Systems.
A FAST FILE SYSTEM FOR UNIX Marshall K. Mckusick William N. Joy Samuel J. Leffler Robert S. Fabry CSRG, UC Berkeley.
Advanced file systems: LFS and Soft Updates Ken Birman (based on slides by Ben Atkin)
Fast File System 2/17/2006. Introduction Paper talked about changes to old BSD 4.2 File System (FS) Motivation - Applications require greater throughput.
Lecture 19 FFS. File-System Case Studies Local VSFS: Very Simple File System FFS: Fast File System LFS: Log-Structured File System Network NFS: Network.
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.
IT 344: Operating Systems Winter 2008 Module 15 BSD UNIX Fast File System Chia-Chi Teng CTB 265.
CS 3204 Operating Systems Godmar Back Lecture 21.
File Systems Topics Design criteria History of file systems Berkeley Fast File System Effect of file systems on programs fs.ppt CS 105 “Tour of the Black.
Lecture 19 Linux/Unix – File System
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]
A Fast File System for UNIX By Marshall Kirk McKusick, William N. Joy, Samuel J. Leffler, Robert S.Fabry Presented by Ya-Yun Lo EECS 582 – W16.
Lecture 20 FSCK & Journaling. FFS Review A few contributions: hybrid block size groups smart allocation.
CS533 - Concepts of Operating Systems 1 A Fast File System for UNIX Marshall Kirk McKusick, William N. Joy, Samuel J. Leffler and Robert S. Fabry University.
Lecture Topics: 12/1 File System Implementation –Space allocation –Free Space –Directory implementation –Caching Disk Scheduling File System/Disk Interaction.
File Systems Topics Design criteria History of file systems Berkeley Fast File System Effect of file systems on programs CS 105 “Tour of the Black Holes.
A Fast File System for UNIX By Marshall Kirk McKusick, William N. Joy, Samuel J. Leffler, Robert S. Fabry Presented by Agnimitra Roy.
File System Performance CSE451 Andrew Whitaker. Ways to Improve Performance Access the disk less  Caching! Be smarter about accessing the disk  Turn.
Lecture Topics: 11/22 HW 7 File systems –block allocation Unix and NT –disk scheduling –file caches –RAID.
W4118 Operating Systems Instructor: Junfeng Yang.
The need for File Systems Need to store data and programs in files Must be able to store lots of data Must be nonvolatile and survive crashes and power.
CHAPTER 4-3 FILE SYSTEM CONSISTENCY AND EFFICIENCY.
File System Examples Unix Fast File System (FFS)
EXT in Detail High-Performance Database Research Center
FFS: The Fast File System
Jonathan Walpole Computer Science Portland State University
Journaling File Systems
Filesystems 2 Adapted from slides of Hank Levy
Lecture 20 LFS.
Introduction to Operating Systems
Printed on Monday, December 31, 2018 at 2:03 PM.
Overview: File system implementation (cont)
File System Implementation
CSE 60641: Operating Systems
CSE 451 Fall 2003 Section 11/20/2003.
SE350: Operating Systems Lecture 12: File Systems.
File System Performance
CS 105 “Tour of the Black Holes of Computing”
Chapter 5 File Systems -Compiled for MCA, PU
Presentation transcript:

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 File System

Policy: Choose Inode, Data Blocks Layout 3, 8, 31, 14, 22 3, 8, 9, 10, 11 7, 8, 9, 10, 11 SidIIIIIDDDDDDDD DDDDDDDDDDDDDDDD

System Building Approach Identify state of the art Measure it, identify problems Get idea Build it!

Layout for the Original UNIX FS Only super block, inode blocks, and data blocks Free lists are embedded in inodes, data blocks Data blocks are 512 bytes SID

Old FS State of the art: original UNIX file system. Measure throughput for file reads/writes. Compare to theoretical max, which is… disk bandwidth Old UNIX file system: only 2% of potential. Why?

Old FS Observations: long distance between inodes/data inodes in single dir not close to one another small blocks (512 bytes) blocks laid out poorly free list becomes scrambled, causes random alloc

Problem: old FS treats disk like RAM! Solution: a disk-aware FS

Technique 1: Bitmaps Use bitmaps instead of free list. Provides more flexibility, with more global view. SID SBDI

Technique 2: Groups How would the distance between inode block and data block affect performance? strategy: allocate inodes and data blocks in same group. SBDI SBDISBDISBDI

Groups In FFS, groups were ranges of cylinders called cylinder group In ext2-4, groups are ranges of blocks called block group

Technique 3: Super Rotation Is it useful to have multiple super blocks? Yes, if some (but not all) fail. Problem: All super-block copies are on the top platter. What if it dies? For each group, store super-block at different offset. SBDISBDISBDI

Technique 4: Large blocks Doubling the block size for the old FS over doubled performance. Strategy: choose block size so we never have to read more than two indirect blocks to find a data block (2 levels of indirection max). Want 4GB files. How large is this? Why not make blocks huge?

Solution: Fragments Hybrid! Introduce “fragment” for files that use parts of blocks. Only tail of file uses fragments Block size = 4096 Fragment size = 1024 bits: blk1 blk2 blk3 blk4

How to Decide Whether addr refers to block or fragment is inferred by the file size. What about when files grow?

Optimal Write Size Writing less than a block is inefficient. Solution: new API exposes optimal write size. For pipes and sockets, the new call returns the buffer size. The stdio library uses this call.

Smart Policy Where should new inodes and data blocks go? Put related pieces of data near each other. Rules: Put directory entries near directory inodes. Put inodes near directory entries. Put data blocks near inodes. SBDISBDISBDI

Challenge The file system is one big tree. All directories and files have a common root. In some sense, all data in the same FS is related. Trying to put everything near everything else will leave us with the same mess we started with.

Revised Strategy Put more-related pieces of data near each other. Put less-related pieces of data far from each other. FFS developers used their best judgement.

Preferences File inodes: allocate in same group with dir Dir inodes: allocate in new group with fewer inodes than the average group First data block: allocate near inode Other data blocks: allocate near previous block

Problem: Large Files A single large file can use nearly all of a group. This displaces data for many small files. It’s better to do one seek for the large file than one seek for each of many small files. Define “large” as requiring an indirect. Starting at indirect (e.g., after 48 KB), put blocks in a new block group.

Preferences File inodes: allocate in same group with dir Dir inodes: allocate in new group with fewer inodes than the average group First data block: allocate near inode Other data blocks: allocate near previous block Large file data blocks: after 48KB, go to new group. Move to another group (w/ fewer than avg blocks) every subsequent 1MB.

Several New Features: long file names atomic rename symbolic links you can’t create hard link to a directory you can’t hard link to files in other disk partitions actually a file itself, which holds the pathname of the linked-to file as the data dangling reference is possible

FFS First disk-aware file system. FFS inspired modern files systems, including ext2 and ext3. FFS also introduced several new features: long file names atomic rename symbolic links All hardware is unique: treat disk like disk!

Redundancy? Definition: if A and B are two pieces of data, and knowing A eliminates some or all the values B could B, there is redundancy between A and B. Superblock: field contains total blocks in FS. Inode: field contains pointer to data block. Is there redundancy between these fields? Why? Yes. If total block number is N, pointers to block N or after are invalid.

More Redundancy in FFS Dir entries AND inode table. Dir entries AND inode link count. Data bitmap AND inode pointers. Inode file size AND inode/indirect pointers.

Redundancy Uses Redundancy may improve: Performance Reliability Redundancy hurts: Capacity Redundancy implies: Certain combinations of values are illegal. Inconsistencies

Consistency Challenge We may need to do several disk writes to redundant blocks. We don’t want to be interrupted between writes. Things that interrupt us: power loss kernel panic, reboot user hard reset

Partial Update Suppose we are appending to a file, and must update the following: data block, inode, and data bitmap What if crash after only updating some of these? data: nothing bad inode: point to garbage, somebody else may use bitmap: lost block, space leak bitmap and inode: point to garbage bitmap and data: lost block data and inode: somebody else may use

fsck FSCK = file system checker. Strategy: after a crash, scan whole disk for contradictions. For example, is a bitmap block correct? Read every valid inode+indirect. If an inode points to a block, the corresponding bit should be 1

fsck Other checks: Do superblocks match? Do number of dir entries equal inode link counts? Do different inodes ever point to same block? Do directories contain “.” and “..”? … How to solve problems?

Exmaples Dir Entry -> inode link_count = 1 <- Dir Entry make the link_count 2 inode link_count = 1 link it under lost+found/ Data and inode are written, but not bitmap change bitmap Two inodes point to the same block duplicate the block inode points to a block N or more remove the link

fsck It’s not always obvious how to patch the file system back together. We don’t know the “correct” state, just a consistent one. Easy way to get consistency: reformat disk!

fsck is slow Journaling and LFS next time