SlideShare a Scribd company logo
Linux File System



© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>
               All Rights Reserved.
What to Expect?
W's of a File System
Three Levels of File System




        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   2
                       All Rights Reserved.
What is a File System?
Mechanism of Organizing our Data
  Labelling by Names, Easy Access, ...
Algorithm to Achieve the Desired
Organization
  Ability to Store, Retrieve, Search, Sort, ...
Data Structures to Achieve the Desired
Performance


          © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   3
                         All Rights Reserved.
Why we need a File System?
Preserve Data for Later
  Access
  Update
  Discard
Tag Data for
  Categorizing
  Easy & Fast Lookup
Fast & Reliable Data Management by
  Optimized Operations
            © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   4
                           All Rights Reserved.
File System Decoded
Three things at three levels
  Hardware Space – The Physical Organization of Data
  on the Storage Devices
  Kernel Space – Drivers to decode & access the data
  from the Physical Organization
  User Space – All what you see from / - The User View
Which ever it be, it basically does
  Organize our data
  For easy access by tagging
  For fast maintenance by optimizing

           © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   5
                          All Rights Reserved.
Hardware Space File System




  © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   6
                 All Rights Reserved.
The Hard Disk
                        Tracks

                                                      Sectors




Disk or
Platter




  © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>             7
                 All Rights Reserved.
The Hard Disk
                                                               Spindle

                                                               Heads




            .                                           .
Cylinder    .                                           .
            .                                           .




           © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>             8
                          All Rights Reserved.
Understanding a Hard Disk
Example (Hard Disk)
  Heads (or Platters): 0 – 9
  Tracks (or Cylinders): 0 – 24
  Sectors: 1 – 64
Size of the Hard Disk
  10 x 25 x 64 x 512 bytes = 8000KiB
Device independent numbering
  (h, t, s) → 64 * (10 * t + h) + s → (1 - 16000)

         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   9
                        All Rights Reserved.
Partitioning a Hard Disk
First Sector – Master Boot Record (MBR)
  Contains Boot Info
  Contains Physical Partition Table
Maximum Physical Partitions: 4
  At max 1 as Extended Partition
  Rest as Primary Partition
Extended could be further partitioned into
  Logical Partitions
In each partition
  First Sector – Boot Record (BR)
  Remaining for File System / Format
  Extended Partition BR contains the Logical Partition Table
              © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   10
                             All Rights Reserved.
Placement of a Hardware FS
Each Partition contains a File System
  Raw (no FS)
  Organized
Organized one is initialized by the corresponding
Formating
“Partition Type is to OS”
  W95*, DOS*, BSD*, Solaris*, Linux, ...
“Format Type is to File System”
  ext2, ext3, vfat, ntfs, jffs2, …
Particular Partition Types support only Particular File
System Types
              © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   11
                             All Rights Reserved.
Design a FS
Let's Take 1 Partition
With 16 blocks of 2 sectors each
Size = 16 x 2 x 512 bytes = 16KB
Given 3 data pieces
  Source Code – 2.5KB
  Image – 8KB
  Document – 2KB
Place optimally for further operations
         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   12
                        All Rights Reserved.
Kernel Space File System




© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   13
               All Rights Reserved.
Kernel Space File System
Has 2 Roles to Play
  Decode the Hardware FS Layout to access data (by
  implementing your logic in s/w)
  Interface that with the User Space FS to give you a
  unified view, as you all see at /
First part: ext2, ext3, vfat, ntfs, jffs2, …
  Also called the File System modules
Second part: VFS
  Kernel provides VFS to achieve the virtual user view
  So, FS module should actually interact with VFS

           © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   14
                          All Rights Reserved.
Linux specific File Systems
Initial Linux: Minix FS
As Linux matured: Extended (ext) FS
1994: Second Extended (ext2) FS
Latest: Third Extended (ext3) FS
Features Introduced:
  Access Control Lists (ACL)
  Block Fragmentation
  Logical Deletion
  Journaling
          © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   15
                         All Rights Reserved.
Linux FS Data Structures
Super block – Stores filesystem meta data
Inode – Stores file meta data
Directory Entry – Stores file name & inode
number
Inode & Data block Bitmap – Bitmap for
tracking usage status of the various
blocks
Group Entry – Stores information of
groups of Data Storage
        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   16
                       All Rights Reserved.
