0% found this document useful (0 votes)
18 views

Files Systems

The document provides an overview of file systems, including their definitions, structures, and operations within Linux. It covers various types of file systems, file attributes, directory systems, and the implementation of files and directories. Additionally, it discusses the components of Linux file systems such as the boot block, super block, inode list, and data blocks.

Uploaded by

Lucky Machaba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Files Systems

The document provides an overview of file systems, including their definitions, structures, and operations within Linux. It covers various types of file systems, file attributes, directory systems, and the implementation of files and directories. Additionally, it discusses the components of Linux file systems such as the boot block, super block, inode list, and data blocks.

Uploaded by

Lucky Machaba
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 36

Objective

•Basics of Files and Directories


•Linux File Systems
•Linux Kernel
•Kernel Initialization

1
What is a file system?

• Speaking broadly, a file system is the


logical means for an operating system to
store and retrieve data on the computers
hard disks, be they local drives, network-
available volumes, or exported shares in a
storage area network
What is a file system?

• There is some ambiguity in the term “file


system”. The term can be used to mean any
of the following:
- The type of a file system refers to a specific
implementation such as ext2, reiserfs or nfs, each
implementation contains the methods and data
structures that an operating system uses to keep
track of files on a disk or partition
What is a file system?

- An instance of a file system refers to a file


system type residing at a location such as
/dev/hda4
- Additionally a file system can refer to the
methods and data structures that an operating
system uses to keep track of files on a disk or
partition
Long-term Information Storage

1. Must store large amounts of data

2. Information stored must survive the


termination of the process using it

3. Multiple processes must be able to access


the information concurrently

5
File Naming

Typical file extensions.


6
File Structure

• Three kinds of files


– byte sequence
– record sequence
– tree
7
File Types

(a) An executable file (b) An archive 8


File Access
• Sequential access
– read all bytes/records from the beginning
– cannot jump around, could rewind or back up
– convenient when medium was mag tape
• Random access
– bytes/records read in any order
– essential for data base systems
– read can be …
• move file marker (seek), then read or …
• read and then move file marker

9
File Attributes

Possible file attributes 10


File Operations

1. Create 7. Append
2. Delete 8. Seek
3. Open 9. Get attributes
4. Close 10.Set Attributes
5. Read 11.Rename
6. Write

11
Memory-Mapped Files

(a) Segmented process before mapping files


into its address space
(b) Process after mapping
existing file abc into one segment
creating new segment for xyz
12
Directories
Single-Level Directory Systems

• A single level directory system


– contains 4 files
– owned by 3 different people, A, B, and C

13
Two-level Directory Systems

Letters indicate owners of the directories and files

14
Hierarchical Directory Systems

A hierarchical directory system

15
Path Names

A Linux directory tree


16
Directory Operations

1. Create 5. Readdir
2. Delete 6. Rename
3. Opendir 7. Link
4. Closedir 8. Unlink

17
File System Implementation

A possible file system layout

18
Implementing Files (1)

(a) Contiguous allocation of disk space for 7 files


(b) State of the disk after files D and E have been removed
19
Implementing Files (2)

Storing a file as a linked list of disk blocks

20
Implementing Files (3)

Linked list allocation using a file allocation table in RAM


21
Implementing Files (4)

An example i-node
22
Implementing Directories (1)

(a) A simple directory


fixed size entries
disk addresses and attributes in directory entry
(b) Directory in which each entry just refers to an i-node
23
Implementing Directories (2)

• Two ways of handling long file names in directory


– (a) In-line
– (b) In a heap 24
Shared Files (1)

File system containing a shared file


25
Shared Files (2)

(a) Situation prior to linking


(b) After the link is created
(c)After the original owner removes the file
26
File System Reliability (1)

File that has


not changed

• A file system to be dumped


– squares are directories, circles are files
– shaded items, modified since last dump
– each directory & file labeled by i-node number
27
Linux File Systems

Entire Disk

Master Boot Partition Table Disk Partitions


Record

Boot Block Super Block Inode List Data Blocks

A Possible File System Instance Layout


Linux File Systems
• The central structural concepts of a file
system type are:
- Boot Block
- Super Block
- Inode List
- Data Block

Boot Block Super Block Inode List Data Blocks


Linux File Systems
• Boot Block:
- Occupies the beginning of a file system
- Typically residing at the first sector, it may also
contain the bootstrap code that is read into the
machine at boot time
- Although only one boot block is required to boot
the system, every file system may contain a boot
block

Boot Block
Linux File Systems
• Super Block:
- Describes the state of a file system
- How large it is
- How many files it can store
- Where to find free space in the file system
- Additional data that assists the file management
system with operating on the file system

Boot Block Super Block


Linux File Systems
• Super Block:
- Duplicate copies of the super block may reside
through out the file system in case the super block
is corrupted

Boot Block Super Block


Linux File Systems
• Inode List:
- An inode is the internal representation of a file
contains the description of the disk layout of the
file data
- file owner
- permissions
- The inode list contains all of the inodes present
in an instance of a file system

Boot Block Super Block Inode List


Linux File Systems
• Data Blocks:
- Contain the file data in the file system
- Additional administrative data
- An allocated data block can belong to one and
only one file in the file system

Boot Block Super Block Inode List Data Blocks


Linux File Systems

• On a Linux system, a user or user program


sees a single file hierarchy, rooted at /
• Every file and directory can trace its origins
on a tree back to the root directory
Linux File Systems
/

bin boot dev etc home lib mnt proc root sbin tmp usr var

You might also like