File Systems.

Slides:



Advertisements
Similar presentations
Chapter 10: File-System Interface
Advertisements

1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
Chapter 10: File-System Interface
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Chapter 10: File-System Interface
File System Interface CSCI 444/544 Operating Systems Fall 2008.
Long-term Information Storage
Dr. Kalpakis CMSC 421, Operating Systems. Fall File-System Interface.
1 File Management (a). 2 File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection.
04/02/2004CSCI 315 Operating Systems Design1 File System Interface.
Ken Birman. Storing Information We often need to store information Sometimes, the stored form has a life its own Pictures of your friends, videos, songs.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File-System Interface.
04/05/2010CSCI 315 Operating Systems Design1 Virtual Memory Wrap-up; File System Interface.
File Systems. 2 Storing Information Applications can store it in the process address space Why is it a bad idea? –Size is limited to size of virtual address.
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Chapter 10: File-System Interface
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System Objectives To discuss file-system design tradeoffs, including.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
File Concept l Contiguous logical address space l Types: Data: numeric, character, binary Program: source, object (load image) Documents.
Os111 Chapter 11 File-System Interface. os112 Outline File Concept Access Methods Directory Structure File System Mounting File Sharing Protection.
1 Course Outline Processes & Threads CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Networks, Protection and Security.
03/30/2007CSCI 315 Operating Systems Design1 Virtual Memory cont’d.; File System Interface.
File Concept §Contiguous logical address space §Types: l Data: Numeric Character Binary l Program.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
Chapter 10 File System Interface
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 10: File-System Interface.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 10 Operating Systems.
File Implementation. File System Abstraction How to Organize Files on Disk Goals: –Maximize sequential performance –Easy random access to file –Easy.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 10-1: File Systems Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Silberschatz, Galvin and Gagne  Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.
File Systems Long-term Information Storage Store large amounts of information Information must survive the termination of the process using it Multiple.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
File System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing (skip)‏ File Protection.
Page 110/19/2015 CSE 30341: Operating Systems Principles Chapter 10: File-System Interface  Objectives:  To explain the function of file systems  To.
File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation ( of textbook)
CSCI-375 Operating Systems Lecture Note: Many slides and/or pictures in the following are adapted from: slides ©2005 Silberschatz, Galvin, and Gagne Some.
10.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 10: File-System Interface.
Module 4.0: File Systems File is a contiguous logical address space.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 11: File-System Interface File Concept Access Methods Directory Structure.
File Systems Security File Systems Implementation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 18: File-System Interface (Ch 10)
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Silberschatz and Galvin  Operating System Concepts Module 10: File-System Interface File Concept Access :Methods Directory Structure Protection.
Annotated by B. Hirsbrunner File Systems Chapter Files 5.2 Directories 5.3 File System Implementation 5.4 Security 5.5 Protection Mechanism 5.6 Overview.
File Systems. 2 Announements Homework 4 available later tonight –It is a programming assignment, so start early See me after class if still need to pick.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally FILE SYSTEM.
Operating Systems Files, Directory and File Systems Operating Systems Files, Directory and File Systems.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
W4118 Operating Systems Instructor: Junfeng Yang.
SVBIT SUBJECT:- Operating System TOPICS:- File Management
CSE Operating System Principles File Systems.
Lecture : chapter 9 and 10 file system 1. File Concept A file is a collection of related information defined by its creator. Contiguous logical address.
File-System Management
Module 10: File-System Interface
Chapter 11: File-System Interface
Chapter 11: File-System Interface
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.
Chapter 10: File-System Interface
Module 10: File-System Interface
Lecture 4: File-System Interface
Chapter 5 File Systems -Compiled for MCA, PU
Presentation transcript:

File Systems

Announements I still have prelims See me after class to receive your prelim

Storing Information So far… How do we make stored information usable? we have discussed processor, memory, and disk management How do we make stored information usable? Applications can store information in the process address space Why is it a bad idea for permanent storage? Size is limited to size of virtual address space May not be sufficient for airline reservations, banking, etc. The data is lost when the application terminates Even when computer crashes! Multiple process might want to access the same data Imagine a telephone directory part of one process

File Systems 3 criteria for long-term information storage: Solution: Should be able to store very large amount of information Information must survive the processes using it Should provide concurrent access to multiple processes Solution: Store information on disks in units called files Files are persistent, and only owner can explicitly delete it Files are managed by the OS File Systems: How the OS manages files!