Linux FS Transitions
Choosing Optimal Block Size (from 1KiB to
4KiB), depending on the expected average file
length
Choosing Number of Inodes
Partition Groups: Each group includes Data
Blocks and Inodes stored in adjacent tracks
Preallocating Disk Data Blocks to Regular Files
Fast Symbolic Links


         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   17
                        All Rights Reserved.
File System related Commands
File and Inode information – stat
Hardlinks and Softlinks – ln & ln -s
Mounting filesystem – mount & umount
Creating special files – mknod, mkfifo
Permission related – chmod
Ownership related – chown, chgrp
Timestamp related – touch

         © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   18
                        All Rights Reserved.
Case Study: ext2/ext3




© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   19
               All Rights Reserved.
ext2/ext3: Disk Data Structure

            Boot
                         Block group 0             ...     Block group n
            block




Super   Group            Data block      Inode           Inode
                                                                         Data blocks
block Descriptors         Bitmap        Bitmap           Table
1 block   n blocks         1 block       1 block         n blocks          n blocks


  Superblock and Group Descriptors are
  duplicated in each Block Group
  Superblock and Group Descriptors in
  Block Group 0 are used by the kernel
                     © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>                 20
                                    All Rights Reserved.
ext2/ext3: Superblock

unsigned long s_frag_size; /* Size of a fragment in bytes */
unsigned long s_frags_per_block; /* Number of fragments per block */
unsigned long s_inodes_per_block; /* Number of inodes per block */
unsigned long s_frags_per_group; /* Number of fragments in a group */
unsigned long s_blocks_per_group; /* Number of blocks in a group */
unsigned long s_inodes_per_group; /* Number of inodes in a group */
unsigned long s_itb_per_group; /* Number of inode table blocks per group */
unsigned long s_gdb_count; /* Number of group descriptor blocks */
unsigned long s_desc_per_block; /* Number of group descriptors per block */
unsigned long s_groups_count; /* Number of groups in the fs */
...
                   © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>          21
                                  All Rights Reserved.
ext2/ext3: Group Descriptor

__le32 bg_block_bitmap; /* Blocks bitmap block number */
__le32 bg_inode_bitmap; /* Inodes bitmap block number */
__le32 bg_inode_table; /* Inodes table first block number */
__le16 bg_free_blocks_count; /* Free blocks in the group */
__le16 bg_free_inodes_count; /* Free inodes in the group */
__le16 bg_used_dirs_count; /* Directories in the group */
__le16 bg_pad; /* Alignment to word */
__le32 bg_reserved[3]; /* Nulls to pad out 24 bytes */



                 © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   22
                                All Rights Reserved.
ext2/ext3: Inode Entry
Inode Table consists of Inode Entries. An Inode Entry is as follows
  __le16 i_mode; /* File type & access rights */
  __le16 i_uid; /* Low 16 bits of owner uid */
  __le32 i_size; /* File size in bytes */
  __le32 i_atime; /* Last file access time */
  __le32 i_ctime; /* File creation time */
  __le32 i_mtime; /* Last file contents modification time */
  __le32 i_dtime; /* File deletion time */
  __le16 i_gid; /* Low 16 bits of group id */
  __le16 i_links_count; /* Hard links counter */
  __le32 i_blocks; /* Number of data blocks of the file */
  __le32 i_flags; /* File flags */
  union osd1; /* OS specific information */
  __le32 i_block[12 + 3]; /* Pointers to data blocks */
  ...

                    © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   23
                                   All Rights Reserved.
ext2/ext3: File Types
File Types supported
File Type Value            Description
0                          Unknown
1                          Regular
2                          Directory
3                          Character Device
4                          Block Device
5                          Named Pipe
6                          Socket
7                          Symbolic Link




                  © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   24
                                 All Rights Reserved.
ext2/ext3: Directory Entry
Directory is a File, with Data Blocks
containing Directory Entries
A Directory Entry is as follows
  __le32 inode; /* Inode number */
  __le16 rec_len; /* Directory entry length */
  __u8 name_len; /* Name length */
  __u8 file_type; /* File type */
  char name[255]; /* File name */

          © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   25
                         All Rights Reserved.
Virtual File System




© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   26
               All Rights Reserved.
VFS Specifics
Inherited from the Linux specific FS
Promoted to a super set of various FS
Provides a unified view to the User
Default values for various attributes
  owner, group, permissions, …
File Types
  Same seven types as in ext2/ext3


        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   27
                       All Rights Reserved.
Virtual File System Interactions

                User Space File System View @ /




                                 VFS




         ....         ext2        ....      vfat         ....




     Partition 0   Partition 1    ...    Partition N     ...



          © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>     28
                         All Rights Reserved.
Virtual File System Internals
                         d

                         r
   Super Block
                                                           Directory Entry Table
                             Inode Table

> FS Meta Data
> Root Inode Number
                                                           > File Name
                                                           > Inode Number
                         > File Meta Data
                         > File Data Block Nos

                                                            Data Block



                 © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>                 29
                                All Rights Reserved.
Recall: User Space File System




   © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   30
                  All Rights Reserved.
/ & the System Directories
/bin, /sbin - system binaries/applications
/var    - logs, mails
/proc, /sys - “virtual” windows into the kernel
/etc    - configuration files
/lib    - shared system libraries
/dev    - device files
/boot - Linux kernel and boot related binary files
/opt    - for third-party packages
/root, /home - home directory for super user & other users
/usr    - user space related files and dirs (binaries, libraries, ...)
/tmp - scratch pad
/mnt - mount points
                © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>        31
                               All Rights Reserved.
What all have we learnt?
W's of a File System
Three Levels of File System
  Hardware Space
  Kernel Space
  User Space




        © 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   32
                       All Rights Reserved.
Any Queries?




© 2010 Anil Kumar Pugalia <email@sarika-pugs.com>   33
               All Rights Reserved.

More Related Content

What's hot

Unix OS & Commands
Unix OS & CommandsUnix OS & Commands
Unix OS & Commands
Mohit Belwal
 
Linux scheduler
Linux schedulerLinux scheduler
Linux scheduler
Liran Ben Haim
 
Linux file system
Linux file systemLinux file system
Linux file system
Md. Tanvir Hossain
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
Geeks Anonymes
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchy
sritolia
 
Linux commands
Linux commandsLinux commands
Linux commands
penetration Tester
 
Linux commands
Linux commandsLinux commands
Linux commands
Balakumaran Arunachalam
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
Nishant Munjal
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Ahmed El-Arabawy
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
MAGNA COLLEGE OF ENGINEERING
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
SHUBHA CHATURVEDI
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
Wave Digitech
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Goutam Sahoo
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
Nikhil Jain
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
sureskal
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
Mohammad Rafiee
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
VIKAS TIWARI
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
Tushar B Kute
 
Linux
Linux Linux
Linux
Kevin James
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
abclearnn
 

What's hot (20)

Unix OS & Commands
Unix OS & CommandsUnix OS & Commands
Unix OS & Commands
 
Linux scheduler
Linux schedulerLinux scheduler
Linux scheduler
 
Linux file system
Linux file systemLinux file system
Linux file system
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchy
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1)
 
Basic 50 linus command
Basic 50 linus commandBasic 50 linus command
Basic 50 linus command
 
Shell and its types in LINUX
Shell and its types in LINUXShell and its types in LINUX
Shell and its types in LINUX
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Linux
Linux Linux
Linux
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 

Viewers also liked

History Of Linux
History Of LinuxHistory Of Linux
History Of Linux
anand09
 
Hadoop introduction 2
Hadoop introduction 2Hadoop introduction 2
Hadoop introduction 2
Tianwei Liu
 
Scraping the web with python
Scraping the web with pythonScraping the web with python
Scraping the web with python
Jose Manuel Ortega Candel
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
 
Tutorial on Web Scraping in Python
Tutorial on Web Scraping in PythonTutorial on Web Scraping in Python
Tutorial on Web Scraping in Python
Nithish Raghunandanan
 
Chapter 21 - The Linux System
Chapter 21 - The Linux SystemChapter 21 - The Linux System
Chapter 21 - The Linux System
Wayne Jones Jnr
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
onu9
 
Linux ppt
Linux pptLinux ppt
Linux ppt
lincy21
 
Big Data & Hadoop Tutorial
Big Data & Hadoop TutorialBig Data & Hadoop Tutorial
Big Data & Hadoop Tutorial
Edureka!
 
Web Scraping with Python
Web Scraping with PythonWeb Scraping with Python
Web Scraping with Python
Paul Schreiber
 

Viewers also liked (11)

