Linux File System

File System

a) Super block: In file system superblock contains information (such as FS Size, status, FS type, metadata) about file system.

b) Block: Block is area in file system where data will stored. By default block size 4Kb. Every block contain data block and Inode table. Minimum block size is 512bytes.

  • Data Block: In Linux File system every block is logically divided into two parts, Data block and Inode table. In data block usually data will be stored.
  • Inode Table: It contains information about the file. (Size of file, Device ID, UID & GID of the file, time stamp, link counter, pointer to the data block). Note: Whenever file is created linux kernel will assign unique available inode number from its file syste use commands are df –I, ls –I, stat.

c) Backup block: When we create file system, it creates blocks and superblocks. Superblocks are very important to any FS, because it contains information about FS. If superblocks are corrupted FS won’t be accessible. Hence we have to make sure that file system should maintain copy (by default 8 copy) of superblock, also known as backup block.

d) Journal: A journaling filesystem is a FS that maintains a special file called a journal that is used to repair any inconsistencies that occur as the result of an improper shutdown of a computer. Such shutdowns are usually due to an interruption of the power supply or to a software problem that cannot be resolved without a rebooting.

e) Fragmentation: fragmentation is a phenomenon in which storage space is used inefficiently, reducing capacity or performance and often both. The exact consequences of fragmentation depend on the specific system of storage allocation in use and the particular form of fragmentation. In many cases, fragmentation leads to storage space being “wasted”, and in that case the term also refers to the wasted space itself.

f) Defragmentation: Is the process of reduce the fragmented space. In defragmentation process it reallocate the data in contiguous form so that disk can reduce seek time and faster access. It also creates free space.

 Commands: mkfs, mke2fs, mount, findmnt, df, lsof, fuser, dumpe2fs, blockdev

  • # blockdev –getbsz /dev/xvda1


Types Of File System

Ext2 FS
File size 16GB to 2TB
FS size 2TB to 32 TB

Ext3 FS
File size 16GB to 2TB
FS size 2TB to 32 TB

There are three types of journal 1) Journal –Metadata and content are stored in journal 2) Ordered- Only metadata is saved in journal. Metadata are journaled only after writing content to the disk. 3) Write Back- Only metadata is saved in journal. Metadata might be journaled either before or after the content written to the disk.

You can convert ext2 to ext3 without backup and restore.

Ext4 FS
File size 16GB to 16TB
FS size 1 EB (Exabyte) 1EB=1024PB
Directory can contain 64000 sub directory
You can turn off journal

Be the first to comment on "Linux File System"

Leave a comment

Your email address will not be published.