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

4.4 Linux File System

This document discusses the Linux file system. It begins by outlining the role of a file system in organizing and locating data. It then describes the hierarchical directory structure of the Linux file system, with directories containing files and other directories in a recursive, tree-like structure. Unlike Windows, Linux uses a single unified file system rather than multiple drives and file systems. The document outlines the various standard directories in a Linux file system like /bin, /home, /etc. It also describes the different types of files used in Linux like ordinary files, directories, special device files, links, and sockets. The concepts of the virtual file system, inodes, directories, and different types of links (hard and soft links) are explained

Uploaded by

Alpha Placard
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

4.4 Linux File System

This document discusses the Linux file system. It begins by outlining the role of a file system in organizing and locating data. It then describes the hierarchical directory structure of the Linux file system, with directories containing files and other directories in a recursive, tree-like structure. Unlike Windows, Linux uses a single unified file system rather than multiple drives and file systems. The document outlines the various standard directories in a Linux file system like /bin, /home, /etc. It also describes the different types of files used in Linux like ordinary files, directories, special device files, links, and sockets. The concepts of the virtual file system, inodes, directories, and different types of links (hard and soft links) are explained

Uploaded by

Alpha Placard
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Embedded Systems and RTOS

Session 4.4

Linux File System

Shripad V Deshpande

Electronics & Telecommunication Engineering


Symbiosis Institute of Technology, Pune
Symbiosis International (Deemed University), Pune
The Role of a File System
• The data is organized and can be easily
located.
• The data can be easily retrieved at any later
point in time.
• The integrity of the data is preserved.
• Data can be categorized under different
labels.
The Linux File System
• The *Nix (Unix or Linux) file system is a
hierarchical directory structure
• The structure resembles an upside down tree
• Directories are collections of files and
other directories. The structure is
recursive with many levels.
• Every directory has a parent except for the
root directory. Many directories have sub-
directories.
The Linux File System (Contd..)
• Unlike Windows, with multiple drives and
multiple file systems, the Linux system
only has ONE unified file system.
• The Linux Standard Base (LSB) specifies the
structure of a Linux file system.
• Supports 256-character filenames.
• All command line entries are case
sensitive.
• Use the slash(/) rather than the
backslash(\) that we use in Windows.
Typical Linux File System view
Various directories in Linux FS
• /bin, /sbin : executable files necessary to manage and
run the Linux system.
• /boot : bootloader files, required to boot the system
• /dev : special files used to represent the various
hardware devices in the system. E,g, hda, hdb ...
• /etc : text-based configuration files used by the
system as well as services running on the system.
• /home : subdirectories that serve as home directories
for each user account.
• /lib : code libraries used by programs in /bin and
kernel modules (stored in the modules subdirectory)
• /mnt , /media : used by some Linux distributions (such
as Fedora or Red Hat) to mount external devices.
Various directories in Linux FS
• /root : root user’s home directory. Notice
that it is located separately from the home
directories for other users in /home.
• /srv : subdirectories where services running
on the system (such as httpd and ftpd) save
their files
• /sys : information about the system hardware.
• /usr : application files used on the system
are saved in various subdirectories.
• /var : variety of variable data, including the
system log files
Types of Files Used by Linux
• Windows file system has two entry types in
the file system: Directories & Files. You
can have normal files, hidden files,
shortcut files, word processing files,
executable files, and so on.
• With Linux, however, there are a variety of
different file types used by the file
system.
Types of Files
• Ordinary files
• text files
• data files
• command text files
• executable files
• Directories
• Special device files :the mechanism used for input and
output. Most special files are in /dev
• Links: a system to make a file or directory visible in
multiple parts of the system's file tree.
• (Domain) Sockets: a special file type, similar to TCP/IP
sockets, providing inter-process networking protected by
the file system's access control.
• Named pipes: act more or less like sockets and form a way
for processes to communicate with each other, without
using network socket semantics.
File System Type
• A specific type of data storage format
• Provide a namespace— a naming and
organizational methodology
• A metadata structure
• Application Programming Interface (API) that
provides access to system function calls
• a security model,
• software required to implement all of these
functions.
File System Types on Linux
• Linux supports many (almost 100) different file system
types - most common choices - the ext family (such as
ext2, ext3 and ext4), XFS, ZFS, JFS and btrfs.
(Please note that Windows supports only two types of File Systems – FAT for
the very old systems and NTFS)
• The ext4 or fourth extended file system is the default
file system for many popular Linux distributions .
• It has the journaling feature - A journaling file system
logs changes to a file (usually a circular log in a
dedicated area) before committing them to the main file
system. Such file systems are less likely to become
corrupted in the event of power failure or system crash.
The Virtual File System idea
• Multiple file systems need to coexist
• But filesystems share a core of common concepts
and high-level operations
• So create a filesystem abstraction
• Applications interact with this VFS
• Kernel translates abstract-to-actual
Task 1 Task 2 … Task n
user space
kernel space

VIRTUAL FILE SYSTEM

minix ext2 msdos proc

Buffer Cache

device driver device driver


for hard disk for floppy disk
Linux Kernel
software
hardware
Hard Disk Floppy Disk
How Files are stored
• Files are represented by inodes
• iNode - contains file’s description:
• Type
• Access rights
• Owners
• Timestamps
• Size
• Pointers to data blocks
• Kernel keeps the inode in memory
• Directories are also files (with dentries)
• Devices accessed by I/O on ‘special’ files
• UNIX file systems can implement ‘links’
Inode diagram
inode

Direct blocks
Indirect blocks
File info

Double
Indirect
Blocks
Directories
• These are structured in a tree hierarchy
• Each can contain both files and directories
• A directory is just a particular type of file
• Special user-functions for directory access
• Each dentry contains filename + inode-no
• Kernel searches the directory tree, and
translates a pathname to an inode-number
Directory to iNode linking

Inode Table Directory


i1 name1

i2 name2

i3 name3

i4 name4
Links
• Multiple names can point to same inode
• The inode keeps track of how many links
• If a file gets deleted, the inode’s link-count
gets decremented by the kernel
• File is deallocated if link-count reaches 0
• This type of linkage is called a ‘hard’ link
• Hard links may exist only within a single FS
• Hard links cannot point to directories (cycles)
Symbolic Links
• Another type of file linkage (‘soft’ links)
• Special file, consisting of just a filename
• Kernel uses name-substitution in search
• Soft links allow cross-filesystem linkage
• But they do consume more disk storage
Next Session 4.5 ->
Processes and Threads Concept

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy