SlideShare a Scribd company logo
1 of 13
Anatomy of Filesystems..
Anatomy of Hardisks


Track 1                                                   “Platter” – A circular piece of
                                                          magnetic material
                                                           “Tracks” – Platters divided into
                                                           concentric circles
                                                      Track 0

                                                         Read/Write Head 0

                                                                     Platter1,track0


Read/Write data from Hardisk ?                                       Platter2,track0         Cylinder 0
     Read Cylinder
       0,head 0,                                                     Platter3,track0
       sector 0.
                                                    Disk Controller.
    CHS Addressing
                                 bennojoy@gmail.com Does operations like read, write etc..
Anatomy of Communication

Communication in Humans:




                                                Requirements:

                                                • Speaker/Listener

                                                • Voice/Language

                                                • Medium: Air

                                                • Addressing




                           bennojoy@gmail.com
Communicating with your Hardisk


Various communication standards exist to talk to our Harddisks:




 Communication Requirements                        SCSI Specification
 Speaker/Listener                                  Initiator/Target

 Voice/Language                                    SCSI Commands

 Medium                                            SCSI Bus

 Addressing                                        SCSI ID

                              bennojoy@gmail.com
SCSI Overview
  Target                                Host Bus Adapter(HBA)
   ID: 0             8 Bit wide wires
  Target                 SCSI Bus             Converts:          PCI -Bus
                                              PCI -> SCSI                      CPU
   ID: 1                                       Initiator
  Target
   ID: 7

Logical Block Addressing (LBA) – A Data Addressing Standardization:
                      Block 0/1                                         Block 2/3
   Track 0                                             Track 1
          Sector 0           Sector 1                 Sector 0                 Sector 1
SCSI Command




                                        bennojoy@gmail.com
SCSI Communication in Action

          OS:      CPU: Give me Block 1, from disk0



        OS: your
        data, ”Hello”                 CPU         HBA: Give me Block 1, From Disk 0




        CPU: Your data “Hello”
                                   Bus Adapter:
                                     Initiator        Hey, Disk 0, I Need your attention
                                                   Thanks, READ LBA 2 for me



  Ok Bus, You have my attention
 Converts LBA 2 –> CHS 0/0/1        Target Disk0
Ok, Here is LBA 2 Data: “Hello”         ID 0
                                    bennojoy@gmail.com
FileSystems

Organize Scattered Data:




                                                   Visible part of Metadata:
For FileSystems:

• Index(TOC) = Metadata

• Contents = Data



                              bennojoy@gmail.com
FileSystems - Dig Deeper
FileSystem Blocks:


FileSystem Block                                         Block 0 (4Kb, Block size)
SCSI Block (LBA)                  Block 0               Block 1              Block …          Block 8
Disk Block                        Sector 0              Sector 1             Sector …         Sector 8

Fileystem layout on Disk:


 Boot
                       Block Group 0                     Block Group…             Block Group .. N
 Block



             Block 0    Block 1   Block 2    Block 3   Block 4     Block N




                                              bennojoy@gmail.com
FileSystems – Contd…
Block Groups:

                                       Block Group 0



         Super        Group Descriptor           Inode
                                                                     Data Blocks … N
         Block            Blocks..               Blocks


Inodes :
Every file or Directory will have a corresponding Inode, which contains information
corresponding to the file or directory                Entries in an Inode :
   Inode Block:                                                      Owner
      Inode 1                                           Mode (permission/Directory/File)
     128 bytes
                                                                   TimeStamp
      Inode 2
                                                            Address of 1st Data Block
      Inode …                                               Address of 2nd Data Block
     Inode 32                                        Address of Direct and Indirect Data Block

                                               bennojoy@gmail.com
FileSystems – Contd…
Difference between file and directory Inode:

 File Inode :                                                 Data Block 22:
                 Owner
                                                                Hello
               Mode (File)
                                                               World !
               TimeStamp
              Data Block 22
        Address of 2nd Data Block
 Address of Direct and Indirect Data Block
 Directory Inode :                                            Data Block 50:
                 Owner
            Mode (Directory)                                     “File1” - 32
               TimeStamp                                         “File2” - 36
              Data Block 50
        Address of 2nd Data Block
 Address of Direct and Indirect Data Block




                                         bennojoy@gmail.com
FileSystems – Contd…
SuperBlock :
                 Free Blocks
                Free Inodes
                     Size
               Block Size etc..
