Linux Filesystem Last Update 2012.08.24 1.3.0 Copyright 2000-2012 Kenneth M. Chipps Ph.D. www.chipps.com 1.

Slides:



Advertisements
Similar presentations
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.
Advertisements

A Guide to Unix Using Linux Fourth Edition
File Systems Examples.
Linux Filesystem Features Evolution of a de facto standard file system for Linux: ‘ext2’
5 Basic utilities When a user logs in to the Linux operating system the directory that they will start in is their home directory. Most users will have.
Introduction to Unix (CA263) File System
Exploring the UNIX File System and File Security
GNU/Linux Filesystem 1 st AUT GNU/Linux Festival Computer Engineering & IT Department Bahador Bakhshi.
Linux Filesystem Features Evolution of a de facto standard file system for Linux: ‘ext2’
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Ceng Operating Systems
Operating Systems File Systems (Select parts of Ch 6)
Linux Linux File System.
The UNIX File System.
File System Variations and Software Caching May 19, 2000 Instructor: Gary Kimura.
Guide To UNIX Using Linux Third Edition
Linux Operating System
File System and Directory Structure in Linux. What is File System In a computer, a file system is the way in which files are named and where they are.
Guide To UNIX Using Linux Fourth Edition
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
The file structure and related utilities CS240 Computer Science II.
Manage Directories and Files in Linux
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
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.
Operating Systems Lecture 4. Agenda for Today Review of previous lecture Operating system structures Operating system design and implementation UNIX/Linux.
Chapter Two Exploring the UNIX File System and File Security.
File System Management File system management encompasses the provision of a way to store your data in a computer, as well as a way for you to find and.
1 Interface Two most common types of interfaces –SCSI: Small Computer Systems Interface (servers and high-performance desktops) –IDE/ATA: Integrated Drive.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
CS 149: Operating Systems April 9 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
Chapter 5 File Management File System Implementation.
Manage Directories and Files in Linux. 2 Objectives Understand the Filesystem Hierarchy Standard (FHS) Identify File Types in the Linux System Change.
Chapter Two Exploring the UNIX File System and File Security.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Implementation.
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
System Administration – Part 2. Devices in UNIX are files: A device can be accessed with different file names All device files are stored in /dev or its.
Manage Directories and Files in Linux Part 2. 2 Identify File Types in the Linux System The file types in Linux referred to as normal files and directories.
PTA Linux Series Copyright Professional Training Academy, CSIS, University of Limerick, 2006 © Workshop V Files and the File System Part B – File System.
Jeff's Filesystem Papers Review Part I. Review of "Design and Implementation of The Second Extended Filesystem"
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Interface.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
Linux File system and VFS. A simple description of the UNIX system, also applicable to Linux, is this: "On a UNIX system, everything is a file; if something.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
File system In computing, a file system is a method of storing and organizing computer files and the data they contain to make it easy to find and access.
Lecture 19 Linux/Unix – File System
UNIX File System By Vishal Desai. Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps.
Linux file systems Name: Peijun Li Student ID: Prof. Morteza Anvari.
SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
1 The File System. 2 Linux File System Linux supports 15 file systems –ext, ext2, xia, minix, umsdos, msdos, vfat, proc, smb, ncp, iso9660, sysv, hpfs,
LINUX Zhengli Zhu, School of Life Sciences. Outline 1. ABC of Linux 2. Basic orers of Linux 3. Bash Programming.
ORAFACT The Linux File System. ORAFACT Filesystem Support Support for dozens of filesystem types including: Minix, ext2, MS-DOS, UMSDOS, VFAT, NTFS, NFS,
Linux Administration – Finding You Way on the Command Line The Linux File Directory or Tree.
BILKENT UNIVERSITY DEPARTMENT OF COMPUTER TECHNOLOGY AND INFORMATION SYSTEMS CTIS156 INFORMATION TECHNOLOGIES II FILES AND FILE SYSTEM STRUCTURE.
File-System Management
EXT in Detail High-Performance Database Research Center
Jonathan Walpole Computer Science Portland State University
Filesystem Management and Backups
UBUNTU INSTALLATION
Linux file system "On a UNIX system, everything is a file;
Chapter 6 File Systems CSNB113 SYSTEM ADMINISTRATION
Day 27 File System.
Operation System Program 4
Exploring the UNIX File System and File Security
Operating Systems Lecture 4.
Lecture 43 Syed Mansoor Sarwar
Welcome to Linux Chap#1.
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

Linux Filesystem Last Update Copyright Kenneth M. Chipps Ph.D. 1

Objectives of This Section Learn –What filesystems are –What filesystems Linux can use Copyright Ken Chipps All Rights Reserved 2

