Prerequisite – File Systems in Operating System
First Understand the structure of storage device HDD:
(i). Sector (ii). Track (iii). Track-Sector (iv). Cluster or Block
These are explained as following below in brief.
- (i). Sector:
This is a pie like structure from center of disk to circumference, the time require by read/write head to move from center of disk to circumference is called latency time.
- (ii). Track:
It is the circular path which is covered and tracked by r/w head.Its width depends on the head size of r/w head.
- (iii). Track-Sector:
This is the intersection of sector and the track, you can refer to the image to understand it better.
- (iv). Cluster:
Two or more track-sector are called clusters. It is the minimum unit used by OS to store data. Size of each cluster varies with its location in disk.All the clusters are not used to store a file.
Building Concept and Visualization:
- Tommy and Jonny:
Let’s assume we want a book called Data Structure and Algorithm from college library. Now you go to library computer (let’s name it Tommy) and find if this book really present in library or not. If this is in library than tell me the shelf-number where to find the book. And suppose you are with your friend (let’s name him Jonny) and if book exist you pass the shelf-number to your friend and ask him to bring the book for you.
Similarly, HDD also have Tommy known as BUFFER, this stores all the addresses and other attributes of different files and folders. Buffer helps you find anything on HDD with the help of Jonny that is read/write head.
This proves that we can’t interact directly to disk but indirectly using buffer.
Figure – HDD Structure
- Project Colleague:
Suppose you and your colleague are working on a project, you have a windows laptop and your colleague has mac book. He copied some project files in a pen drive and shared to you. But problem is that you are unable to see data on the pen drive.
- How is it possible ?
- What could possibly be wrong ?
- Is it a virus ?
- Pen drive is corrupted ?
No, nothing happened to your pen drive or no virus has affected the files. It is the file system. Mac OS uses HFS file system and Windows uses NTFS. So, you both have to came to a file system which is supported on both, which is FAT system.
How Buffer Stores Data or addresses ?
FILE ID FILE NAME ISFOLDER PARENT ADDRESS ATTRIBUTES 1 User 1 0 0 ….. 2 Documents 1 2 0 …. 3 Picture 1 2 0 …. 4 Resume.docx 0 3 0x1000 …. 5 Me.jpg 0 4 0x1500 ….
This format of storing files is called FAT (File Allocation Table) file system. This has further improved to FAT12, FAT16, FAT32. If you cut and paste files to other folder then the only attribute changed is the parent, which is pretty fast. But if you copy paste it takes time because it is stored at a new address.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.My Personal Notes arrow_drop_up
- Difference between Local File System (LFS) and Distributed File System (DFS)
- File System Implementation in Operating System
- Various Implicants in K-Map
- Inclusion-Exclusion and its various Applications
- Applications of various Automata
- Advantages and Disadvantages of various CPU scheduling algorithms
- Various Properties of context free languages (CFL)
- Advantages and Disadvantages of various Page Replacement algorithms
- Basic Laws for Various Arithmetic Operations
- Advantages and Disadvantages of various Disk scheduling algorithms
- Various Instructions for five stage Pipeline
- Allowed Functional Dependencies (FD) in Various Normal Forms (NF)
- I/O buffering and its Various Techniques
- Various implementations of Symbol Table
- File Systems in Operating System
- Difference between FAT32, exFAT, and NTFS File System
- Unix File System
- File Access Methods in Operating System
- File System Consistency Checker (FSCK)
- File System Inconsistency
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.