Group Descriptor :
        Block Number of First Inode
         No of free blocks in group

  Revisit the FileSystem Layout in Disk:




                                           bennojoy@gmail.com
FileSystem in Action
Listing Contents of a file:
                                                             • Read the inode entry of / (Root
                                                               directory)

                                                             • The root inode is fixed, inode entry 2
                                                               in the first inode block of the first
                                                               blockgroup
                           Test Inode
                        Mode (Directory)                                   “a” – Inode(5)
                          Data Block 2

         Root Inode
    Mode (Directory)                     A Inode                      “Test” – Inode(3)     “hello world”
                                        Mode (File)
                                                                      “Bin” – Inode(4)
         Data Block 1
                                    Data Block 3




Inode1        Inode2     Inode3         Inode4     Inode5   Block1       Block2   Block3    Block4   Block5
                                                 bennojoy@gmail.com
Thank You…



   Email: bennojoy@gmail.com


      bennojoy@gmail.com

More Related Content

What's hot

File management
File managementFile management
File managementMohd Arif
 
PC Software - Computer Application - Office Automation Tools
PC Software  -  Computer Application - Office Automation ToolsPC Software  -  Computer Application - Office Automation Tools
PC Software - Computer Application - Office Automation Toolszatax
 
Advanced file system (encrypt,compress,disk quota)
Advanced file system (encrypt,compress,disk quota)Advanced file system (encrypt,compress,disk quota)
Advanced file system (encrypt,compress,disk quota)Sanjeev Gupta
 
Computer lesson 7 files & folders
Computer lesson 7   files & foldersComputer lesson 7   files & folders
Computer lesson 7 files & folderscocon5
 

What's hot (8)

NTFS and Inode
NTFS and InodeNTFS and Inode
NTFS and Inode
 
File
FileFile
File
 
File management
File managementFile management
File management
 
PC Software - Computer Application - Office Automation Tools
PC Software  -  Computer Application - Office Automation ToolsPC Software  -  Computer Application - Office Automation Tools
PC Software - Computer Application - Office Automation Tools
 
Advanced file system (encrypt,compress,disk quota)
Advanced file system (encrypt,compress,disk quota)Advanced file system (encrypt,compress,disk quota)
Advanced file system (encrypt,compress,disk quota)
 
Computer lesson 7 files & folders
Computer lesson 7   files & foldersComputer lesson 7   files & folders
Computer lesson 7 files & folders
 
Linux lecture5
Linux lecture5Linux lecture5
Linux lecture5
 
Files
FilesFiles
Files
 

Similar to Anatomy of file_system

Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems senthilamul
 
北航云计算公开课03 google file system
北航云计算公开课03 google file system北航云计算公开课03 google file system
北航云计算公开课03 google file systemCando Zhou
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files pptAbhaysinh Surve
 
Lecture 14,15 and 16 file systems
Lecture 14,15 and 16  file systemsLecture 14,15 and 16  file systems
Lecture 14,15 and 16 file systemsRushdi Shams
 
File system performance
File system performanceFile system performance
File system performanceVijay Yadav
 
A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...
A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...
A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...CODE BLUE
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksZubair Nabi
 
Ch 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingCh 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingZainab Almugbel
 

Similar to Anatomy of file_system (10)

Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems Unix file systems 2 in unix internal systems
Unix file systems 2 in unix internal systems
 
北航云计算公开课03 google file system
北航云计算公开课03 google file system北航云计算公开课03 google file system
北航云计算公开课03 google file system
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files ppt
 
Lecture 14,15 and 16 file systems
Lecture 14,15 and 16  file systemsLecture 14,15 and 16  file systems
Lecture 14,15 and 16 file systems
 
File system performance
File system performanceFile system performance
File system performance
 
A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...
A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...
A Security Barrier Device That Can Protect Critical Data Regardless of OS or ...
 
AOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocksAOS Lab 9: File system -- Of buffers, logs, and blocks
AOS Lab 9: File system -- Of buffers, logs, and blocks
 
DBMS
DBMSDBMS
DBMS
 
Ch 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingCh 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashing
 
sheet 3 answers.docx
sheet 3 answers.docxsheet 3 answers.docx
sheet 3 answers.docx
 

