Red Hat Linux Reference Guide

Linux Introduction

VI-EDITOR

Process Management

Linux Installation

Disk Partitions & File System Management

Logical Volume Management - LVM

User & Group Administration

Package Management

Network File System - NFS

Domain Naming System - DNS

Apache HTTP Web Server

KickStart Installations

FTP server

BOOT PROCESS

Dynamic Host Configuration Protocol - DHCP

Job Scheduling

File Links

Swap Management

Log Management

Performance Management

Linux Troubleshooting

Linux Summary

Start Preparation Smartly

We have the collection to start prepartion smartly.

Start Assessment

Red Hat Linux Reference Guide

  DevOps Tech Hub

116 Followers

What is KickStart?


File System is a collection of  files and directories on a partition or disk. These files and directories are organized as hierarchical structure in the partition or disk.

  • File System is a method of storing the data in an organized fashion on the disk.
  • Every partition except Extended Partition should be assigned with some file system in order to make them store the data. Disk or partition needs to be formatted using any of the format types to  create it as File System.

File System Types(Disk Format Types):

  • Supported File Systems in Linux are ext2, ext3, ext4, vfat, etc.
  • ext type of file system is widely used  in Linux systems

Below table shows differences between ext2, ext3, and ext4 File Systems 


File System Mounting:-

  • Once disk or partition is  formated and  created as File System structure then it needs to be attached to the directory to use the File System to store the data. The directory attached to the File System is called as Mount Point. 
  • The mount point is the empty directory  in the currently accessible file system to which a additional file system is mounted.

Configuration 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 the File System to be mounted even after reboot, then you need to make an appropriate entry in this file.Only File Systems added to the /etc/fstab file will be mounted at every reboot.

File System Scenarios

Formatting a partition with ext4 filesystem

After creating a partition we need to assign some file system to it so that we can start storing the data into it. To format a partition the following syntax is used.

# mkfs.<file system type> <partition name>
#mkfs.ext4 /dev/sda1 (where sda1 is our newly created partition)

Likewise you can format the different partitions with different file systems like

#mkfs.ext3 /dev/sdb2
#mkfs.vfat /dev/sdb3

Even after formatting the partition we cannot add the data into the partition. In order to add the data in the partition it is required to be mounted.

Mounting a partition

Mounting is a procedure where we attach a directory to the file system. There are two types of Mounting which will be used in Linux or any UNIX.

  1. Temporary Mounting
  2. Permanent Mounting

Temporary Mounting:

In a temporary mount point we will create a directory and mount it, but this mount point will last only till the system is up, once it is rebooted the mounting will be lost.

#mount <device name> <directory name (mount point)>
#mount /dev/sdb1  /iwayQ

To View all the mounted partitions:

#mount

  • Now we have successfully mounted the partition we can access it and can store the data
  • To add the data access the mount point
#cd /iwayQ
echo "data" > /iwayQ/f1

How to unmount FS:

#umount <mount-dir>
#umount /iwayq   ;  verify  with  mount  cmd

Permanent Mounting:

Permanent mounting procedure is exactly same like temp mounting, but here we will update the /etc/fstab file with the mounting details, so that it will be mounted even after the system is reboot.

Steps To make a permanent mount point:

  • Make a directory or use an existing directory
  • Add entry in /etc/fstab file
  • Use mount –a command to check it is mounting. (mount –a will mount all the entry placed in /etc/fstab)

Here we will be using our existing /iwayq directory as mount point which is created previously.

#vi /etc/fstab
#mount -a


You can now access the directory and add, delete or modify the contents and can also unmount the file system at any point

Sometimes a directory reflects error while unmouting, the possible causes for it are

  • You are in the same directory and trying to unmount it. Check with pwd command
  • Some users are present in the directory and using the contents in it.
  • Check with fuser –cu /dev/sdb1

  • Check for the files which are open with lsof /dev/sdb1

  • Kill the open connections using fuser –ck  /iwayq/test  where test  is the file which is open.
  • Now you can use umount command to unmount the file system.

To view the usage information of mounted partition:

To view the usage information of mounted partition use the command df –h

To view the size of a file or directory:

To view the size of the file or directory uses the command du –h file or directory name.

Assigning label to the partition:

Assigning the label is giving some name to the partition. To assign label to the partition e2label command is used  

#e2label <partition name> <label> 
#e2label /dev/sdb1  iwayqdisk   

To check the label

#e2label /dev/sdb1


To list all the mounted partition along with their labels, use mount –l command

Mounting a partition using its label:

Mounting a /dev/sdb1 partition with its label iwayqdisk 

[root@iwayq]#mount LABEL=iwayqdisk /iwayq

Making a permanent mount point using label:

As we know that to make a permanent mount point, an entry has to be made in /etc/fstab file.

#vi  /etc/fstab

Now use mount –a command and verify it with mount command whether it is mounted or not.

Mounting a partition permanently with its block id (UUID):

To check the uuid of a partition use blkid /dev/sdb1 command.

  • Copy the uuid
  • Make an entry in /etc/fstab using UUID
  • Verify it with mount –a option

Now mount it with mount –a command and verify it with mount command


Previous Next