UNIX File System By Vishal Desai. Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps.

Slides:



Advertisements
Similar presentations
The UNIX File System Harry Chen Department of CSEE University of MD Baltimore County.
Advertisements

More on File Management
A Guide to Unix Using Linux Fourth Edition
1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
CS 497C – Introduction to UNIX Lecture 11: - The File System Chin-Chih Chang
File System Interface CSCI 444/544 Operating Systems Fall 2008.
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.
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Chapter 5 Accessing Files and Directories. How Directories Get Created OS installation: usr, dev, etc, export, kernel and others places to store installation.
Linux Linux File System.
The UNIX File System.
Guide To UNIX Using Linux Third Edition
Linux Operating System
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Getting Started with Linux Linux System Administration Permissions.
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.
COMP1070/2002/lec4/H.Melikian COMP1070 Lecture #5  Files and directories in UNIX  Various types of files  File attributes  Notion of pathname  Commands.
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
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Chapter Two Exploring the UNIX File System and File Security.
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.
UNIVERSITY OF COLOMBO SCHOOL OF COMPUTING IT5501 Systems & Network Administration DEGREE OF BACHELOR OF INFORMATION TECHNOLOGY.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
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.
PacNOG 6: Nadi, Fiji UNIX ™/ /Linux Permissions Hervey Allen Network Startup Resource Center.
Privileges: who can control what Introduction to Unix June 16, 2009 Papeete, French Polynesia Hervey Allen.
1 © 2001 John Urrutia. All rights reserved. Chapter 4 The LINUX Filesystem.
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
Linux Commands C151 Multi-User Operating Systems.
Slide: 1 UNIX FILE SYSTEM By:Qing Yang ID: Operating System Research Topic December, 2000.
Linux Filesystem WeeSan Lee. Roadmap Disk Partitions The Filesystem Filesystem Mouting & Umounting File Tree File Type File Permission.
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.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
UNIX filesystem CS 2204 Class meeting 2 *Notes by Doug Bowman and other members of the CS faculty at Virginia Tech. Copyright
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.
Operating System & Administration UNIT-III Introduction to File System.
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
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.
Chapter 5 The Filesystem. Computer Center, CS, NCTU 2 Outline  File System Architecture  Pathname  File Tree  Mounting  File Types  inode and file.
File System Security in Unix Annie Calpe. Overview Unix Basics File System Security: - Account Security: Passwords - File Permissions - Access Control.
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,
Privileges: who can control what
Permissions: who can control what Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
UBUNTU INSTALLATION
Linux file system "On a UNIX system, everything is a file;
Chapter 6 File Systems CSNB113 SYSTEM ADMINISTRATION
C151 Multi-User Operating Systems
UNIX Filesystem and Hierarchy
Exploring the UNIX File System and File Security
An overview of the kernel structure
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Chapter 7 File and file System structure
Department of School of Computing and Engineering
Perl Scripting and The File system
The Filesystem Chapter 5.
Chapter 5 The Filesystem
Chapter 4: The Linux Filesystem
January 26th, 2004 Class Meeting 2
Presentation transcript:

UNIX File System By Vishal Desai

Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps processes, serial ports, interprocess communication channels. This leads to a very convenient way of mapping these objects but leads to monstrous file systems.

Basic Constituents File system consists of the following:  Namespace: A way of naming and arranging things in a hierarchy.  An API: Set of system calls for manipulating nodes.  Security Model: Protection mechanism to enable sharing.  Implementation: Code that ties the logical model to the actual disk.

Basic Constituents Cont’d UNIX file systems define an abstract kernel-level interface that accommodates several different back ends. Some portions of a file tree are handled by traditional disk based implementation; others are fielded by separate drivers within the kernel. E.g. NFS. A complicated factor in UNIX file systems is that they tend to support more than one type of disk-based file systems.

Pathnames The file system is a single hierarchy. It starts at directory /. It continues through an arbitrary number of subdirectories. / is also called as the root directory. List of directory to be traversed to locate a file forms the pathname. Pathnames can be either absolute or relative. No restriction on depth of file system. However, each component of a pathname can not be more than 255 characters in length. Also a single path can not be more than 1023 characters. To access a file with pathname longer than this, we must “cd” to an intermediate directory and use a relative pathname.

