Monday, 31 August 2015

File System Basics


What is File System?

File system is set of rules which help us to organise our data in efficient ways, so what we can retrieve, store and do other operations on data in efficient way.

How we store information?

Information or data on disk or any other media is stored in the form of binary i.e. 0s and 1s.we try to keep relevant Information at same place so that it can be organised nicely. We call this block of data as a file.

How file is stored on Disk?

As we discuss file is stored in disk in the form of binary. i.e. sequence of 0s and 1s.
Let’s consider a scenario we are having 3 files:
File 1 with data 101011101010
File 2 with data 111100001110
File 3 with data 000111100001

Let’s keep this data on disk:





Only keeping this binary data on disk we can’t understand where my file starts and  file ends.

Introduction to Inode:

As we have seen only keeping binary data sequentially on disk won’t allow us to understand data.so we need some way to understand which binary data belongs to which file.one way of solving this problem is, we will maintain a data structure called inode. There will be one inode per file and which will maintain information related to file. Inode can contain information like position where file staring, position where file is ending, what is size of file and so on …


Introduction to Super Block:

Like same as files, we will be having multiple Inode present in our file system scattered over our disk.so we need other centralised data structure which will maintain this file system wide information.

So to solve this problem new data structure was introduced I.e. Super block.So super block will maintain information like, how many inode file system have, what is location of those. Apart from inode ‘s information super block also maintain overall file system wide information like how much space file system have, how much space is free etc.








Note:

Inode and super block is a convention of Linux (Unix based file system) , who follows just to simplify data organisation.

It’s not compulsory to follow this standard to organise data.We can develop our own ways of manipulating data (for e.g.. FAT organise data in different way).

But for sake of simplicity and to support various file system Linux follow this standard.

We can organise data in whichever way we want but while communicating with Linux we should provide data in above convention.

No comments:

Post a Comment