File System

File System

A file system is the underlying structure a computer uses to organize data on a hard disk. If you are installing a new hard disk, you need to partition and format it using a file system before you can begin storing data or programs.

Minix -           14 characters, 64MB of storage
Ext     -           Extended file system, 255 characters, 2GB of storage

When you’re going to format the Linux file system using  extend file system it will create blocks.

1). Master Block/Boot Block
2). Super Block
3). Inode Block
4). Data Block

  1. Master block entry is located at partition table, only boot partition contains master blocks data. Remaining partitions master blocks are empty.
  2. Super block just like an index to the book and it will holds to the information as follows

a.    Utilized inode numbers
b.    Free inode numbers
c.     Utilized data blocks
d.    Free data blocks 

            Super block holds all this information.

                    3. Inode table (index table) which holds all the information about files/directories like permissions, owner, group name, size and time stamps.

4096 bytes default block size

15 data blocks = inode

If data size is more than 100MB block size is 4096bytes. If data size is less than 100MB block size is 1024bytes.

Directory holds Inode number of file and file name

            4.    Data block storage of files

Table Now below is a very brief comparison of the most common file systems in use with the Linux world
File System
Max File Size
Max Partition Size
2 GB
2 GB
4 GB
8 TB
2 TB
256 TB
(For Windows Compatibility) NTFS-3g is installed by default in Ubuntu, allowing Read/Write support
2 TB
32 TB
2 TB
32 TB
Standard linux filesystem for many years. Best choice for super-standard installation.
16 TB
1 EB
Modern iteration of ext3. Best choice for new installations where super-standard isn't necessary.
8 TB
16 TB
No longer well-maintained.
Yes (metadata)
Created by IBM - Not well maintained.
8 EB
8 EB
Yes (metadata)
Created by SGI. Best choice for a mix of stability and advanced journaling.
GB = Gigabyte (1024 MB) :: TB = Terabyte (1024 GB) :: PB = Petabyte (1024 TB) :: EB = Exabyte (1024 PB)

A journaling file system is more reliable when it comes to data storage. Journaling file systems do not necessarily prevent corruption, but they do prevent inconsistency and are much faster at file system checks than non-journaled file systems. If a power failure happens while you are saving a file, the save will not complete and you end up with corrupted data and an inconsistent file system. Instead of actually writing directly to the part of the disk where the file is stored, a journaling file system first writes it to another part of the hard drive and notes the necessary changes to a log, then in the background it goes through each entry to the journal and begins to complete the task, and when the task is complete, it checks it off on the list. Thus the file system is always in a consistent state (the file got saved, the journal reports it as not completely saved, or the journal is inconsistent (but can be rebuilt from the file system)). Some journaling file systems can prevent corruption as well by writing data twice.

         |                                   |                             |
Writable more                      ordered more            journal

i.             Write block – metadata is stored in HDD
ii.            Ordered more – metadata and actual data
iii.          Journal will maintain more space to do journalling

Network File System (NFS):  A Network File System (NFS) allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.

SAMBA (SMB): Samba is a software it is used to share the file and printer between Linux to Windows vice verse

Creating Standard Partition: Disk partitioning is the act of dividing a hard disk drive (HDD) into multiple logical storage units referred to as partitions, to treat one physical disk drive as if it were multiple disks, so that a different file system can be used on each partition.

All the device files are stored in /dev/ directory. If your Hard disk is connected

                                                SATA DRIVE                                  IDE DRIVE
Primary master                   /dev/sda                                             /dev/hda
Primary slave                      /dev/sdb                                             /dev/hdb
Secondary master               /dev/sdc                                              /dev/hdc
Secondary slave                  /dev/sdd                                             /dev/hdd

# fdisk            - it is a utility used for creating, deleting, listing and checking partitions

In this situation i am using vmware environment so just added one disk 5GB in size to server.

# ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done         -            To scan new hardware changes.

In above image we can able to see new hard disk is found it does not have valid partitions

To create a partition we have to identify HDD name we can use fdisk utility to find.

# fdisk –l – to identify HDD name

In this case our disk name is /dev/sdb

# fdisk /dev/sdb

List the options using m option

: p        -    print the partition list in fdisk utility

n – to create a new partition

mention the partition type primary of extended.

Note: (one extended OR 3 Primary 1 Extended) if you create extended partition first you can’t able to create a one more partition in same disk. We can create 3 primary and 1 extended partition.

p for primary

enter the partition number (there is no partitions in our scenario entered 1)

if want to enter the space in first step then calculate cylinders (7.8MB*number)

if you want to provide the space using MB, KB and GB then just hit enter


Now see partition is created or not using p

To save the partition information :wq

To update partition information to kernel

# partprobe /dev/sdb – to update partition information to partition table without reboot

Partition created now we have to create a file system in partition

# mkfs.ext3 /dev/sdb1         - make file system in partition

After completion of creating a file system we have to mount the partition for use

Create a directory to mount # mkdir /arkit

# mount /dev/sdb1 /arkit    - to mount the file system

To check filee system size # df –h            - check file system size

Note: SATA and SCSI we can create a 15 partitions and IDE 64 partitions only

To access partition of windows in linux

#mount –t vfat /dev/hdax /mnt

in order to check the label of any partition

#e2label /dev/hdax

where x is number

Mounting CD Rom 

# mount –t auto /dev/hdc /media/cdrom

-t : file type

auto : file type

in order to check where cdrom is attached we can open the file fstab

#vi /etc/fstab

now in case of RHEl 3.0 we have to use command in order to unmount.
# umount /media/cdrom

and then eject the cdrom in case of RHEL 4.0 we simply type
# eject

Mounting Floppy
#mount –t auto /dev/fd0 /media/floppy
in case of floppy we have to umount first then only we remove floppy otherwise all content of floppy may be lost or floppy may be physically damaged.
# umount  /media/floppy

Permanent mount file system we have to edit /etc/fstab/ file.

add the entry as mentioned in above screenshot

# mount –a   - to verify mentioned entry is correct, if not it will give you error message

# e2label /dev/sdb1 RAVI  - to add label to partition

# e2label /dev/sdb1  - to check disk label


            Deleting the partition will lead to lose the important data

Remove the entry from /etc/fstab if it is mounted as permanent

# fdisk /dev/sdb


If you have more than one partition it will ask for the partition id


# partprobe /dev/sdb

# fdisk –l /dev/sdb 

Extending the Swap:

Create a partition

            Change the partition type ID to 82 using t option in fdisk utility

# mkswap /dev/sdb2            - it will format in swap file system

# free  -           to check swap size

Options:       -m in MB format
                      -G in GB format

# swapon /dev/sdb2 – in your case it may different.

To make permanent mount of swap file system edit the /etc/fstab file and add the entry

# mount –a   - to refresh the /etc/fstab mounts