Pathnames Cont’d No restrictions on naming of files except they are limited in length and must not contain the “/” character or nulls. The space character is supported. You just need to quote the file name containing spaces. E.g. % more “My file.txt” would preserve My file.txt as a single argument to more.

Mounting A file tree refers to the overall layout of the file system. Different file systems are attached with the mount command. Mount maps a directory within the file tree to the root of the new file system. This is called the mount point. The previous contents of the mount point become inaccessible. However mount points are empty directories. E.g. # mount /dev/sd1c /users.

Mounting Cont’d A list of file systems that is customarily mounted is kept in the /etc/fstab, /etc/vfstab, or /etc/checklist file. The information in this file allows file systems to be checked (fsck –p) and mounted (mount –a) at the time of booting. Also in order to mount a file system manually, the location of the file system to be mounted is looked up in this file.

Unmounting File systems are detached with the unmount command. In order to unmount a file system: 1) It must not be busy. 2) No files or process should be open or running. 3) If a file system contains executable programs, they must not be running.

Some Syntactic Details About Unmounting Some operating systems allow forced unmounting of a file system. E.g. 1) FreeBSD: unmount –f. 2) Solaris 8: unmount –f. 3) Earlier versions of Solaris: It is possible to achieve the same effects as unmount –f by a two step process as follows. a) lockfs –h to “hardlock” the file system. b) Then unmount it normally.

Syntactic Details Cont’d To find out why a file system is busy you can run the fuser -c command. This will display the process ID of every process that is using the file system in anyway. E.g. % fuser -c /usr /usr: 157tom 315ctom The letter codes besides the PIDs show what’s being done. E.g. “c” is for a process that has a current directory on the file system, “o” for an open file, “t” for a running program, “m” for a mapped file (shared libraries usually) and “r” for a process whose root directory is on the file system.

Syntactic Details Cont’d To determine exactly what the offending processes are run ps with a list of the PIDs returned by fuser. E.g. From the above example % ps -fp “ ” UIDPIDPPIDCSTIMETTYTIMECMD root Oct 14?0:00/usr/bin/X11/xdm lp31510Jun 27?5:26/usr/sbin/named

Organization of the File Tree Root file system contains the root directory and a minimal set of files and subdirectories. File containing the kernel called unix or vmunix resides in either the root directory or in /kernel or /stand. /dev is for device files. /etc is for critical system files. /sbin and /bin are for important utilities. /tmp is for temporary files.

Organization of the File Tree Cont’d Some systems keep shared libraries and the C preprocessor in the /lib directory. Others have moved this into /usr/lib. /usr contains most of the user programs and online manuals etc. /var provides a home for spool directories, log files, accounting information etc. Home directories of users should be kept on different file systems and mounted beneath /usr.

File Types Regular Files. Directories. Character Device Files. Block Device Files. UNIX domain sockets. Named pipes (FIFOs). Symbolic links. A few systems do not support UNIX domain sockets and named pipes.

File Attributes Every file has a set of 9 permission bits that control who can read, write and execute the contents of the file. Together with 3 other bits that affect the operation of executable programs, these bits constitute the file’s “mode”. These 12 bits together with 4 bits of file type information are stored as a 16-bit word. The 4 file type bits are set when the file is first created and can’t be changed, but the 12 bits can be changed by the owner of the file or the superuser by using the chmod command.

File Attributes Cont’d The setuid and setgid bits: Bits with octal values 4000 and They allow programs to access files and processes that would be otherwise off-limits to the user that runs them. The sticky bit: octal value Mostly obsolete and is ignored by the kernel. If this bit is set though, most UNIX systems don’t allow you to delete them. You have to be superuser or the owner to do so. The permission bits: Remaining 9 bits are permission bits. UNIX doesn’t allow for separate permissions for separate users. There are sets of permissions for the owner, group owner and everyone else.