Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

More 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.
MORE FILE ATTRIBUTES. ls –l to display file attributes (properties) Listing of a specific directory Ownership and group ownership Different file permissions.
File Systems.
COS 318: Operating Systems File Layout and Directories
Linux Filesystem Features Evolution of a de facto standard file system for Linux: ‘ext2’
Agenda The Linux File System (chapter 4 in text) Directory Structures / Navigation Terminology / File Naming Rules Relative vs Absolute pathnames mkdir,
File System Interface CSCI 444/544 Operating Systems Fall 2008.
Inodes. Filesystems Each partition has a filesystem –This filesystem will usually support a directory hierarchy Every file on a disk partition is allocated.
Links Learning Objectives: 1. To understand the basics of links & its usage 2. To learn the construction / removal of different types of links 3. To distinguish.
Chapter 11: File System Implementation
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Linux+ Guide to Linux Certification, Second Edition
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
UNIX Chapter 11 File Sharing Mr. Mohammad Smirat.
Links Learning Objectives: 1. To understand the basics of links & its usage 2. To learn the construction / removal of different types of links 3. To distinguish.
Linux Linux File System.
CS 497C – Introduction to UNIX Lecture 16: - File Attributes Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Links Software Tools. Lecture 4 / Slide 2 Links l A link is a pointer to a file. l In fact, in UNIX all filenames are just links to a file. Most files.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
The file structure and related utilities CS240 Computer Science II.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Chapter 39 Virtsualization of Storage: File and Directory Chien-Chung Shen CIS, UD
Files & Directories Objectives –to be able to describe and use the Unix file system model and concepts Contents –directory structure –file system concepts.
CS 6560 Operating System Design Lecture 13 Finish File Systems Block I/O Layer.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Summer 2015 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to UNIX / Linux - 7 Dr. Jerry Shiao, Silicon Valley University.
Linux+ Guide to Linux Certification, Second Edition
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
Chapter 11 File Sharing. Sharing Techniques Duplicate files Common login Setting appropriate access permissions on shared files Common group for team.
Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved Chapter 5 File Management File Overview.
Chapter 5 File Management File System Implementation.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
UNIX Files File organization and a few primitives.
Managing Files. Module 5 Managing Files ♦ Introduction “On a Linux system, everything is a file; if something is not a file, it is a process.” ♦ Topics.
Files & File system. A Possible File System Layout Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
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.
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
UNIX File System (UFS) Chapter Five.
Linux File system Implementations
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Interface.
Lecture 19 Linux/Unix – File System
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
W4118 Operating Systems Instructor: Junfeng Yang.
Chapter 39 File and Directory Chien-Chung Shen CIS/UD
File Sharing via Links Chien-Chung Shen CIS, UD
Agenda The Linux File System (chapter 4 in text) Linking Files Hard Links / Symbolic Links Disk Storage Checking for Disk Space (df / du) Archiving (Backing.
COMP 3500 Introduction to Operating Systems Directory Structures Block Management Dr. Xiao Qin Auburn University
Getting Started with Linux
Chapter 11 File Sharing. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Objectives  To explain different ways of sharing files  To discuss.
Agenda The Linux File System (chapter 4 in text)
File System Examples Unix Fast File System (FFS)
Chapter 11: File System Implementation
Day 27 File System.
File System Implementation
Filesystems.
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
The Unix File System.
Hard Link when a file is copied, both the original and copy occupy separate space on the disk. unix allows a file to have more than one name and yet maintain.
The Linux Command Line Chapter 4
Chapter 15: File System Internals
Introduction to Operating Systems
The Linux Command Line Chapter 4
Presentation transcript:

Fall 2013 SILICON VALLEY UNIVERSITY CONFIDENTIAL 1 Introduction to Embedded Systems Dr. Jerry Shiao, Silicon Valley University

SILICON VALLEY UNIVERSITY CONFIDENTIAL 2 Pearson Addison-Wesley File System Review Inode a) Logical structure of current directory. File, Chapter3, is created in current directory. b) Contents of current directory. Directory entry contains pair. c) Relationship among a directory entry, Inode Table, and physical file contents. -Inode # index into the Inode Table. -Inode Table entry contains the physical location of file on disk.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 3 Spring 2014 File System  Virtual File System (VFS) User space has the applications and glibc (provides API file system calls: open, read, write, close). System call interface acts as a switch, funneling system calls from user space to the appropriate endpoints in kernel space. VFS exports APIs and abstracts them to individual file systems. Inode cache and Directory cache provides a pool of recently-used file system objects. Directory cache speeds up translation from file pathname to inode. Individual file systems exports APIs that is used by the VFS. Buffer cache buffers the requests between the file systems and the block devices that they manipulate (for faster access).

