Sign in with
Sign up | Sign in
Your question

Understnading Extended, Logical, and Primary partitions

Last response: in Storage
Share
June 18, 2011 3:41:27 PM

This is from a blog article I was writing. The questions are at the bottom.

Quote:


<strong>A Word on Primary/Extended/Logical Partitions
</strong>The difference between primary, extended, and logical partitions, to say the least, greatly confused me. Here's what you need to know. When you partition a drive you have the option of choosing the new partition to be primary or extended.

Primary partitions are partitions
<ol>
<li>from which you can boot an OS</li>
<li> automatically get assigned to a device location</li>
<li> partitioning them must involve the assignment of a filesystem (ntfs, ext4, FAT32, and the like)</li>
<li>have a maximum number of 4 (you can only have 4 primary partitions on any given single hard disk)</li>

Extended partitions
<li>have unlimited count per hard disk (there's no 4 maximum, like with primary partitions)</li>
<li>do not get automatically assigned a device location (nor drive letter in windows)</li>
<li>do NOT get formatted with a filesystem (filesystems are assigned later)</li></ol>

Here's a very helpful diagram from gparted.





Now I made this overly complicated to illustrate the different partitioning types:

<ol>
<li>Partition 1, NTFS, Primary, 300GB,<strong> 1/4 Primary</strong>
</li>
<li>Partition 2, NTFS, Primary, 200GB,<strong> 2/4 Primary</strong>
</li>
<li>Partition 3 (called #5 in diagram), No filesystem, Extended, 300GB, (NOTE: Takes the Place of a primary partition! <strong>Counts as 3/4 primary partition)!</strong>
</li>
<ol>
<li>Partition3-1 (called Partition #6), Logical Partition of partition 3 (the extended partition), 29.29GB, ext2
</li>
<li>Partition3-1 (called partition #7 in gparted, idiotically), Logical partition of Partition 3, NTFS, 39.06GB
</li>
<li>Partition3-3 (called partition # 8), Logical Partition of Partition 3), 97.65GB, linux-swap (it would be idiotic to make the swap partition larger than the linux ext2/3/4 partition but this is just illustrative of primary, extended, and logical partitions.
</li>
<li>Partition3-4 (called partition #9), Logical partition of Partition 3, NTFS, 134GB.
</li>
</ol>
<li>Partition 4 (actually called partition #4 in gparted), ext4, 100GB, <strong>Primary Partition 4/4</strong>
</li>

</ol>


QUESTIONS


AFAIK, This partitioning scheme has 3 bootable partitions (the three primaries), 1 extended and 4 logical parititions within that one extended partition. Is it true that if you use an extended partition, it (nor any of its logical partitions can be booted from)?
What about linux-swap. I couldn't do an extended partition and make one logical ext4 and the other logical linux-swap? So using linux ext4 (primary) and linux-swap (primary) would take up two of the four primary parititions?


Thanks.
June 18, 2011 3:50:25 PM

Basically, the
TL;DR
is
if I do linux (ext4) (must be primary for it to be bootable with linux os, right?)
and a swap. Doesn't the swap have to be primary, too? How could it not?

I liked the idea of doing ONE extended with an ext4 and a linux-swap as two logical partitions within the extended, but then the ext4 with linux os couldn't boot??


BASICALLY: If you make an extended partition, (can one of those logical partitions be used as linux swap)? AND NONE of those logical partitions (nor the extended) one can boot from, correct??

This is slightly irksome and the 4 primary partition limit seems unnecessary.


[edited to make the BASICALLY questiosn bold because those are what I'm trying to understand most).
m
0
l
a c 104 G Storage
June 18, 2011 4:59:32 PM

Hi John,

Understanding how HDD's, partitions and volumes are set up can be confusing. When you initially set up a drive, you have to choose whether to set up a Static drive (Basic) or Dynamic drive. If you have only 1 drive, your only choice is Basic and the Partition Style is MBR. With that setup you get 4 Primary partitions or 3 Primary Partitions and 1 Extended partition. You can set up up to 1000 Logical Volumes in that extended partition. Logical volumes can't be used as a boot partition.

Before adding data to your disk, you can easily convert the Basic Disk to a Dynamic Disk, where sections of the drive are called Volumes. If you choose an MBR partition style you can set up to 1000 volumes or with the GPT partition style you can set up to 128 volumes (max vol 18 exabytes)

So there are 4 combinations: Basic Disk (MBR Partition or GPT Partition), & Dynamic Disk (MRB Partition or GPT Partition). In general, if you convert one way or the other, you have to remove the volumes and lose your stored data.
m
0
l
June 18, 2011 7:09:43 PM

johntkucz said:
Basically, the
TL;DR
is
if I do linux (ext4) (must be primary for it to be bootable with linux os, right?)
and a swap. Doesn't the swap have to be primary, too? How could it not?

I liked the idea of doing ONE extended with an ext4 and a linux-swap as two logical partitions within the extended, but then the ext4 with linux os couldn't boot??


BASICALLY: If you make an extended partition, (can one of those logical partitions be used as linux swap)? AND NONE of those logical partitions (nor the extended) one can boot from, correct??

This is slightly irksome and the 4 primary partition limit seems unnecessary.


[edited to make the BASICALLY questiosn bold because those are what I'm trying to understand most).


AFAIK, there should be no problem with the swap partition being an extended one, even if the ext4 (i.e. the boot partition) is a primary one.

The issue is that when booting from hard disks, since the MBR is used to load the primary OS, it must be able to access a primary partition. (That's what MBRs can handle - an extended partition has its volume information stored within that partition). What that partition does is then load up the operating system. There is nothing particularly special, as far as the MBR is concerned, about the swap partition of Linux - all the OS needs to know is where it is.

Have a look at http://en.wikipedia.org/wiki/Extended_boot_record which has a nice description of the way extended partitions work.
m
0
l
!