Anatomy biomechanics & kinematics of the knee. Knee Anatomy.
Anatomy of file_system
Transcript of Anatomy of file_system
Anatomy of Filesystems..
Anatomy of Hardisks
“Platter” – A circular piece of magnetic material
Track 0
Track 1
“Tracks” – Platters divided into concentric circles
“Sector” – Each track is divided into sectors
Which store data, usually 512 bytesPlatter1,track0
Platter2,track0
Platter3,track0
Cylinder 0
Disk Controller.Does operations like read, write etc..
Read/Write Head 0
Read/Write data from Hardisk ?Read Cylinder
0,head 0,sector 0.
CHS Addressing
Anatomy of Communication
Hello
Communication in Humans:
Requirements:
• Speaker/Listener
• Voice/Language
• Medium: Air
Linda, Hello
• Addressing
Communicating with your Hardisk
Various communication standards exist to talk to our Harddisks:
Examples:• ATA• SCSI (Small Computer System Interface “Skuzzy”).
(NARROW SCSI)
Communication Requirements SCSI SpecificationSpeaker/Listener Initiator/Target Voice/Language SCSI Commands Medium SCSI Bus Addressing SCSI ID
SCSI Overview
CPUPCI -BusConverts:PCI -> SCSI
Initiator
Host Bus Adapter(HBA)8 Bit wide wires SCSI Bus
TargetID: 0
TargetID: 1
TargetID: 7
Logical Block Addressing (LBA) – A Data Addressing Standardization:
Track 0 Track 1Block 0/1 Block 2/3
Sector 0 Sector 1 Sector 0 Sector 1
SCSI Command
SCSI Communication in Action
OS:
CPU
Bus Adapter:Initiator
HBA: Give me Block 1, From Disk 0
Target Disk0ID 0
Hey, Disk 0, I Need your attention
Ok Bus, You have my attention
Thanks, READ LBA 2 for me
Ok, Here is LBA 2 Data: “Hello”Converts LBA 2 –> CHS 0/0/1
CPU: Your data “Hello”
CPU: Give me Block 1, from disk0
OS: your data, ”Hello”
FileSystems
Organize Scattered Data:
For FileSystems:
• Index(TOC) = Metadata
• Contents = Data
Visible part of Metadata:
FileSystems - Dig Deeper
FileSystem Blocks:
Sector 8
Block 8
Disk Block
SCSI Block (LBA)
FileSystem Block
Sector 0 Sector 1 Sector …
Block 0 Block 1 Block …
Block 0 (4Kb, Block size)
Fileystem layout on Disk:
Boot Block Block Group 0 Block Group… Block Group .. N
Block 0 Block 1 Block 2 Block 3 Block 4 Block N
FileSystems – Contd…
Block Group 0
Super Block
Group Descriptor Blocks..
InodeBlocks
Data Blocks … N
Block Groups:
Inodes :Every file or Directory will have a corresponding Inode, which contains information corresponding to the file or directory
Inode 1128 bytesInode 2
Inode …
Inode 32
Inode Block: OwnerMode (permission/Directory/File)
TimeStampAddress of 1st Data BlockAddress of 2nd Data Block
Address of Direct and Indirect Data Block
Entries in an Inode :
FileSystems – Contd…
OwnerMode (File)TimeStamp
Data Block 22Address of 2nd Data Block
Address of Direct and Indirect Data Block
File Inode :
Difference between file and directory Inode:
Hello World !
Data Block 22:
OwnerMode (Directory)
TimeStamp Data Block 50
Address of 2nd Data BlockAddress of Direct and Indirect Data Block
Directory Inode :
“File1” - 32“File2” - 36
Data Block 50:
FileSystems – Contd…
Free BlocksFree Inodes
Size Block Size etc..
SuperBlock :
Block Number of First InodeNo of free blocks in group
Group Descriptor :
Revisit the FileSystem Layout in Disk:
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
Inode1 Inode2 Inode3 Inode4 Inode5 Block1 Block2 Block3 Block4 Block5
Root Inode
Mode (Directory)
Data Block 1
“Test” – Inode(3)“Bin” – Inode(4)
Test Inode
Mode (Directory)
Data Block 2“a” – Inode(5)
A Inode
Mode (File)
Data Block 3
“hello world”