In this video, I'll show you how to work with extended and logical partitions in an MBR
environment.
So let me explain primary, extended and logical partitions which you are using in MBR.
It's easy.
If this is your hard disk, not a perfect circle, but that doesn't matter, in your hard disk
you create different partitions.
So in MBR, you are placed for four partitions only.
So if each of these pizza pies is a partition, well, you are placed for one more.
But what happens if you want to create more than just four partitions?
Well, in MBR, due to the limited disk space, you don't have space for it.
So what you are going to do, you treat one of them as an extended partition, and within
the extended partition, you are going to add your logical partitions.
And that makes that you can get beyond the limitation of four partitions only.
Okay, at any time, if you start working with partitions, it's a good idea to start with
LSBOK to list your block devices.
I'm going to use fdisk on dev nvme 0 n1.
And I like to use P. You should always use P so that you know what you are doing.
Next I'm using N to create a new partition.
Normally, you would always use all your primary partitions before you start using an extended
partition.
But I'm going directly for the extended partition.
The reason that normally you first consume all of your primary partitions is that primary
partitions are direct partitions.
And if ever you need to do troubleshooting on disk, it is much easier if you can troubleshoot
primary partitions.
Then by the time you start using your extended partition, you address all of the remaining
disk space in your extended partition.
So here I'm going to add partition number two as the extended partition.
It's asking for the first sector, I'm pressing enter.
And then it's asking for the last sector, and I'm pressing enter again.
Particularly, if this is partition number four that you create in MBR, after creating
partition number four, there's no more place in your partition table.
And that is why I'm pressing enter on the second question.
So now I have my extended partition.
And you can see the extended partition ranges from 2099200 up to 41943039.
Good.
Next, I'm going to use N to create a new partition.
And this time, it is telling me all space for primary partitions is in use.
And it's adding logical partition five.
If you have no more space in your MBR partition table, you start using your logical partition.
And the first logical partition is always partition number five.
So I am going to press enter on the first sector, which is within the range of the extended
partition, as we discussed before.
And next, I'm going to use last sector plus one uppercase G to make it a one-gig partition.
So logical partitions are always created in order.
And here also goes that this order might change if you delete a logical partition, for instance.
But for now, we are not going to do that.
I'm just showing you the current partitioning, where we have NVMe 0 and 1P2.
And you can see that NVMe 0 and 1P5 falls within the range of the logical partition.
So if that is what you wanted, and that is what I want right here, let's do W to write.
And let's use LSBLK to verify.
So so far, we have only created partitions.
The next step would be to create a file system on top of it.
Because right now, the partitions are just a reservation of disk space.
They are not usable at all.
So in one of the next videos, you'll learn how to create file systems on top of them.
But before that, we will talk about GPT partitions in the next video.