Anatomy of file_system

  • 2. Anatomy of Hardisks Track 1 “Platter” – A circular piece of magnetic material “Tracks” – Platters divided into concentric circles Track 0 Read/Write Head 0 Platter1,track0 Read/Write data from Hardisk ? Platter2,track0 Cylinder 0 Read Cylinder 0,head 0, Platter3,track0 sector 0. Disk Controller. CHS Addressing bennojoy@gmail.com Does operations like read, write etc..
  • 3. Anatomy of Communication Communication in Humans: Requirements: • Speaker/Listener • Voice/Language • Medium: Air • Addressing bennojoy@gmail.com
  • 4. Communicating with your Hardisk Various communication standards exist to talk to our Harddisks: Communication Requirements SCSI Specification Speaker/Listener Initiator/Target Voice/Language SCSI Commands Medium SCSI Bus Addressing SCSI ID bennojoy@gmail.com
  • 5. SCSI Overview Target Host Bus Adapter(HBA) ID: 0 8 Bit wide wires Target SCSI Bus Converts: PCI -Bus PCI -> SCSI CPU ID: 1 Initiator Target ID: 7 Logical Block Addressing (LBA) – A Data Addressing Standardization: Block 0/1 Block 2/3 Track 0 Track 1 Sector 0 Sector 1 Sector 0 Sector 1 SCSI Command bennojoy@gmail.com
  • 6. SCSI Communication in Action OS: CPU: Give me Block 1, from disk0 OS: your data, ”Hello” CPU HBA: Give me Block 1, From Disk 0 CPU: Your data “Hello” Bus Adapter: Initiator Hey, Disk 0, I Need your attention Thanks, READ LBA 2 for me Ok Bus, You have my attention Converts LBA 2 –> CHS 0/0/1 Target Disk0 Ok, Here is LBA 2 Data: “Hello” ID 0 bennojoy@gmail.com
  • 7. FileSystems Organize Scattered Data: Visible part of Metadata: For FileSystems: • Index(TOC) = Metadata • Contents = Data bennojoy@gmail.com
  • 8. FileSystems - Dig Deeper FileSystem Blocks: FileSystem Block Block 0 (4Kb, Block size) SCSI Block (LBA) Block 0 Block 1 Block … Block 8 Disk Block Sector 0 Sector 1 Sector … Sector 8 Fileystem layout on Disk: Boot Block Group 0 Block Group… Block Group .. N Block Block 0 Block 1 Block 2 Block 3 Block 4 Block N bennojoy@gmail.com
  • 9. FileSystems – Contd… Block Groups: Block Group 0 Super Group Descriptor Inode Data Blocks … N Block Blocks.. Blocks Inodes : Every file or Directory will have a corresponding Inode, which contains information corresponding to the file or directory Entries in an Inode : Inode Block: Owner Inode 1 Mode (permission/Directory/File) 128 bytes TimeStamp Inode 2 Address of 1st Data Block Inode … Address of 2nd Data Block Inode 32 Address of Direct and Indirect Data Block bennojoy@gmail.com
  • 10. FileSystems – Contd… Difference between file and directory Inode: File Inode : Data Block 22: Owner Hello Mode (File) World ! TimeStamp Data Block 22 Address of 2nd Data Block Address of Direct and Indirect Data Block Directory Inode : Data Block 50: Owner Mode (Directory) “File1” - 32 TimeStamp “File2” - 36 Data Block 50 Address of 2nd Data Block Address of Direct and Indirect Data Block bennojoy@gmail.com
  • 11. FileSystems – Contd… SuperBlock : Free Blocks Free Inodes Size Block Size etc.. Group Descriptor : Block Number of First Inode No of free blocks in group Revisit the FileSystem Layout in Disk: bennojoy@gmail.com
  • 12. FileSystem in Action Listing Contents of a file: • Read the inode entry of / (Root directory) • The root inode is fixed, inode entry 2 in the first inode block of the first blockgroup Test Inode Mode (Directory) “a” – Inode(5) Data Block 2 Root Inode Mode (Directory) A Inode “Test” – Inode(3) “hello world” Mode (File) “Bin” – Inode(4) Data Block 1 Data Block 3 Inode1 Inode2 Inode3 Inode4 Inode5 Block1 Block2 Block3 Block4 Block5 bennojoy@gmail.com
  • 13. Thank You… Email: bennojoy@gmail.com bennojoy@gmail.com