Directory. File. Chunk. Disk

Similar documents
Fuse Extension. version Erick Gallesio Université de Nice - Sophia Antipolis 930 route des Colles, BP 145 F Sophia Antipolis, Cedex France

COS 318: Operating Systems. NSF, Snapshot, Dedup and Review

1 / 23. CS 137: File Systems. General Filesystem Design

Long-term Information Storage Must store large amounts of data Information stored must survive the termination of the process using it Multiple proces

File Systems: Naming

1 / 22. CS 135: File Systems. General Filesystem Design

COS 318: Operating Systems. Journaling, NFS and WAFL

The UNIX File System

Inode. Local filesystems. The operations defined for local filesystems are divided in two parts:

Virtual File System. Don Porter CSE 306

Chapter 8: Filesystem Implementation

Logical disks. Bach 2.2.1

DNE2 High Level Design

The UNIX File System

File System Consistency. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

The Google File System

Chapter 12: File System Implementation

Files and File Systems

File System Consistency

Fusepy Documentation. Release Giorgos Verigakis

File System: Interface and Implmentation

CS4500/5500 Operating Systems File Systems and Implementations

What is a file system

The UNIX Time- Sharing System

DISTRIBUTED FILE SYSTEMS & NFS

Files and the Filesystems. Linux Files

OPERATING SYSTEMS CS136

File Systems. What do we need to know?

Distributed File Systems

Chapter 6: File Systems

Operating Systems. File Systems. Thomas Ropars.

Chapter 11: File System Implementation. Objectives

Virtual File System. Don Porter CSE 506

CS370 Operating Systems

Thanks for the feedback! Chapter 8: Filesystem Implementation. File system operations. Acyclic-Graph Directories. General Graph Directory

Chapter 11: Implementing File Systems. Operating System Concepts 8 th Edition,

Tricky issues in file systems

(In columns, of course.)

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Implementation should be efficient. Provide an abstraction to the user. Abstraction should be useful. Ownership and permissions.

File Systems Ch 4. 1 CS 422 T W Bennet Mississippi College

Operating System Labs. Yuanbin Wu

JFS Log. Steve Best IBM Linux Technology Center. Recoverable File Systems. Abstract. Introduction. Logging

FILE SYSTEM IMPLEMENTATION. Sunu Wibirama

File Systems. CS170 Fall 2018

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

W4118 Operating Systems. Instructor: Junfeng Yang

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

File Systems. Todays Plan. Vera Goebel Thomas Plagemann. Department of Informatics University of Oslo

CLOUD-SCALE FILE SYSTEMS

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

ECE 650 Systems Programming & Engineering. Spring 2018

File System Implementation. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

UNIX File System. UNIX File System. The UNIX file system has a hierarchical tree structure with the top in root.

Universidad Carlos III de Madrid Computer Science and Engineering Department Operating Systems Course

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

File Systems 1. File Systems

File Systems 1. File Systems

Input & Output 1: File systems

Network File System (NFS)

Network File System (NFS)

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

SMD149 - Operating Systems - File systems

CS 318 Principles of Operating Systems

File System Implementation

ADVANCED OPERATING SYSTEMS

CS 4284 Systems Capstone

Chapter 11: File System Implementation

Topics. File Buffer Cache for Performance. What to Cache? COS 318: Operating Systems. File Performance and Reliability

CS-537: Final Exam (Fall 2013) The Worst Case

File System Implementation. Sunu Wibirama

Files and File Systems

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission

File System Implementation

CS3600 SYSTEMS AND NETWORKS

Chapter 12: File System Implementation

File Systems. Kartik Gopalan. Chapter 4 From Tanenbaum s Modern Operating System

Linux Filesystems Ext2, Ext3. Nafisa Kazi

File Systems: Allocation Issues, Naming, and Performance CS 111. Operating Systems Peter Reiher

ZFS: NEW FEATURES IN REPLICATION

Computer Systems Laboratory Sungkyunkwan University

Chapter 11: Implementing File Systems

CS 537 Fall 2017 Review Session

Introduction to File Systems

ENGR 3950U / CSCI 3020U (Operating Systems) Simulated UNIX File System Project Instructor: Dr. Kamran Sartipi

Google Disk Farm. Early days