History of Linux Filesystems Linux was cross-developed under the Minix operating system Linus Torvalds decided It was easier to share disks between the two systems than to design a new filesystem, so support for the Minix filesystem was built into Linux The Minix filesystem was an efficient and relatively bug-free piece of software Copyright Ken Chipps All Rights Reserved 3

History of the Linux Filesystem However, the restrictions in the design of the Minix filesystem were too limiting, so people started thinking and working on the implementation of new filesystems in Linux In order to ease the addition of new filesystems into the Linux kernel, a VFS - Virtual File System layer was developed Copyright Ken Chipps All Rights Reserved 4

History of the Linux Filesystem The VFS layer was initially written by Chris Provenzano, and later rewritten by Linus Torvalds before it was integrated into the Linux kernel VFS also proved to be too limiting so a new filesystem, called the Extended File System was implemented in April 1992 and added to Linux 0.96c Copyright Ken Chipps All Rights Reserved 5

History of the Linux Filesystem This new filesystem removed the two big Minix limitations –Maximum size of 2 GB –Maximum file name size of 255 characters This was an improvement over the Minix filesystem but some problems were still present in it Copyright Ken Chipps All Rights Reserved 6

History of the Linux Filesystem There was no support for –Separate access –Inode modification –Data modification timestamps The filesystem used linked lists to keep track of free blocks and inodes and this produced bad performance Copyright Ken Chipps All Rights Reserved 7

History of the Linux Filesystem As the filesystem was used, the lists became unsorted and the filesystem became fragmented As a response to these problems, two new filesystems were released in the Alpha version of Linux in January 1993 –The Xia filesystem –The Second Extended File System Copyright Ken Chipps All Rights Reserved 8

History of the Linux Filesystem The Xia filesystem was heavily based on the Minix filesystem kernel code and only added a few improvements over this filesystem Basically, it provided long file names, support for bigger partitions, and support for the three timestamps Copyright Ken Chipps All Rights Reserved 9

History of the Linux Filesystem On the other hand, ext2 was based on the ext code with many reorganizations and many improvements It had been designed with evolution in mind and contained space for future improvements When the two new filesystems were first released, they provided essentially the same features Copyright Ken Chipps All Rights Reserved 10

History of the Linux Filesystem Due to its minimal design, xia fs was more stable than ext2 As the filesystems were used more widely, bugs were fixed in ext2 and lots of improvements and new features were integrated ext2 is now very stable and has become the de-facto standard Linux filesystem Copyright Ken Chipps All Rights Reserved 11

Structure Unlike Windows Linux keeps a single filesystem for all hardware devices There is no C: D: E: and so on Copyright Ken Chipps All Rights Reserved 12

Inode Within a Linux filesystem each file is represented by a structure, called an inode Each inode contains the description of the file, as in –File type –Access rights –Owners –Timestamps –Size Copyright Ken Chipps All Rights Reserved 13

Inode –Pointers to data blocks The addresses of data blocks allocated to a file are stored in its inode When a user requests an I/O operation on the file, the kernel code converts the current offset to a block number, uses this number as an index in the block addresses table and reads or writes the physical block Copyright Ken Chipps All Rights Reserved 14

Directories Directories are structured in a hierarchical tree Each directory can contain files and subdirectories Directories are implemented as a special type of file Actually, a directory is a file containing a list of entries Copyright Ken Chipps All Rights Reserved 15

Directories Each entry contains an inode number and a file name When a process uses a pathname, the kernel code searches in the directories to find the corresponding inode number After the name has been converted to an inode number, the inode is loaded into memory and is used by subsequent requests Copyright Ken Chipps All Rights Reserved 16

Files Linux itself does not use extensions in file names Filenames that begin with a period are hidden To see them use ls -a Copyright Ken Chipps All Rights Reserved 17

Links Like Unix, Linux filesystems implement the concept of links Several names can be associated with an inode The inode contains a field containing the number associated with the file Copyright Ken Chipps All Rights Reserved 18

Links Adding a link simply consists of creating a directory entry, where the inode number points to the inode, and in incrementing the links count in the inode. When a link is deleted, in other words when one uses the rm command to remove a filename, the kernel decrements the links count and deallocates the inode if this count becomes zero Copyright Ken Chipps All Rights Reserved 19

Links This type of link is called a hard link and can only be used within a single filesystem It is impossible to create cross-filesystem hard links Moreover, hard links can only point to files Another kind of link exists in Linux filesystems Copyright Ken Chipps All Rights Reserved 20

Links Symbolic links are simply files which contain a filename When the kernel encounters a symbolic link during a pathname to inode conversion, it replaces the name of the link by its contents In other words. the name of the target file, then it restarts the pathname interpretation Copyright Ken Chipps All Rights Reserved 21

