Managing Partitions & File System

What is a partition?

Partitioning is a means to divide a single hard drive into many logical drives. A partition is a contiguous set of blocks on a drive that is treated as an independent disk. A partition table is an index that relates sections of the hard drive to partitions.

Why have multiple partitions?

  • Encapsulate your data. Since file system corruption is local to a partition, you stand to lose only some of your data if an accident
  • Increase disk space efficiency. You can format partitions with varying block sizes, depending on your usage. If your data is in a large number of small files (less than 1k) and your partition uses 4k sized blocks, you are wasting 3k for every file. In general, you waste on average one half of a block for every file, so matching block size to the average size of your files is important if you have many
  • Limit data growth. Runaway processes or maniacal users can consume so much disk space that the operating system no longer has room on the hard drive for its bookkeeping operations. This will lead to disaster. By segregating space, you ensure that things other than the operating system die when allocated disk space is exhausted.

M

B

R

 

 P

 

 

 P

 

 

 P

 

           EXTENDED

 

L

 

L

 

FREE

MBR = Master Boot Record
P= Primary Partition
EXTENDED= Extended Partition
L= Logical Partition
FREE= Free Space

The Structure of Disk Partition

  • On the disk where O/S is installed, will have the first partition as MBR.
  • MBR is a Master Boot Record, which contains two important utilities, IPL (Initial Program Loader) and PTI (Partition Table information)
  • IPL is responsible for booting the operating the system, because it contains the boot loader.
  • In earlier versions of Linux i.e. up to RHEL 4, the default boot loader was LILO (Linux Loader). But, since RHEL5 onwards it has been changed to GRub (Grand Unified Boot loader), which is far more superior to LILO
  • The PTI (Partition Table information) is the information about the number of partitions on the disk, sizes of the partition and types of partitions.

THE CRITERIA OF DISK PARTITIONING

  • Every disk can have only 3 Primary
  • Primary Partition is a partition that usually holds the operating system. Only one amongst the 3 primary partitions can be active which will be booted by MBR to load the operating
  • Extended Partition is a special type of primary partition which can be subdivided into multiple logical partitions. As there can be only 3 primary partitions per disk, and if the user is required to make further partitions then all the space remaining on the disk should be allocated to extended partition, which can be used to create the logical partitions later. There can be only one extended partition per
  • Logical partitions are the partitions that are created under the extended partition, all the space in the extended partition can be used to create any number of logical partitions.

Disk Identification
Different type of disks will be having different initials in Linux

  • IDE drive will be shown as /dev/hda
  • SCSI drive will be shown as /dev/sda
  • Virtual drive will be shown as /dev/vda

FILE SYSTEM:

  • It is method of storing the data in an organized fashion on the disk. Every partition on the disk except MBR and Extended partition should be assigned with some file system in order to make them store the data. File system is applied on the partition by formatting it with a particular type of file system.

Types of file systems used in RHEL 7:

  • The file systems supported in Linux are ext2, ext3 and in RHEL 7 ext4, vfat,
  • Ext file system is the widely used file system in Linux, whereas vfat is the file system to maintain a common storage between Linux and Windows ( in case of multiple o/s ‘

 

S.NO

EXT2

EXT3

EXT4

1.

Stands for Second Extended File System

Stands for Third Extended File System

Stands for Fourth Extended File System

2.

It was introduced in 1993

It was introduced in 2001

It was introduced in 2008.

3.

It does not have a journaling feature.

Supports Journaling Feature.

Supports Journaling Feature.

4.

Maximum File size can be

from 16 GB to 2 TB

Maximum File Size can be

from 16 GB to 2 TB

Maximum File Size can be from

16 GB to 16 TB

5.

Maximum ext2 file system size can be from 2 TB to 32 TB

Maximum ext3 file system size can be from 2 TB to 32 TB

The maximum ext4 file system size is 1 EB (Exabyte). 1 EB = 1024

PB (Petabyte). 1 PB = 1024 TB (Terabyte).

6.

Cannot convert ext file system to ext2.

You can convert an ext2 file system to ext3 file system directly                                        (without backup/restore).

All previous ext file systems can easily be converted into ext4 file system. You can also mount an existing ext3 f/s as ext4 f/s (without having to upgrade it).

Mounting:-
  • Attaching a directory to the file system in order to access the partition and its file system is known as mounting.
  • The mount point is the directory (usually an empty one) in the currently accessible file system to which a additional file system is mounted.
  • The /mnt directory exists by default on all Unix – like systems. It, or usually its sub directories (such as /mnt/floppy and /mnt/usb), are intended specifically for use as mount points for removable media such as CDROMs, USB key drives and floppy disks.

Files which is related to mounting in Linux:

  • /etc/mtab is a file which stores the information of all the currently mounted file systems; it is dynamic and keeps changing.
  • /etc/fstab is the file which is keeps information about the permanent mount point. If you want to make your mount point permanent, so that it will be mounted even after reboot, then you need to make an appropriate entry in this file.

Leave a Reply

Your email address will not be published. Required fields are marked *