History Of Linux
History Of LinuxHistory Of Linux
History Of Linux
 
Mr
MrMr
Mr
 
Hadoop introduction 2
Hadoop introduction 2Hadoop introduction 2
Hadoop introduction 2
 
Scraping the web with python
Scraping the web with pythonScraping the web with python
Scraping the web with python
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Tutorial on Web Scraping in Python
Tutorial on Web Scraping in PythonTutorial on Web Scraping in Python
Tutorial on Web Scraping in Python
 
Chapter 21 - The Linux System
Chapter 21 - The Linux SystemChapter 21 - The Linux System
Chapter 21 - The Linux System
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Big Data & Hadoop Tutorial
Big Data & Hadoop TutorialBig Data & Hadoop Tutorial
Big Data & Hadoop Tutorial
 
Web Scraping with Python
Web Scraping with PythonWeb Scraping with Python
Web Scraping with Python
 

Similar to Linux File System

Block Drivers
Block DriversBlock Drivers
Block Drivers
Anil Kumar Pugalia
 
File System Modules
File System ModulesFile System Modules
File System Modules
Anil Kumar Pugalia
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
Shu-Yu Fu
 
File System Modules
File System ModulesFile System Modules
File System Modules
Anil Kumar Pugalia
 
Embedded Storage Management
Embedded Storage ManagementEmbedded Storage Management
Embedded Storage Management
Anil Kumar Pugalia
 
Linux
LinuxLinux
Linux
keydak11
 
pptdisk
pptdiskpptdisk
Case study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File systemCase study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File system
Kumar Amit Mehta
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
Anil Kumar Pugalia
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
Anil Kumar Pugalia
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
Anil Kumar Pugalia
 
Linux - Introduction
Linux - IntroductionLinux - Introduction
Linux - Introduction
Shashank Chintalagiri
 
Embedded I/O Management
Embedded I/O ManagementEmbedded I/O Management
Embedded I/O Management
Anil Kumar Pugalia
 
Feature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with EncryptionFeature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with Encryption
LF Events
 
Next generation storage: eliminating the guesswork and avoiding forklift upgrade
Next generation storage: eliminating the guesswork and avoiding forklift upgradeNext generation storage: eliminating the guesswork and avoiding forklift upgrade
Next generation storage: eliminating the guesswork and avoiding forklift upgrade
Jisc
 
제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre
Tommy Lee
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
Anil Kumar Pugalia
 
Btrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current StatusBtrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current Status
Lukáš Czerner
 
Root file system
Root file systemRoot file system
Root file system
Bindu U
 
10 Tips for AIX Security
10 Tips for AIX Security10 Tips for AIX Security
10 Tips for AIX Security
HelpSystems
 

Similar to Linux File System (20)

Block Drivers
Block DriversBlock Drivers
Block Drivers
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
 
File System Modules
File System ModulesFile System Modules
File System Modules
 
Embedded Storage Management
Embedded Storage ManagementEmbedded Storage Management
Embedded Storage Management
 
Linux
LinuxLinux
Linux
 
pptdisk
pptdiskpptdisk
pptdisk
 
Case study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File systemCase study of BtrFS: A fault tolerant File system
Case study of BtrFS: A fault tolerant File system
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Mobile Hacking using Linux Drivers
Mobile Hacking using Linux DriversMobile Hacking using Linux Drivers
Mobile Hacking using Linux Drivers
 
Linux - Introduction
Linux - IntroductionLinux - Introduction
Linux - Introduction
 
Embedded I/O Management
Embedded I/O ManagementEmbedded I/O Management
Embedded I/O Management
 
Feature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with EncryptionFeature rich BTRFS is Getting Richer with Encryption
Feature rich BTRFS is Getting Richer with Encryption
 
Next generation storage: eliminating the guesswork and avoiding forklift upgrade
Next generation storage: eliminating the guesswork and avoiding forklift upgradeNext generation storage: eliminating the guesswork and avoiding forklift upgrade
Next generation storage: eliminating the guesswork and avoiding forklift upgrade
 
제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre제3회난공불락 오픈소스 인프라세미나 - lustre
제3회난공불락 오픈소스 인프라세미나 - lustre
 
Character Drivers
Character DriversCharacter Drivers
Character Drivers
 
Btrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current StatusBtrfs: Design, Implementation and the Current Status
Btrfs: Design, Implementation and the Current Status
 
