5

I would like to know how many Primary and Extended Partitions I can create on a x86_64 PC with Linux running on it?


Update :
If there is a limit to the number of partitions, why is that the limit?

10

The limitation is due to the original BIOS design. At that time, people weren't thinking more than four different OSes would be installed on a single disk. There was also a misunderstanding of the standard by OS implementors, notably Microsoft and Linux which erroneously map file systems with (primary) partitions instead of subdividing their own partition in slices like BSD and Solaris which was the original intended goal.

The maximum number of logical partitions is unlimited by the standard but the number of reachable ones depends on the OS. Windows is limited by the number of letters in the alphabet, Linux used to have 63 slots with the IDE driver (hda1 to hda63) but modern releases standardize on the sd drivers which supports by default 15 slots (sda1 to sda15). By some tuning, this limit can be overcome but might confuse tools (see http://www.justlinux.com/forum/showthread.php?t=152404 )

In any case, this is becoming history with EFI/GPT. Recent Linuxes support GPT with which you can have 128 partitions by default. To fully use large disks (2TB and more) you'll need GPT anyway.

  • I believe you only need GPT if the partition /boot is on is greater than 2TB. / should be able to be larger than 2TB since the kernel mounts it rather than the bootloader. – jonescb Jan 12 '11 at 15:16
  • How would the non /boot partitions be defined ? – jlliagre Jan 12 '11 at 15:38
  • There was also a misunderstanding of the standard by OS implementors, notably Microsoft and Linux which erroneously map file systems with (primary) partitions instead of subdividing their own partition in slices like BSD and Solaris which was the original intended goal. I dint understand this. Could you please elaborate on this? – Sen Jan 12 '11 at 17:12
  • 2
    @Sen: the original goal was that each OS would use a single partition, and if an OS wanted more than one filesystem, it would divide the partition into slices. But Linux (originally) and Windows use separate partitions for each filesystem. – Gilles Jan 12 '11 at 21:17
3

Sen, in response to @jlliagre, it should be noted that some operating systems will create a single partition, but essentially create sub-partitions within that space.

It is analogous, but not equal, to doing:

 parted rm 1 /dev/sda
 ...
 parted rm 7 /dev/sda
 parted mkpart primary $start $end /dev/sda
 parted mkpart primary $start1 $end1 /dev/sda1

You could then use kpartx to access these sub-partitions:

 kpartx -a /dev/sda1

The sub-partition(s) would appear as:

 /dev/sda1p1

Of course, this isn't how FreeBSD and similar systems do their slicing, exactly, but it is essentially the same thing.

  • Indeed. I didn't wrote nobody followed the intended goal, just that two mainstream OSes didn't, at least originally. The IBM PC-AT introduced the extended partition standard which was limiting the damage. Modern OSes like those using volume managers or even better, ZFS, no more demand a one to one relationship between file systems and partitions. – jlliagre Jan 12 '11 at 21:41
0

In a hard disk we can create 4 primary partitions or alternatively 3 primary partitions and an extended partition. The primary+extended partition can be divided into 63 logical partitions

0

4 primary partitions or alternatively 3 primary partitions and an extended partition.

The extended partition can be subdivided into multiple logical partitions.

  • 1
    Do you how many logical partitions that would be? – Johan Jan 12 '11 at 14:24
  • 1
    @Johan: The format doesn't impose any limitation, but most OSes do have one. See jlliagre's answer. – Gilles Jan 12 '11 at 21:14
0

Partitions are totally depended upon Disk type format.

If we use MBR Disk type in Linux then we can create 4 total partitions like:

1) All four partitions are Primary only.

2) Three partitions are primary and remaining 1 is extended.

If we consider above 2 steps then under Extended partition we can create almost 65536 new logical partitions and use them but this logical partitions we can use have some limit and it depends upon OS to OS.

How many partitions we can create under Extended partitions?

Answer: Suppose you created the last partition in MBR as an extended partition and under it, we create a 1GB partition as a logical partition.

Their structure as follows:

[root@localhost ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x4bc89c19

Device Boot Start End Blocks Id System

/dev/sdb1 2048 2099199 1048576 83 Linux

/dev/sdb2 2099200 2293759 97280 83 Linux

/dev/sdb3 2293760 2488319 97280 83 Linux

/dev/sdb4 2488320 41943039 19727360 5 Extended < br/>

[root@localhost ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only until you decide to write them.

Be careful before using the write command.

Command (m for help): n

All primary partitions are in use

Adding logical partition 5

First sector (2490368-41943039, default 2490368):

Using default value 2490368

Last sector, +sectors or +size{K,M,G} (2490368-41943039, default 41943039): +1G

Partition 5 of type Linux and of size 1 GiB is set

Command (m for help): p

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x4bc89c19

Device Boot Start End Blocks Id System

/dev/sdb1 2048 2099199 1048576 83 Linux

/dev/sdb2 2099200 2293759 97280 83 Linux <

/dev/sdb3 2293760 2488319 97280 83 Linux

/dev/sdb4 2488320 41943039 19727360 5 Extended

/dev/sdb5 2490368 4587519 1048576 83 Linux

Now, After create a 1GB logical partition above we can calculate the total number of logical partition under the extended partition.

We know MBR supports 1 Sector space =512 bytes

Difference between /dev/sdb5 and /dev/sdb4 Starting Sector Values has follows 2490368-2488320=2048

2048 is the difference value which is a Reserved Space in Extended Partition to store the information of logical partitions under it.

If we multiply 2048 with 512 bytes then total bytes present in Extended partitions to support Logical partitions i.e. 2048*512=1048576 bytes

In MBR, the total size of 64 bytes is used to store the partition information in the partition table. It means partition table stores each partition information in it which has each partition size of 16 bytes. Each partition can use the 16 bytes of space, so according to it, the total of 4 partitions are provided in MBR including extended. If we see the last partition size which is extended partition then they use 16 bytes of space.

It means if we divide the 1048576 bytes to 16 we get a total number of logical partition under extended partition i.e. 1048576/16=65536(Maximum Logical Partition).

We can use maximum 65536 total logical partitions under it. But the use of this partition depends upon OS to OS. In Linux, MBR uses maximum 60 logical partitions under the extended partition.

So total number of partitions we can create under MBR is 3(primary),1(Extended),60(Logical)=64

But only primary and logical partitions are used to feed the Linux data not extended partitions so it means only 63 partitions are useful to feed the data into the partitions.



How we can say only 60 maximum partitions are created under MBR and not more than that?

Just create the logical partitions as much as you can and when you create your 60th logical partition, the system shows this message

Command (m for help): n

All primary partitions are in use

Adding logical partition 60

First sector (23013477-41943039, default 23031808):

Using default value 23031808

Last sector, +sectors or +size{K,M,G} (23031808-24035327, default 24035327): +100

Partition 60 of type Linux and of size 50.5 KiB is set

Command (m for help): n

The maximum number of partitions has been created

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.