SILICON VALLEY UNIVERSITY CONFIDENTIAL 4 Spring 2014 File System  Virtual File System (VFS) File Object: Stores info about interaction between open file and process. Dentry Object: Stores info about linking directory entry (file name) and file. Inode Object: Stores info about specific file (inode number identifies file). The file control block. Superblock Object: Stores info about mounted filesystem. The filesystem control block. Process 1 Process 2 File Object Dentry Object Dentry Object Dentry Cache Inode Object Superblock Object Inode Cache Process 1 Process 2 File Object Dentry Object Dentry Object Dentry Cache Inode Object Superblock Object Inode Cache Disk File

SILICON VALLEY UNIVERSITY CONFIDENTIAL 5 Spring 2014 Linux File System  Virtual File System (VFS) struct file_system_type links together currently- supported file systems (/proc/filesystems). struct vfsmount links together file systems currently mounted. Link to struct superblock. struct superblock represents a file system.  Manage inodes: alloc_inode, destroy_inode, read_inode, write_inode, sync_fs. struct inode represents an object (file or directory) in the file system with unique identifier. Metadata to manage objects in the file system  struct inode_operations: Operations that operate on inode.  struct file_operations: Methods related to files and directories (the standard system calls).

SILICON VALLEY UNIVERSITY CONFIDENTIAL 6 Spring 2014 Linux File System  Virtual File System (VFS) To achieve the abstraction (i.e. “black box operation) to the user, common API to the user through glibc library and common callback function signature to the I/O functions. Inode represents an object in the file system with a unique identifier (translating filename). struct file_operations abstractions (i.e. read/write/open ) allow all I/O operations to have common interface. The indirect calls (i.e. callback functions) are APIs specific to the file system.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 7 Pearson Addison-Wesley File System Hard Links  Hard link creates a file entry (new file name) in directory with the same inode index as the linked file.  ln [ options ] existing-file new-file  ln [ options ] existing-file-list directory  - f : Force creation of link.  - n : Do not create the link if “new-file” exists.  - s : Create symbolic link to “existing-file”.  NOTE: : Create a hard link to “existing-file”. : The user MUST have execute permission for all the directories in the path leading to the file.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 8 Pearson Addison-Wesley File System Hard Links Current Directory  $ ls -il total rw-r--r-x 1 sau users :47 Chapter rw-r--r-- 1 sau users :47 Chapter rw-r--r-- 1 sau users :23 Chapter3  $ ln Chapter3 Chapter3.hard  $ ls -il total rw-r--r-x 1 sau users :47 Chapter rw-r--r-- 1 sau users :47 Chapter rw-r--r-- 2 sau users :23 Chapter rw-r--r-- 2 sau users :23 Chapter3.hard  $ rm Chapter3  $ ls -il total rw-r--r-x 1 sau users :47 Chapter rw-r--r-- 1 sau users :47 Chapter rw-r--r-- 1 sau users :23 Chapter3.hard  $ Create hard link. The inode index for linked file and file are the same. Link count is 2. Remove only removes the entry in the directory. File is physically still on disk. Link count is 1.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 9 Pearson Addison-Wesley File System Link Count  Number of different directory entries pointing to inode of the object (i.e. directory or file).  File: Number of hard links to that file. $ ls -il memo rw-r--r-x 1 sau users :16 memo6  Directory: Number of directory entries connecting local directory to Linux file system. $ ls -a... students students_2 students.gz $ ls -ld drwxr-xr-x 2 student1 student :06. $ mkdir test_dir $ ls -a... students students_2 students.gz test_dir $ ls -ld drwxr-xr-x 3 student1 student :06.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 10 Pearson Addison-Wesley File System Create Hard Link a) Logical structure of current directory. Hard link, Chapter3.hard, is linked to file, Chapter3 in current directory. b) Contents of current directory. Directory entry contains pair for Chapter3.hard. The inode# is same as file Chapter3. c) Relationship among a directory entry, Inode Table, and physical file contents. -Inode # index into the Inode Table for both Chapter3 and Chapter3.hard.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 11 Pearson Addison-Wesley File System Hard Link Different Directory

