-   General (
-   -   Partitions, logical vs primary (

AphoxemaG 02-13-2007 03:33 PM

Partitions, logical vs primary
I like to go crazy on partitioning my hard drives, more out of a personal appreciation of the power than any practical use of it. I was wondering... is there anything good or bad about primary or logical partitions I should be aware of? Do I want to avoid logical partitions, or are they really no trouble?

I've always avoided using logical partitions where I can, but only because I don't really understand how they work other than they're a primary partition with extra data on it... and so I have less trouble resizing partitions... which doesn't really matter, because I end up deleting them and remaking them, anyways.

syg00 02-13-2007 03:44 PM

Basically the same - except the total count allowed.
On my test boxes I don't have any primaries (other than the extended of course) - much more flexible. Yes, more flexible, even for resizing.

AphoxemaG 02-13-2007 03:51 PM

So I'd be better off (in the future, not going to bother now) making one logical partition on the whole drive and making partitions in that?

saikee 02-13-2007 04:12 PM

The way it works is approximately like this.

The 64 bytes between the 446th to 510th position of the MBr is the partition table holding 4x16 bytes allocations for 4 primary partitions. Each partition has a record of the starting and ending addresses of the hard disk.

If you opt for logical partition at the very begining the first slot hda1 will be used up as the extended partition having the same layout as a primary partition except a different Partition ID indicating it is not a primary.

The extended partition gives no indication of how many logical partitions inside or how big each logical partition is. The OS has to go to the first logical partition location and read its "extended boot record" which has the address for the next logical partition. Thus logical partition must be in a continuous chain and the last one has "0" for the next logical to indicate it is the end and hopefully that hard disk position matches the ending address of the extended partition.

The 4 primaries have been reserved as hda1 to hda4 and the first logical always starts at hda5. The maximum device number of a Pata and a Sata disk are 64 and 16 respectively. As the disk itself uses up a device name like /dev/hda that means there can be a maximum of 63 partitions inside. Discounting hda1 used as an extended partition which itself has no storage there can be a total of 3 primaries and 59 logicals in a Pata. The corresponding numbers for a Pata are 1, 3 and 11 respectively.

The total number of possible devices for Pata and Sata are both 256. Pata achieves it with 4 disks and Sata does it with 16 disks. USB memory keys and external drives are under the allocation of the Sata disks which was initially created for SCSI hard disks.

Currently cfdisk and fdisk do not support partitions beyond the 60th in a Pata but newer programs like QTparted and Gparted do.

Linux by default can be installed and booted from any partition in a hard disk.

syg00 02-13-2007 04:24 PM


Originally Posted by AphoxemaG
So I'd be better off (in the future, not going to bother now) making one logical partition on the whole drive and making partitions in that?

*extended* - the logicals are (sub) allocated within the extended partition.

Brian1 02-13-2007 04:33 PM

No problems using logical partitions. Just remember if you set 4 primary partitions then you cannot add additional logical partitions. So to have more than 4 partitions then the first 3 can be primary partitions while making the rest of the drive space as an extended partition where you can add the logical partitions to.


AphoxemaG 02-14-2007 11:29 AM


Originally Posted by saikee
The way it works is... blah blah blah... a bunch of stuff... *helpful information*...

... Oh. Thanks! That explains everything ^^

reddazz 02-14-2007 12:28 PM

Moved to the General Forum because its not really a topic specific to Linux.

pixellany 02-14-2007 01:10 PM


Originally Posted by AphoxemaG
So I'd be better off (in the future, not going to bother now) making one logical partition on the whole drive and making partitions in that?

Saikee has already given a good answer..

You make logical partitions inside the extended partition.

No, you would not be "better off". Linux at, least, does not care. I do think that Windows does not like being on a logical---most people just put it on #1 (primary).

If you are into details, note that extended logical partitions behave a bit like a linked list. The extended partition in the mbr points to the "extended boot record" which you will find two partition table entries:
1. Points to the first logical partition
2. Points the next extended partition---where you will find (you guessed it) two more entries.

(At the end of the chain, there will be only one entry--to the last logical partition.)

alred 02-15-2007 12:00 AM

nowadays whenever i have a disk , i normally break it into 4 parts but leave the last one empty first ...

if the disk is small enough , equal part to each of them but if its really a big disk ... hard to say , probably 50/50 between the first three and the last ... for me , very large disk is difficult to use ...

for me its good in the sense that "no need planning so much" ...

//.2cents ...


saikee 02-15-2007 02:14 AM

The way I do it is for loading a large number of systems and so I standardise 5Gb per distro and my disks are essentially nothing but equal size partitions.

Got three Pata all with the maximum limit of 63 partitions each. First two are completely filled. When I got a distro I like I simply put it into one of the empty partitions.

I wrote a Grub menu booting all the partitions. Thus an empty partition becomes bootable instantly if I fill it. Much of the work has been described in my signature.

dasy2k1 02-15-2007 03:00 AM

i tend to put swap on primary and /boot if its seperate
windows if you still have it

then an extended wioth a few logicals on as linux... allthough if you like flexabilaty what about a LVM group.

saikee 02-15-2007 03:24 AM

I have stayed away from LVM because it

(1) Cannot be recognised by any Linux boot loader (that is one reason why it must have a separate /boot in the normal Ext2/3 format.

(2) Cannot be resized. Programs like gparted doesn't want to know about it.

(3) Cannot be migrated as one whole unit.

(4) Need drivers to be recognised in Linux.

(5) Cannot be mounted as a normal partition to access data inside.

I just don't think "flexibility" is its strength.

alred 02-15-2007 05:54 AM

are there any free tools out there which can gives more than 4 primary partitions ??

if there is any , is it ok for grub and lilo ??


saikee 02-15-2007 06:27 AM

My reply in post #4 indicates the 4-primaries is effectively a PC standard. There are other software trying to get 255 primaries using different naming convention but they are not supported by Windows, Linux and Unix systems.

One can arrange a hard disk any way one sees fit but in loading any of the above systems the OS will automatically use the Bios information and go to 447th bytes to read the next 64 bytes assuming they are the partition table of the 4 primaries.

Both Grub and Lilo have no problem to read and boot the partitions in accordance with the PC standard.

From my own experience there is no operational advantage or benefit to use primary partitions in Linux and we can move a Linux in hda1 to hda63 and it will boot and operate just the same.

As the PC standard exists today with 4 primaries we could get a maximum of 240 partitions in a Pata disk. 236 Out of the 240 partitions will be bootable the remaining 4 as a combination of temporary primary and extended partitions.


This is how one can get 240 partitions out of a Pata. I haven't exhausted the 240 limit myself but have tried 200+ partition before in this thread.

The tools needed are fdisk, cfdisk and gparted. Gparted for the last few logical partition as cfidsk and fdsik stop reporting partition beyond the 60th partition.

(1) Use cfdisk to partition first logical partition. It will be called hda5 immediately and the first primary partition hda1 is used up the extended partition to house it. Proceed to make logical partition all the way to hda59. Write the partition table and reboot. After a reboot continue with gparted to make hda60 to hda63 logical partitions. Reboot again to make the first set of logical partition permanent.

(2) Hide the hda1, say using Grub or cfdisk, hda1 will immediately treated as an "unknown primary partition" and the logical partitions become invisible.

(3) Proceed with cfdisk and gparted on creating a new set of logical partitions which will be called hda5 to hda63 again. The second lot is inside the extended partition hda2. Reboot again.

(4) Hide hda2 thereby making it another "unknown primary partition" to Linux. The hda3 is again used to generate the 3rd set of 59 logical partitions. hda1 and hda2 remain unknown primaries and their logical partitions inside are automatically not displayed.

(5) Repeat steps (2) and (3) to get the last set of 59 logical partitions from hda5 to hda59.

In using any of them one just unhide the unknown primary and hide other 3 unknown primaries. The unhiden unknown primary turn back to an normal extended partition with the internal 59 logical partitions available for use and booting.

The above scheme works. One can write a set of Grub menus to boot all the 236 partitions inside. I am doing something similar but for a different reason.

I recommend the maximum logical partition number to be restricted to 63 to ensure at any one time there cannot be more than 64 devices from the Pata disk. The 64 should comprise of hda, 4 primaries hda1 to hda4 and 59 logicals from hda5 to hda63.

Personally I don't think many users are stretching the limits of the 4 primaries in a hard disk.

All times are GMT -5. The time now is 11:30 AM.