The Berkeley File System. The Original File System. Background. Why is the bandwidth low?

CSE380 - Operating Systems

INTERNAL REPRESENTATION OF FILES:

Operating systems. Lecture 7 File Systems. Narcis ILISEI, oct 2014

File Systems. ECE 650 Systems Programming & Engineering Duke University, Spring 2018

Chapter 11: Implementing File

Final Examination CS 111, Fall 2016 UCLA. Name:

Chapter 4 File Systems. Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

ABSTRACT 2. BACKGROUND

Chapter 11: Implementing File Systems. Operating System Concepts 9 9h Edition

Name: Instructions. Problem 1 : Short answer. [48 points] CMU / Storage Systems 23 Feb 2011 Spring 2012 Exam 1

TDDB68 Concurrent Programming and Operating Systems. Lecture: File systems

Transcription:

SIFS Phase 1 Due: October 14, 2007 at midnight Phase 2 Due: December 5, 2007 at midnight 1. Overview This semester you will implement a single-instance file system (SIFS) that stores only one copy of data, even if the data appear in multiple files. This is a hot topic in the data storage industry, as storing only a single copy of data reduces the amount of storage media required, which in turn reduces power, space, and most importantly, IT costs. IBM refers to this problem as data de-duplication. You will implement SIFS using FUSE (Linux's user-level filesystem functionality) so that unmodified applications can make use of SIFS. This project will be done in two phases and in groups of up to three. 2. Architecture You will implement your SIFS as a process that reads and writes the disk in response to requests made by FUSE, which in turn are caused by file accesses by application programs. I will provide you with a Disk module that reads and writes a virtual disk stored in a regular Unix file. You must use FUSE and you must use Disk, what you do between these two is up to you, although you must justify the design in your design document. I would suggest the following hierarchical architecture but you are welcome to develop your own. I've sketched out the basic APIs for the layers but not provided all the details. FS Directory File Chunk Disk 09/11/07 1

2.1 Disk You will be provided with the Disk layer; do not make any changes. The Disk API is defined in disk.h, which is also provided and you should not change. The basic API is: Disk_Read(disk, offset, length, buffer) Disk_Write(disk, offset, length, buffer) 2.2 Chunk The Chunk layer is responsible for storing variable-size chunks of data identified by a unique 160-bit chunk ID (CID). The CID for a chunk is the SHA-1 hash of the chunk's contents you may assume that collisions do not happen, allowing each chunk to be uniquely identified by its CID. The one exception is CID '0', whose contents need not have a SHA-1 of '0'. This well-known CID gives the File layer a starting point for accessing chunks. The Chunk layer allows the higher-levels to read and write chunks. To do this it must manage the disk space, keeping track of which space is free and allocating space for new chunks, as well as keeping track of where on disk chunks are stored. One of the challenges is designing a data structure for mapping CIDs to disk addresses that is compact and doesn't require too many disk access. The Chunk layer must also maintain a reference count on individual chunks. When a chunk is written that already exists its reference count is simply incremented. Deleting a chunk decrements its reference count; when the reference count reaches zero the chunk is deleted from disk. The Chunk layer also contains a cache of recently-used chunks to reduce disk accesses. The basic Chunk API is: Chunk_Read(CID, length, buffer) Chunk_Write(CID, length, buffer) Chunk_Delete(CID) 2.3 File The File layer implements the file abstraction. The File layer stores everything in chunks and does not access the Disk layer directly. Conceptually, a file consists of a sequence of chunks, the boundaries of which are determined using Rabin fingerprinting. This sequence is stored in an inode; again, one of the challenges is storing the sequence efficiently considering it changes when the file is modified. The inode also contains other metadata about the file such as the number of links to it, its size, etc. Files are uniquely identified by a file ID (FID). The basic File API is: File_Read(FID, offset, length, buffer) File_Write(FID, offset, length, buffer) FID = File_Create() File_Delete(FID) 09/11/07 2

2.4 Directory A directory is a special type of file that maps names to FIDs. It therefore accesses only the File layer and not the Chunk nor Disk layers. The basic API is: Dir_Create(FID, name, target_fid) FID = Dir_Lookup(FID, name) 2.5 FS The FS ( filesystem ) layer implements the rest of the functionality that spans directories and files. For example, renaming a file involves the file and two directories (the old parent and the new parent). Also, the FUSE API passes in pathnames for files and directories, so the FS layer should probably have a library routine that repeatedly calls Dir_Lookup to resolve the name into the proper FID (creating it if necessary). The FS layer consists of FUSE stubs plus library routines and doesn't have a proper API as such. The FS layer accesses the Directory and File layers, but not anything below them. 3. FUSE Your SIFS consists of a user-level process that makes use of FUSE to service filesystem operations made by unmodified application programs. Your SIFS process need not be multi-threaded. You must implement at least the following FUSE routines: getattr readlink mkdir unlink rmdir open read write statfs release opendir readdir releasedir init destroy create Your SIFS process has the following command-line syntax: sifs [options] file mountpoint Where the options consist of: -c num, --cache=num Size of the cache in the Chunk layer, in chunks. 09/11/07 3

The file argument specifies the name of the virtual disk file, and mountpoint specifies where the sifs filesystem should be mounted. Sifs must pass the '-f' argument to fuse_main so that the process runs in the foreground instead of detaching and running in the background. 4. mksifs You must write a command to create and format a disk for SIFS. It should zero-out the disk, then initialize all your on-disk data structures so that that your SIFS process can access it properly. The initial filesystem should be empty, consisting of only the root directory and the '.' and '..' entries. The mksifs command has the following syntax: mksifs [options] file Where options consist of: -i num, --inodes=num Maximum number of inodes in the filesystem. The default is 1000. -m size, --min-chunk=size Minimum chunk size, in bytes. The default is 4KB. -M size, --max-chunk=size Maximum chunk size, in bytes. The default is 16KB. -s sectors, --sectors=sectors Size of the disk, in sectors. The default is 1000. The mksifs command should exit with a return status of '0' if there are no errors, '1' otherwise. 5. sifsck You must write a command that verifies the integrity of a SIFS disk and prints out any errors it finds. The things it should check include verifying the chunk database (e.g. All chunks on disk have the proper CID, all chunks have the proper reference count, and all free space on the disk is accounted for properly), verifying files( e.g. All chunks of all files exist on disk and have the proper reference count, file sizes are accurate), and verifying directories (e.g. All files have at least one link, link counts are accurate). The sifsck program need not repair the disk, but should be pedantic about checking the integrity of the disk. Keep in mind that your SIFS process is likely to die in mysterious ways if the disk is corrupted it is much better to put the effort into writing sifsck than debugging SIFS. The syntax is: sifsck file The sifsck command should exit with a return status of '0' if there are no errors, '1' otherwise. 09/11/07 4

6. Testing I will provide test cases, but any program should be able to access your filesystem. 7. Phase 1 For this phase you should have the following implemented for each of the layers: Chunk File Directory FS Able to read and write chunks, perhaps using an inefficient data structure such as scanning the disk. Chunk reference counts and deletion not implemented. Able to read and write files. Inode data structure perhaps inefficient. Overwrite and truncation not implemented. Multiple links not necessary. Support a flat namespace in which files are named /123 where 123 is the inode number. Whatever is necessary to implement the above functionality. 8. Extra Credit With my permission you may implement the following for extra credit. In general you should complete the rest of the assignment before doing any extra credit. Crash Recovery. Recovery from a crash during SIFS operation. This means checking and fixing the on-disk data structures before resuming. Multi-threading. Multi-thread the SIFS process so that it can concurrently handle requests. Chunk Logging. Treat the disk as a log into which chunks are stored. Similar to the log-structured filesystem except this is a log-structured chunk store. Additional FUSE routines. Implement more of the FUSE routines such as symbolic links, file locks, mmap, etc. 9. Logistics This project will be done in teams of no more than three. Since working in groups means that there is a danger of one person not carrying his or her load, I'm likely to quiz each group member orally on any part of the system during the final demos. Each group member must be familiar with the overall design and structure of their group's project. Turn in your phases using the names 552sifs_1 and 552sifs_2. You must include a design document (PDF preferred) for both phases. Be sure to include what does and doesn't 09/11/07 5

work, as well as any cool features you implemented. You will demo the project to me at the end of the semester. Your assignment will be graded on lectura, so verify that it works there before you turn it in (try this out early -- there are always last-minute glitches). 09/11/07 6

09/11/07 7