This post will help you to understand Disk Management in Linux and Understanding the Basic Concepts
If you are interested in learning, Request you to go through the below recommended tutorial.
DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
Disk Management in Linux - Understand the Basic Concepts
This article explains you the Disk management in Linux to understand the basic disk management concepts. Lets discuss about the partitioning, naming conventions, partition types, primary partitions, extended partitions, logical partitions, file systems.
In the next article, We explained you How to Create and Delete Partitions using fdisk in Linux.
What is Disk Partitioning?
Disk partitioning means, divide a single hard drive into many logical drives using partition editors such as fdisk, parted tools. Once a disk is divided into several partitions, directories and files of different categories may be stored in different partitions.
Many new Linux admins create only two partitions / (root) and swap for entire hard drive. so all other directories of linux like /usr, /var, /bin will be created under this /(root). Later on there may be a need to create new partition for these directories or for other mount points, So admins should be able to create a new partition manually using partition editors.
In Linux, partitions are represented by device files. These devices files are located in /dev. Some example files listed below.
[root@node1 ~]# ll /dev/
brw-rw---- 1 root disk 3, 0 May 5 1998 hda
brw-rw---- 1 root disk 8, 0 May 5 1998 sda
crw------- 1 root tty 4, 64 May 5 1998 ttyS0
Have a look on the first integer of two lines from the output, those starts with "b" for first two line which are block devices (hda and sda). In Linux, all disks are represented as block devices only.
Linux maintains the naming conventions for IDE drives and SCSI Disks.
1. IDE drives device names would be /dev/hda, /dev/hdb.
/dev/hda - "a" refers, its a first drive.
/dev/hdb - "b" refers, its a second drive.
/dev/hdc - "c" refers, its a third drive.
/dev/hdd - "d" refers, its a fourth drive.
2. SCSI Drives device names would be /dev/sda, /dev/sdb.
SCSI drives follow a similar pattern; They are represented by 'sd' instead of 'hd'.
/dev/sda - "a" refers, its a first drive.
/dev/sdb - "b" refers, its a second drive.
Once a drive has been partitioned, the partitions will be represented as numbers on the end of the names.
For example, lets assume that we have two IDE Drives with partitions as below.
/dev/hda1 - First partition of first drive.
/dev/hda2 - Second partition of first drive.
/dev/hdb1 - First partition of second drive.
/dev/hdb2 - Second partition of second drive.
This is all we have to know to deal with linux disk devices file.
1. Primary Partitions - The number of partitions was limited from the very beginning and we can have only four partitions. These partitions are now called primary partitions.
2. Extended Partitions - The extended partitions is a way to overcome the limitation of four primary partitions on a drive. If you want to have more than four partitions, You can put lots of Partitions inside it.
3. Logical Partitions - A logical partition is a a partition that has been created inside of an extended partition.
In linux, A partition is labeled to host a certain kind of file system.
What is Filesystem?
A filesystem is the methods and data structures that an operating system uses to keep track of files on a disk or partition; that is, the way the files are organized on the disk. The word is also used to refer to a partition or disk that is used to store the files or the type of the filesystem.
Such a file system could be the linux standard ext3 file system, ext4 filesystem, linux swap partitions or other filesystems. There is a numerical code associated with each things. For example, the code for linux filesystem is 0x83 and linux swap is 0x82. Run "/sbin/sfdisk -T" to see a list of partition types and their codes, execute /sbin/sfdisk -T
Hope you have got an idea about Disk Management in Linux from basics concepts.
Keep practicing and have fun. Leave your comments if any.
Support Us: Share with your friends and groups.
Stay connected with us on social networking sites, Thank you.
disk management in linux, linux disk management, linux disk management commands, disk management linux interview questions, linux disk management tutorial