Links Since a symbolic link does not point to an inode, it is possible to create cross- filesystem symbolic links Symbolic links can point to any type of file, even to nonexistent files Symbolic links are very useful because they don't have the limitations associated with hard links Copyright Ken Chipps All Rights Reserved 22

ext2 The current filesystem standard The second extended file system First appeared in the 2.2 kernel Although some are moving to ext3 Copyright Ken Chipps All Rights Reserved 23

ext3 ext3 is a journaling filesystem developed by Stephen Tweedie It is compatible with the ext2 filesystems Basically it can be seen as an ext2 filesystem with a journal file The journaling capability means no more waiting for fsck to run or worrying about metadata corruption Copyright Ken Chipps All Rights Reserved 24

ext3 What is most noticeable is that you can switch back and forth between ext2 and ext3 on a partition without any problem It is just a matter of giving the mount command the right filesystem type From kernel version on ext3 is included in the standard kernel Copyright Ken Chipps All Rights Reserved 25

ext3 Before a partition can be mounted as an ext3 filesystem the journal file must be created The easiest way to do it is to type –tune2fs -j /dev/hdaX This can be done on an unmounted or on a mounted filesystem If the journal is created on a mounted filesystem a file named.journal file will be seen Copyright Ken Chipps All Rights Reserved 26

ext3 Don't try to delete this and don't back this up or restore it from backup If tune2fs -j is run on an unmounted partition an invisible journal file will be created Now the filesystem can be mounted as ext3 using –mount -t ext3 /dev/hdaX /mnt/somewhere Copyright Ken Chipps All Rights Reserved 27

Copyright Ken Chipps All Rights Reserved 28 Standard System Directories / –The root directory –Generally in Linux, unlike other operating systems, this directory holds no files –It only has other directories below it /bin –Holds standard commands and utilities

Copyright Ken Chipps All Rights Reserved 29 Standard System Directories /boot –Holds the kernel image files and modules loaded when the system boots /dev –Holds the file interfaces for devices such as printers /etc –This directory and its subdirectories holds system configuration files

Standard System Directories /home –Holds user home directories /initrd –This directory is empty, but is used as a critical mount point during the boot process /lib –Shared libraries and kernel modules Copyright Ken Chipps All Rights Reserved 30

Copyright Ken Chipps All Rights Reserved 31 Standard System Directories /lost+found –Used by fsck to place orphaned files, such as files without names /misc –Normally not used /media –On modern Linux systems this contains the mount points fore removable media

Copyright Ken Chipps All Rights Reserved 32 Standard System Directories /mnt –On older Linux systems this contains the mount points fore removable media /opt –Holds software applications that have been added /proc –Used to show running processes

Standard System Directories /root –The home directory of the superuser /sbin –Holds specialized system programs /tmp –For temporary files /usr –Hold files and commands directly related to users of the system Copyright Ken Chipps All Rights Reserved 33

Copyright Ken Chipps All Rights Reserved 34 Standard System Directories /usr/bin –User oriented commands and utilities /usr/doc –Documentation /usr/lib –Holds libraries for programming languages

Copyright Ken Chipps All Rights Reserved 35 Standard System Directories /use/local –Locally installed software /usr/sbin –Holds system administration commands /usr/share –Stuff to be used by several programs /usr/share/doc –Holds Linux documentation

Copyright Ken Chipps All Rights Reserved 36 Standard System Directories /usr/share/man –Holds the man pages /usr/spool –Holds spooled files, such as print spooling /usr/src –Holds source files –For example /usr/src/linux holds the kernel source files

Copyright Ken Chipps All Rights Reserved 37 Standard System Directories /usr/X11R6 –X Window applications and libraries /var –Holds files that vary a lot in size /var/cache –Application cache data /var/lib –State information for applications

Standard System Directories /var/lock –Holds locks for files that are locked /var/log –Holds kernel and system log files /var/spool –Holds application spool data as well as print, cron, and at jobs Copyright Ken Chipps All Rights Reserved 38

Copyright Ken Chipps All Rights Reserved 39 Standard System Directories /var/tmp –Holds temporary files that need to be retained during a system reboot

Copyright Ken Chipps All Rights Reserved 40 Links Some files in Linux systems are not files Instead they are links to files These show up as –l in the first position when the –ls command is issued

Copyright Ken Chipps All Rights Reserved 41 Links Basically a symbolic link is just another way to indicate a path Symbolic links then differ from hard links Hard links are actual files To remove a file, just remove the hard links The symbolic links will then fail, as the file is no longer there