Root file system
Root file systemRoot file system
Root file system
 
10 Tips for AIX Security
10 Tips for AIX Security10 Tips for AIX Security
10 Tips for AIX Security
 

More from Anil Kumar Pugalia

Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
Anil Kumar Pugalia
 
Processes
ProcessesProcesses
System Calls
System CallsSystem Calls
System Calls
Anil Kumar Pugalia
 
Embedded C
Embedded CEmbedded C
Embedded C
Anil Kumar Pugalia
 
Embedded Software Design
Embedded Software DesignEmbedded Software Design
Embedded Software Design
Anil Kumar Pugalia
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
Anil Kumar Pugalia
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
Anil Kumar Pugalia
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
Anil Kumar Pugalia
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
Anil Kumar Pugalia
 
References
ReferencesReferences
References
Anil Kumar Pugalia
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISP
Anil Kumar Pugalia
 
Power of vi
Power of viPower of vi
Power of vi
Anil Kumar Pugalia
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
Anil Kumar Pugalia
 
"make" system
"make" system"make" system
"make" system
Anil Kumar Pugalia
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
Anil Kumar Pugalia
 
RPM Building
RPM BuildingRPM Building
RPM Building
Anil Kumar Pugalia
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
Anil Kumar Pugalia
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
Anil Kumar Pugalia
 
System Calls
System CallsSystem Calls
System Calls
Anil Kumar Pugalia
 
Timers
TimersTimers

More from Anil Kumar Pugalia (20)

Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Processes
ProcessesProcesses
Processes
 
System Calls
System CallsSystem Calls
System Calls
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Embedded Software Design
Embedded Software DesignEmbedded Software Design
Embedded Software Design
 
Playing with R L C Circuits
Playing with R L C CircuitsPlaying with R L C Circuits
Playing with R L C Circuits
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
References
ReferencesReferences
References
 
Functional Programming with LISP
Functional Programming with LISPFunctional Programming with LISP
Functional Programming with LISP
 
Power of vi
Power of viPower of vi
Power of vi
 
gcc and friends
gcc and friendsgcc and friends
gcc and friends
 
"make" system
"make" system"make" system
"make" system
 
Hardware Design for Software Hackers
Hardware Design for Software HackersHardware Design for Software Hackers
Hardware Design for Software Hackers
 
RPM Building
RPM BuildingRPM Building
RPM Building
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
 
Linux Network Management
Linux Network ManagementLinux Network Management
Linux Network Management
 
System Calls
System CallsSystem Calls
System Calls
 
Timers
TimersTimers
Timers
 

Recently uploaded

RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
RaminGhanbari2
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptxDublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Kunal Gupta
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
ssuser1915fe1
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024
aakash malhotra
 
CHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSE
CHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSECHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSE
CHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSE
kumarjarun2010
 
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
Priyanka Aash
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
digitalxplive
 
Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...
chetankumar9855
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
bhumivarma35300
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
Adam Dunkels
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 

Recently uploaded (20)

RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptxDublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
Dublin_mulesoft_meetup_Mulesoft_Salesforce_Integration (1).pptx
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024
 
CHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSE
CHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSECHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSE
CHAPTER-8 COMPONENTS OF COMPUTER SYSTEM CLASS 9 CBSE
 
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
The Rise of AI in Cybersecurity How Machine Learning Will Shape Threat Detect...
 
Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...Amul milk launches in US: Key details of its new products ...
Amul milk launches in US: Key details of its new products ...
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
High Profile Girls call Service Pune 000XX00000 Provide Best And Top Girl Ser...
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 

