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.
From the above about its confirmed, the disk /dev/sdb is having only one partition (/dev/sdb1)
Step:2 Create the second partition:
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
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
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:
#mount <filesystem> <mountpoint directory>
Let me mount all the logical parttions to some mount point directory
#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
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