How to Create an Extended Partition in Linux

How to create an Extended Partition in Linux


In our previous tutorial we have learned about the Linux Disk Management and also have learned the procedures that have to be followed before creating a partition, So here in this tutorial, we are going to learn about the extended partition and how to create the extended partition.

We know that in MBR partition scheme it allows us to create a maximum of 4 partitions only, in order to create more partition we have to choose the extended partition, from this extended partition we can create more logical partitions.(max 15 Logical partitions we can create).

Step:1 First Create three primary partitions, before that check the partition layout information by using the following command.


#fdisk  -l

 

From the above about its confirmed, the disk /dev/sdb is having  only one partition (/dev/sdb1)

Step:2 Create the second partition:


#fdisk  /dev/sdb

 

After giving the partition number, give the first available sector value or you can accept the default sector value by not entering any values(press enter), Give the last cylinder value the size of the partition in MB, GB, KB format and press enter

Now to save this partition table press “w”

create two more partitions in the same way

To check the partition details run the following command

#fdisk  -l  or u can use “p” option from the fdisk menu

The above output shows now the disk /dev/sdb is having three partitions

Step:3 Create  the fourth partition and then after that try create another primary partition


We have created four primary partitions, Now this will not allow us to create any more primary partitions on this disk since MBR partition scheme doesn’t allow more than four primary partitions.

If you need more partition now you must have to delete one Primary partition from the disk, then we can create one extended partition can be used to create more logical partitions.

When you try to create another primary partition the above output you will find an error message saying that you must have to delete a primary partition in order to create an extended partition on this.

Let me delete the fourth primary partition to make it available for creating the extended partition.

Type “d” option to delete the partition, after that give the partition number you want to delete

Press “w” to save the partition changes

Now Let us create one extended partition so that we can create the logical partitions.Here for extended we have to give the maximum disk space , I  am going to assign  give 1G size for this

Now check whether the new;y created extended partition updated

#fdisk   -l

From the above output we have created an extended partition /dev/sdb4 with the size 1GB, Now we could create logical partition up to 1GB.Now let us create three logical partitions on this, first partition with the size 500MB, Second partition with 100MB size.

From the output, the first logical partition /dev/sdb5 created successfully.

Do the same for the remaining two partitions

Now check the partition details by using the fdisk command

#fdisk  -l

From the above output, you can see the extended partition /dev/sdb4 with the size 1GB, from the extended we have created two logical partitions /dev/sdb5 /dev/sdb6.

Step:4  Now we have to create a filesystem on these partitions.


#mkfs    -t   ext3   /dev/sdb5

#mkfs  -t ext3   /dev/sdb6

Note: You cannot create a file system on the extended partition(/dev/sdb4)  because it cannot be used to hold the data, Logical partitions are used to store the data, so we have to format the logical partitions with the supported filesystem type.

Now to make it visible these newly created logical partitions to the users we have to mount it on some mount point directory structure.

Step:5 To mount a filsystem:


Syntax:

#mount  <filesystem>   <mountpoint directory>

Let me mount all the logical parttions to some mount point directory

#mkdir  /facebook

#mkdir  /whatsapp

#mount /dev/sdb5   /facebook

Repeat the same for the remaining logical partitions

#mount  /dev/sdb6  /whatsapp

Step:6 Now to view the mounted filesystem details, run the command


#df  -h

I hope you  have understood the Concepts of  Partitions in LINUX

If you miss my previous tutorial(Linux disk management) here is the link Linux Partition


If you found this article useful, Kindly subscribe 👉🏿👉🏿 Click this link to Subscribe

About Author:

Hello readers! Let me introduce my self first. My name is Vasanth Nirmal Singh J S having 9+ years of experience in IT on all flavours of Unix operating systems ,Storage's and many more .. I would like to share my technical experience i have come across - can be help to other people. So in this blog, I'll post my thoughts related to ITIS. I'll share experiences that I've had while working in different environments. You can expect content related to Unix,Solaris,Linux,EMC Storeages,HP-UX and many others. I hope this blog can be useful for you! Your comments will be appreciated!

Leave a Reply

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