LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Why are logical partitions preferred over primary? (https://www.linuxquestions.org/questions/linux-general-1/why-are-logical-partitions-preferred-over-primary-879632/)

<Ol>Origy 05-09-2011 07:12 AM

Why are logical partitions preferred over primary?
 
So I noticed while using guided partitioning that most distro installers will attempt to create a logical partition for the root file system besides the swap and /boot on the HDD. Why is this the case? Why does the partition for root file system have to be logical and not primary?

~Ol

neonsignal 05-09-2011 07:21 AM

It is to make it easy to create multi-boot systems.

The partition system that is now widely used only allows four primary partitions, so it is not a good idea to waste these (especially since some other operating systems will only boot from a primary partition).

syg00 05-09-2011 07:21 AM

Doesn't have to be. Merely makes sense when there is an absolute limit of 4 primaries on what is generally called a MBR disk layout. Extended/logicals was created to alleviate this restriction.

<Ol>Origy 05-09-2011 07:28 AM

I am aware of the limitations. But considering that most of the time I was doing a fresh install after a complete format, there were no other operating systems present on the HDD at the time of installation. I am guessing the logical partitions are made to address the possibility of installing another OS in the future.

The reason I don't so much like extended partitions is because they mess up my partition table index. Instead of /dev/sda1, /dev/sda2, /dev/sda3 I get /dev/sda1, /dev/sda4, /dev/sda5 or something like that. Kind of confusing.

PhoenixAndThor 05-09-2011 07:34 AM

Hard drives are limited to 4 primary partitions. Originally, logical partitions were meant as a way to overcome this limit, acting as a 'container' for extra partitions. Now, with storage devices reaching capacities of 2+TB, partitions in general are pretty much used like filing cabinets. These days /swap partitions are also created within a logical partition. Last I checked, the /boot partition had to be a normal partition, because logical partitions can't be mad bootable. Correct me if I'm wrong

syg00 05-09-2011 07:38 AM

You're wrong... :p
Using grub I'm not aware it was ever required to be a primary. Maybe very early on ...

neonsignal 05-09-2011 07:46 AM

Quote:

Originally Posted by <Ol>Origy (Post 4350872)
The reason I don't so much like extended partitions is because they mess up my partition table index.

This is just because the primary partitions are allocated IDs before the logical ones. So it makes sense to start the logical ones at '5', otherwise when you added a new primary partition, all the logical partition IDs would change (which would mess up configurations). Now that we are moving to UUIDs, you will be able to use them instead :)

onebuck 05-09-2011 08:02 AM

Hi,

'man fdisk';

Quote:

A DOS type partition table can describe an unlimited number of partitions. In sector 0 there is room for the description of 4 par-
titions (called `primary'). One of these may be an extended partition; this is a box holding logical partitions, with descriptors
found in a linked list of sectors, each preceding the corresponding logical partitions. The four primary partitions, present or
not, get numbers 1-4. Logical partitions start numbering from 5.
You can't get a simpler description than the above from 'man fdisk' for DOS type use.

PhoenixAndThor 05-09-2011 09:32 AM

It was right on the tip of my terminal onebuck, well said. I knew it had to be some kind of built-in thing that everyone followed.

<Ol>Origy 05-09-2011 11:23 AM

Quote:

Originally Posted by neonsignal (Post 4350893)
This is just because the primary partitions are allocated IDs before the logical ones. So it makes sense to start the logical ones at '5', otherwise when you added a new primary partition, all the logical partition IDs would change (which would mess up configurations). Now that we are moving to UUIDs, you will be able to use them instead :)

Oh, that makes total sense now... 4 primary are from 1 to 4 and the 5th logical starts at 5. I had completely no idea it worked like that! I always thought the extended partition creates some invisible containers that store other partitions, but for some reason they didn't show up as /dev/sda3 and /dev/sda4. Thanks for clarifying.

Have some rep++.

PTrenholme 05-09-2011 12:04 PM

Since M$ is now shipping?/supporting? GUID partitioned disks, and most Linux partitioning tools (and GRUB2, I believe) are happy with such partitioning, I suspect that you'll soon see installer developers changing the defaults. The GUID scheme still has four "primary" partitions - for "backward compatibility with older boot programs" - but doesn't need to use one of them for an "extended partition" holder.


All times are GMT -5. The time now is 12:58 AM.