Linux File System

  • 1. Linux File System © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> All Rights Reserved.
  • 2. What to Expect? W's of a File System Three Levels of File System © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 2 All Rights Reserved.
  • 3. What is a File System? Mechanism of Organizing our Data Labelling by Names, Easy Access, ... Algorithm to Achieve the Desired Organization Ability to Store, Retrieve, Search, Sort, ... Data Structures to Achieve the Desired Performance © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 3 All Rights Reserved.
  • 4. Why we need a File System? Preserve Data for Later Access Update Discard Tag Data for Categorizing Easy & Fast Lookup Fast & Reliable Data Management by Optimized Operations © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 4 All Rights Reserved.
  • 5. File System Decoded Three things at three levels Hardware Space – The Physical Organization of Data on the Storage Devices Kernel Space – Drivers to decode & access the data from the Physical Organization User Space – All what you see from / - The User View Which ever it be, it basically does Organize our data For easy access by tagging For fast maintenance by optimizing © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 5 All Rights Reserved.
  • 6. Hardware Space File System © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 6 All Rights Reserved.
  • 7. The Hard Disk Tracks Sectors Disk or Platter © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 7 All Rights Reserved.
  • 8. The Hard Disk Spindle Heads . . Cylinder . . . . © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 8 All Rights Reserved.
  • 9. Understanding a Hard Disk Example (Hard Disk) Heads (or Platters): 0 – 9 Tracks (or Cylinders): 0 – 24 Sectors: 1 – 64 Size of the Hard Disk 10 x 25 x 64 x 512 bytes = 8000KiB Device independent numbering (h, t, s) → 64 * (10 * t + h) + s → (1 - 16000) © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 9 All Rights Reserved.
  • 10. Partitioning a Hard Disk First Sector – Master Boot Record (MBR) Contains Boot Info Contains Physical Partition Table Maximum Physical Partitions: 4 At max 1 as Extended Partition Rest as Primary Partition Extended could be further partitioned into Logical Partitions In each partition First Sector – Boot Record (BR) Remaining for File System / Format Extended Partition BR contains the Logical Partition Table © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 10 All Rights Reserved.
  • 11. Placement of a Hardware FS Each Partition contains a File System Raw (no FS) Organized Organized one is initialized by the corresponding Formating “Partition Type is to OS” W95*, DOS*, BSD*, Solaris*, Linux, ... “Format Type is to File System” ext2, ext3, vfat, ntfs, jffs2, … Particular Partition Types support only Particular File System Types © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 11 All Rights Reserved.
  • 12. Design a FS Let's Take 1 Partition With 16 blocks of 2 sectors each Size = 16 x 2 x 512 bytes = 16KB Given 3 data pieces Source Code – 2.5KB Image – 8KB Document – 2KB Place optimally for further operations © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 12 All Rights Reserved.
  • 13. Kernel Space File System © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 13 All Rights Reserved.
  • 14. Kernel Space File System Has 2 Roles to Play Decode the Hardware FS Layout to access data (by implementing your logic in s/w) Interface that with the User Space FS to give you a unified view, as you all see at / First part: ext2, ext3, vfat, ntfs, jffs2, … Also called the File System modules Second part: VFS Kernel provides VFS to achieve the virtual user view So, FS module should actually interact with VFS © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 14 All Rights Reserved.
  • 15. Linux specific File Systems Initial Linux: Minix FS As Linux matured: Extended (ext) FS 1994: Second Extended (ext2) FS Latest: Third Extended (ext3) FS Features Introduced: Access Control Lists (ACL) Block Fragmentation Logical Deletion Journaling © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 15 All Rights Reserved.
  • 16. Linux FS Data Structures Super block – Stores filesystem meta data Inode – Stores file meta data Directory Entry – Stores file name & inode number Inode & Data block Bitmap – Bitmap for tracking usage status of the various blocks Group Entry – Stores information of groups of Data Storage © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 16 All Rights Reserved.
  • 17. Linux FS Transitions Choosing Optimal Block Size (from 1KiB to 4KiB), depending on the expected average file length Choosing Number of Inodes Partition Groups: Each group includes Data Blocks and Inodes stored in adjacent tracks Preallocating Disk Data Blocks to Regular Files Fast Symbolic Links © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 17 All Rights Reserved.
  • 18. File System related Commands File and Inode information – stat Hardlinks and Softlinks – ln & ln -s Mounting filesystem – mount & umount Creating special files – mknod, mkfifo Permission related – chmod Ownership related – chown, chgrp Timestamp related – touch © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 18 All Rights Reserved.
  • 19. Case Study: ext2/ext3 © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 19 All Rights Reserved.
  • 20. ext2/ext3: Disk Data Structure Boot Block group 0 ... Block group n block Super Group Data block Inode Inode Data blocks block Descriptors Bitmap Bitmap Table 1 block n blocks 1 block 1 block n blocks n blocks Superblock and Group Descriptors are duplicated in each Block Group Superblock and Group Descriptors in Block Group 0 are used by the kernel © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 20 All Rights Reserved.
  • 21. ext2/ext3: Superblock unsigned long s_frag_size; /* Size of a fragment in bytes */ unsigned long s_frags_per_block; /* Number of fragments per block */ unsigned long s_inodes_per_block; /* Number of inodes per block */ unsigned long s_frags_per_group; /* Number of fragments in a group */ unsigned long s_blocks_per_group; /* Number of blocks in a group */ unsigned long s_inodes_per_group; /* Number of inodes in a group */ unsigned long s_itb_per_group; /* Number of inode table blocks per group */ unsigned long s_gdb_count; /* Number of group descriptor blocks */ unsigned long s_desc_per_block; /* Number of group descriptors per block */ unsigned long s_groups_count; /* Number of groups in the fs */ ... © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 21 All Rights Reserved.
  • 22. ext2/ext3: Group Descriptor __le32 bg_block_bitmap; /* Blocks bitmap block number */ __le32 bg_inode_bitmap; /* Inodes bitmap block number */ __le32 bg_inode_table; /* Inodes table first block number */ __le16 bg_free_blocks_count; /* Free blocks in the group */ __le16 bg_free_inodes_count; /* Free inodes in the group */ __le16 bg_used_dirs_count; /* Directories in the group */ __le16 bg_pad; /* Alignment to word */ __le32 bg_reserved[3]; /* Nulls to pad out 24 bytes */ © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 22 All Rights Reserved.
  • 23. ext2/ext3: Inode Entry Inode Table consists of Inode Entries. An Inode Entry is as follows __le16 i_mode; /* File type & access rights */ __le16 i_uid; /* Low 16 bits of owner uid */ __le32 i_size; /* File size in bytes */ __le32 i_atime; /* Last file access time */ __le32 i_ctime; /* File creation time */ __le32 i_mtime; /* Last file contents modification time */ __le32 i_dtime; /* File deletion time */ __le16 i_gid; /* Low 16 bits of group id */ __le16 i_links_count; /* Hard links counter */ __le32 i_blocks; /* Number of data blocks of the file */ __le32 i_flags; /* File flags */ union osd1; /* OS specific information */ __le32 i_block[12 + 3]; /* Pointers to data blocks */ ... © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 23 All Rights Reserved.
  • 24. ext2/ext3: File Types File Types supported File Type Value Description 0 Unknown 1 Regular 2 Directory 3 Character Device 4 Block Device 5 Named Pipe 6 Socket 7 Symbolic Link © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 24 All Rights Reserved.
  • 25. ext2/ext3: Directory Entry Directory is a File, with Data Blocks containing Directory Entries A Directory Entry is as follows __le32 inode; /* Inode number */ __le16 rec_len; /* Directory entry length */ __u8 name_len; /* Name length */ __u8 file_type; /* File type */ char name[255]; /* File name */ © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 25 All Rights Reserved.
  • 26. Virtual File System © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 26 All Rights Reserved.
  • 27. VFS Specifics Inherited from the Linux specific FS Promoted to a super set of various FS Provides a unified view to the User Default values for various attributes owner, group, permissions, … File Types Same seven types as in ext2/ext3 © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 27 All Rights Reserved.
  • 28. Virtual File System Interactions User Space File System View @ / VFS .... ext2 .... vfat .... Partition 0 Partition 1 ... Partition N ... © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 28 All Rights Reserved.
  • 29. Virtual File System Internals d r Super Block Directory Entry Table Inode Table > FS Meta Data > Root Inode Number > File Name > Inode Number > File Meta Data > File Data Block Nos Data Block © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 29 All Rights Reserved.
  • 30. Recall: User Space File System © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 30 All Rights Reserved.
  • 31. / & the System Directories /bin, /sbin - system binaries/applications /var - logs, mails /proc, /sys - “virtual” windows into the kernel /etc - configuration files /lib - shared system libraries /dev - device files /boot - Linux kernel and boot related binary files /opt - for third-party packages /root, /home - home directory for super user & other users /usr - user space related files and dirs (binaries, libraries, ...) /tmp - scratch pad /mnt - mount points © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 31 All Rights Reserved.
  • 32. What all have we learnt? W's of a File System Three Levels of File System Hardware Space Kernel Space User Space © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 32 All Rights Reserved.
  • 33. Any Queries? © 2010 Anil Kumar Pugalia <email@sarika-pugs.com> 33 All Rights Reserved.