File System File System: Layer of OS that transforms block interface of disks (or other block devices) into Files, Directories, etc. File System Components Disk Management: collecting disk blocks into files Naming: Interface to find files by name, not by blocks Protection: Layers to keep data secure Reliability/Durability: Keeping of files durable despite crashes, media failures, attacks, etc User vs. System View of a File User’s view: Durable Data Structures System’s view (system call interface): Collection of Bytes (UNIX) Doesn’t matter to system what kind of data structures you want to store on disk! System’s view (inside OS): Collection of blocks (a block is a logical transfer unit, while a sector is the physical transfer unit) Block size  sector size; in UNIX, block size is 4KB

Translating from User to System View File System What happens if user says: give me bytes 2—12? Fetch block corresponding to those bytes Return just the correct portion of the block What about: write bytes 2—12? Fetch block Modify portion Write out Block Everything inside File System is in whole size blocks For example, getc(), putc()  buffers something like 4096 bytes, even if interface is one byte at a time From now on, file is a collection of blocks

Disk Management Policies Basic entities on a disk: File: user-visible group of blocks arranged sequentially in logical space Directory: user-visible index mapping names to files (next lecture) Access disk as linear array of sectors. Two Options: Identify sectors as vectors [cylinder, surface, sector]. Sort in cylinder-major order. Not used much anymore. Logical Block Addressing (LBA). Every sector has integer address from zero up to max number of sectors. Controller translates from address  physical position First case: OS/BIOS must deal with bad sectors Second case: hardware shields OS from structure of disk Need way to track free disk blocks Link free blocks together  too slow today Use bitmap to represent free space on disk Need way to structure files: File Header (next lecture) Track which blocks belong at which offsets within the logical file structure Optimize placement of files’ disk blocks to match access and usage patterns

File System Patterns How do users access files? What are file sizes? Sequential Access bytes read in order (“give me the next X bytes, then give me next, etc”) Random Access read/write element out of middle of array (“give me bytes i—j”) What are file sizes? Most files are small (for example, .login, .c, .o, .class files, etc) Few files are large (for example, core files, etc.) Large files use up most of the disk space and bandwidth to/from disk May seem contradictory, but a few enormous files are equivalent to an immense # of small files

Goals for Today: User’s perspective of FS Files Naming, structure, types, access, attributes, operations Directories Structure, path and operations Mounting file systems File Protection On Wednesday, Implementing internal file system structures

File Naming Motivation: Files abstract information stored on disk You do not need to remember block, sector, … We have human readable names How does it work? Process creates a file, and gives it a name Other processes can access the file by that name Naming conventions are OS dependent Usually names as long as 255 characters is allowed Digits and special characters are sometimes allowed MS-DOS and Windows are not case sensitive, UNIX family is

File Extensions Name divided into 2 parts, second part is the extension On UNIX, extensions are not enforced by OS However C compiler might insist on its extensions These extensions are very useful for C Windows attaches meaning to extensions Tries to associate applications to file extensions

File Structure Byte Sequence: unstructured, most commonly used Record sequence: r/w in records, used earlier Complex structures, e.g. tree - Data stored in variable length records; location decided by OS

File Access Sequential access Random access read all bytes/records from the beginning cannot jump around, could rewind or forward convenient when medium was magnetic tape Random access bytes/records read in any order essential for database systems 2 possible reads Specify disk block in read move file marker (seek), then read or …

File Attributes File-specific info maintained by the OS Some examples: File size, modification date, creation time, etc. Varies a lot across different OSes Some examples: Name – only information kept in human-readable form Identifier – unique tag (number) identifies file within file system Type – needed for systems that support different types Location – pointer to file location on device Size – current file size Protection – controls who can do reading, writing, executing Time, date, and user identification – data for protection, security, and usage monitoring

File Operations File is an Abstract Data Type Some basic file operations: Create: find space in FS, add directory entry Open: system fetches attributes and disk addresses in memory Write (e.g. write at current position) Read/write pointer can be stored as per-process file pointer Increase the size attribute Read (e.g. read from current position, store in buffer) Seek: move current position somewhere in a file Delete: Remove file from directory entry, mark disk blocks as free Truncate: mark disk blocks as free, but keep entry in directory Reduce the size attribute