SILICON VALLEY UNIVERSITY CONFIDENTIAL 12 Pearson Addison-Wesley File System Hard Links Different Directory  $ ls -il memos/memo rw-r--r-x 1 sau users :16 memos/memo6  $ ln memos/memo6 memo6.hard  $ ls -il memos/memo rw-r--r-x 2 sau users :16 memos/memo6  $ ls -il memo6.hard rw-r--r-x 2 sau users :16 memo6.hard  $  $ rm memos/memo6  $ ls -il memos/memo6 ls: cannot access memos/memo6: No such file or directory  $ ls -il memo6.hard rw-r--r-x 1 sau users :16 memo6.hard  $ Create hard link. The inode index for linked file and file are the same. Link count is 2. Remove only removes the entry in the directory. File is physically still on disk. Link count is 1.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 13 Pearson Addison-Wesley File System Hard Links Limitations  Cannot use Hard Links between files on different file systems. # ln /usr/bin/zip my_zip ln: creating hard link `my_zip' => `/usr/bin/zip': Invalid cross-device link  Moving a hard linked file to different file system causes physical copy of file to be made. $ ls -il memo6.hard rw-r--r-x 2 sau users :25 memo6.hard $ ls -il memos/memo rw-r--r-x 2 sau users :25 memos/memo6 $ mv memo6.hard /tmp $ ls -il /tmp/memo6.hard rw-r--r-x 1 sau users :25 /tmp/memo6.hard

SILICON VALLEY UNIVERSITY CONFIDENTIAL 14 Pearson Addison-Wesley File System Soft Links  Does not have any of the Hard Link issues.  Soft link creates a new file entry (new file name and new inode index) in directory.  ln [ options ] existing-file new-file  ln [ options ] existing-file-list directory  - f : Force creation of link.  - n : Do not create the link if “new-file” exists.  - s : Required. Create symbolic link to “existing-file”.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 15 Pearson Addison-Wesley File System Soft Links Current Directory  $ ls -il Chapter rw-r--r-x 1 sau users :47 Chapter3  $ ln -s Chapter3 Chapter3.soft  $ ls -il Chapter3 Chapter3.soft rw-r--r-x 1 sau users :47 Chapter lrwxrwxrwx 1 sau users :12 Chapter3.soft -> Chapter3  $ Create soft link. 1)The inode index for linked file and file are different. These are different files. 2)Original file is file type “-”, an ordinary file. Link file is type “l”, a link file. 3)Link count 1. 4)File sizes are different. Link file is 8 bytes, the length of “Chapter3”, the pathname is placed in the link file.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 16 Pearson Addison-Wesley File System Soft Links Create soft link. 1)The inode index for linked file and file are different. These are different files. 2)Original file is file type “-”, an ordinary file. Link file is type “l”, a link file. 3)Link count 1. 4)File sizes are different. Link file is 8 bytes, the length of “Chapter3”, the pathname is placed in the link file.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 17 Pearson Addison-Wesley File System Soft Links Pros and Cons  Pros Establish symbolic link between files across file systems. Establish symbolic link between directories. Symbolic linked file edited by editor does not change filename.  Cons If the file that the symbolic link points to is moved from one directory to another, it can no longer be accessed via the link. UNIX has to support an additional file type (the link type) and a new file has to be created for every link. Symbolic links also result in slow file operations because, for every reference to the file, the link file has to be opened and read in order to reach the actual file.

SILICON VALLEY UNIVERSITY CONFIDENTIAL 18 Pearson Addison-Wesley Assignment 9

SILICON VALLEY UNIVERSITY CONFIDENTIAL 19 Pearson Addison-Wesley Assignment 9