FS on disk Could use entire disk space for a FS, but A system could have multiple FSes Want to use some disk space for swap space Disk divided into partitions or minidisks Chunk of storage that holds a FS is a volume Directory structure maintains info of all files in the volume Name, location, size, type, …

Directories Directories/folders keep track of files Is a symbol table that translates file names to directory entries Usually are themselves files How to structure the directory to optimize all of the foll.: Search a file Create a file Delete a file List directory Rename a file Traversing the FS Directory Files F 1 F 2 F 3 F 4 F n

Single-level Directory One directory for all files in the volume Called root directory Used in early PCs, even the first supercomputer CDC 6600 Pros: simplicity, ability to quickly locate files Cons: inconvenient naming (uniqueness, remembering all)

Two-level directory Each user has a separate directory Solves name collision, but what if user has lots of files Files need to be addressed by path names Allow user’s access to other user’s files Need for a search path (for example, locating system files)

Tree-structured Directory Directory is now a tree of arbitrary height Directory contains files and subdirectories A bit in directory entry differentiates files from subdirectories

Path Names To access a file, the user should either: Go to the directory where file resides, or Specify the path where the file is Path names are either absolute or relative Absolute: path of file from the root directory Relative: path from the current working directory Most OSes have two special entries in each directory: “.” for current directory and “..” for parent

Acyclic Graph Directories What about sharing? Share subdirectories or files

Acyclic Graph Directories How to implement shared files and subdirectories: Why not copy the file? Waste of space, inconsistencies, etc. New directory entry, called Link (used in UNIX) Link is a pointer to another file or subdirectory Links are ignored when traversing FS ln in UNIX, fsutil in Windows for hard links ln –s in UNIX, shortcuts in Windows for soft links Issues? Two different names (aliasing) If dict deletes list  dangling pointer Keep backpointers of links for each file Leave the link, and delete only when accessed later Keep reference count of each file

mount(“/dev/fd0”, “/mnt”, 0) File System Mounting Mount allows two FSes to be merged into one For example you insert your floppy into the root FS mount(“/dev/fd0”, “/mnt”, 0)

Remote file system mounting Same idea, but file system is actually on some other machine Implementation uses remote procedure call Package up the user’s file system operation Send it to the remote machine where it gets executed like a local request Send back the answer Very common in modern systems

File Protection File owner/creator should be able to control: what can be done by whom Types of access Read Write Execute Append Delete List

Categories of Users Individual user Groups to which the user belongs Log in establishes a user-id Might be just local on the computer or could be through interaction with a network service Groups to which the user belongs For example, “ken” is in “csfaculty” Again could just be automatic or could involve talking to a service that might assign, say, a temporary cryptographic key

Linux Access Rights Mode of access: read, write, execute Three classes of users RWX a) owner access 7  1 1 1 RWX b) group access 6  1 1 0 RWX c) public access 1  0 0 1 For a particular file (say game) or subdirectory, define an appropriate access. owner group public chmod 761 game $ ls -l game -rwxrw---x 1 user group 6 Mar 11 12:50 game

Issues with Linux Just a single owner, a single group and the public Pro: Compact enough to fit in just a few bytes Con: Not very expressive Access Control List: This is a per-file list that tells who can access that file Pro: Highly expressive Con: Harder to represent in a compact way

XP ACLs

Security and Remote File Systems Recall that we can “mount” a file system Local: File systems on multiple disks/volumes Remote: A means of accessing a file system on some other machine Local stub translates file system operations into messages, which it sends to a remote machine Over there, a service receives the message and does the operation, sends back the result Makes a remote file system look “local”

Unix Remote File System Security Since early days of Unix, network file system (NFS) has had two modes Secure mode: user, group-id’s authenticated each time you boot from a network service that hands out temporary keys Insecure mode: trusts your computer to be truthful about user and group ids Most NFS systems run in insecure mode! Because of US restrictions on exporting cryptographic code…

Spoofing Question: what stops you from “spoofing” by building NFS packets of your own that lie about id? Answer? In insecure mode… nothing! In fact people have written this kind of code Many NFS systems are wide open to this form of attack, often only the firewall protects them

Summary File System: Disk Management Naming Protection Transforms blocks into Files and Directories Optimize for access and usage patterns Maximize sequential access, allow efficient random access Disk Management collecting disk blocks into files Naming the process of turning user-visible names into resources (such as files) Protection Layers to keep data secure