LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-22-2011, 06:30 AM   #1
Senthilv
Member
 
Registered: Jan 2011
Posts: 66
Blog Entries: 2

Rep: Reputation: 0
Why Linux allow only four primary partition ?


Hai Everyone?
Can every tell me why linux allow only 4 primary partition , why we cant create more than 4 primary partition in linux?
 
Old 08-22-2011, 06:37 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

This is not a linux limitation, windows for example also runs into this.

Quote:
A maximum of four partitions can be placed on any hard disk. These are sometimes called primary partitions. The limitation of four is one that is imposed on the system by the way that the master boot record is structured.
Have a look here for the complete article: Primary, Extended and Logical Partitions

I'm not sure if you know this but you can use more then 4 partitions. Using one of the primary partitions as a container, you can create multiple extended logical partitions.

Hope this helps.

Last edited by druuna; 08-22-2011 at 06:42 AM. Reason: See post #4
 
Old 08-22-2011, 06:38 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Because we have to live in a M$oft dominated world. This is a limitation from MS-DOS.
GPT relieves this limit - see wikipedia.
 
Old 08-22-2011, 06:40 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
That would be "multiple logical partitions" druuna.
 
Old 08-22-2011, 06:41 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by syg00 View Post
That would be "multiple logical partitions" druuna.
Of course! I stand corrected.
 
Old 08-22-2011, 07:12 AM   #6
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 263

Rep: Reputation: 59
This limitation may be ending soon. I believe GPT, which will be in Fedora 16, supports more than 4 primary partitions. (Though if dual booting with Windows, you may still be limited).
 
Old 08-22-2011, 07:49 AM   #7
tommylovell
Member
 
Registered: Nov 2005
Distribution: Raspbian, Debian, Ubuntu
Posts: 380

Rep: Reputation: 103Reputation: 103
...and if you want to see why the 4 primary partition limit and have hexdump installed, you can look at it.

Here is an fdisk list of an MSDOS formatted disk.
Code:
[root@athlon ~]# fdisk -l /dev/sda

Disk /dev/sda: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders, total 2930277168 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 identifier: 0x0009ba70

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400   fd  Linux raid autodetect
/dev/sda2          206848  2930277167  1465035160   fd  Linux raid autodetect
[root@athlon ~]#
Here is a hex dump is the Master Boot Record (MBR), sector 0, of that same disk.
Code:
[root@athlon ~]# hexdump -C -n 512 /dev/sda
00000000  eb 48 90 10 8e d0 bc 00  b0 b8 00 00 8e d8 8e c0  |.H..............|
00000010  fb be 00 7c bf 00 06 b9  00 02 f3 a4 ea 21 06 00  |...|.........!..|
00000020  00 be be 07 38 04 75 0b  83 c6 10 81 fe fe 07 75  |....8.u........u|
00000030  f3 eb 16 b4 02 b0 01 bb  00 7c b2 80 8a 74 03 02  |.........|...t..|
00000040  80 00 00 80 3a 7f 00 00  00 08 fa 90 90 f6 c2 80  |....:...........|
00000050  75 02 b2 80 ea 59 7c 00  00 31 c0 8e d8 8e d0 bc  |u....Y|..1......|
00000060  00 20 fb a0 40 7c 3c ff  74 02 88 c2 52 f6 c2 80  |. ..@|<.t...R...|
00000070  74 54 b4 41 bb aa 55 cd  13 5a 52 72 49 81 fb 55  |tT.A..U..ZRrI..U|
00000080  aa 75 43 a0 41 7c 84 c0  75 05 83 e1 01 74 37 66  |.uC.A|..u....t7f|
00000090  8b 4c 10 be 05 7c c6 44  ff 01 66 8b 1e 44 7c c7  |.L...|.D..f..D|.|
000000a0  04 10 00 c7 44 02 01 00  66 89 5c 08 c7 44 06 00  |....D...f.\..D..|
000000b0  70 66 31 c0 89 44 04 66  89 44 0c b4 42 cd 13 72  |pf1..D.f.D..B..r|
000000c0  05 bb 00 70 eb 7d b4 08  cd 13 73 0a f6 c2 80 0f  |...p.}....s.....|
000000d0  84 f0 00 e9 8d 00 be 05  7c c6 44 ff 00 66 31 c0  |........|.D..f1.|
000000e0  88 f0 40 66 89 44 04 31  d2 88 ca c1 e2 02 88 e8  |..@f.D.1........|
000000f0  88 f4 40 89 44 08 31 c0  88 d0 c0 e8 02 66 89 04  |..@.D.1......f..|
00000100  66 a1 44 7c 66 31 d2 66  f7 34 88 54 0a 66 31 d2  |f.D|f1.f.4.T.f1.|
00000110  66 f7 74 04 88 54 0b 89  44 0c 3b 44 08 7d 3c 8a  |f.t..T..D.;D.}<.|
00000120  54 0d c0 e2 06 8a 4c 0a  fe c1 08 d1 8a 6c 0c 5a  |T.....L......l.Z|
00000130  8a 74 0b bb 00 70 8e c3  31 db b8 01 02 cd 13 72  |.t...p..1......r|
00000140  2a 8c c3 8e 06 48 7c 60  1e b9 00 01 8e db 31 f6  |*....H|`......1.|
00000150  31 ff fc f3 a5 1f 61 ff  26 42 7c be 7f 7d e8 40  |1.....a.&B|..}.@|
00000160  00 eb 0e be 84 7d e8 38  00 eb 06 be 8e 7d e8 30  |.....}.8.....}.0|
00000170  00 be 93 7d e8 2a 00 eb  fe 47 52 55 42 20 00 47  |...}.*...GRUB .G|
00000180  65 6f 6d 00 48 61 72 64  20 44 69 73 6b 00 52 65  |eom.Hard Disk.Re|
00000190  61 64 00 20 45 72 72 6f  72 00 bb 01 00 b4 0e cd  |ad. Error.......|
000001a0  10 ac 3c 00 75 f4 c3 00  00 00 00 00 00 00 00 00  |..<.u...........|
000001b0  00 00 00 00 00 00 00 00  70 ba 09 00 00 00 80 20  |........p...... |
000001c0  21 00 fd df 13 0c 00 08  00 00 00 20 03 00 00 df  |!.......... ....|
000001d0  14 0c fd fe ff ff 00 28  03 00 30 53 a5 ae 00 00  |.......(..0S....|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200
[root@athlon ~]#
The partition table starts at offset 0x01be. There are four entries, each 16 bytes long.

The first entry, partition 1, is at 0x01be and contains 80202100fddf130c0008000000200300, which decodes to "/dev/sda1 * 2048 206847 102400 fd Linux raid autodetect" in the 'fdisk' output.

The second partition is at 0x01ce and contains 00df140cfdfeffff002803003053a5ae, which decodes to "/dev/sda2 206848 2930277167 1465035160 fd Linux raid autodetect" in the 'fdisk' output.

The third and fourth entries at 0x01de and 0x01ee are empty. At the end (0x01fe) is the signature for an MSDOS disk, "55aa".

If a partition has a type of "extended", it can contain a number of logical partitions that are "chained together". A long, long time ago (in Linux), you could have up to 64 logical partitions in an extended primary partition. That was incompatible with Windows, and overkill. I believe that number has been reduced and now you have 4 primary partitions 1 through 4 (as always); and 11 logical partitions, 5 through 15.
 
Old 08-22-2011, 09:14 PM   #8
pafoo
Member
 
Registered: Jul 2011
Location: Alabama
Distribution: Red Hat/Ubuntu/Solaris
Posts: 37

Rep: Reputation: 11
Simple enuff, beyond 4 partitions you are expected to use LVM. One use is make 1 primary 2 extended then the last LVM. Then you can make a TON more partitions via LVM. But really, in a linux partition generally its better practice to make 1 primary for /boot then the rest LVM.
 
Old 08-23-2011, 12:00 AM   #9
tommylovell
Member
 
Registered: Nov 2005
Distribution: Raspbian, Debian, Ubuntu
Posts: 380

Rep: Reputation: 103Reputation: 103
Quote:
Originally Posted by pafoo View Post
beyond 4 partitions you are expected to use LVM.
Well, not really expected. There are many people that do not like LVM. And there are some distros that make it inconvenient for you to use LVM. But I think it's now pretty mature and it works well. It makes it very easy to do drive replacements and filesystem resizing. Something that is difficult to do if your filesystems are placed directly on a partition. Plus the ability to make instantaneous snap copies for backup has obvious advantages.

LVM is not magic, though. The lowest level "entity" of LVM, the Physical Volume normally lives on a disk partition (either primary or logical) (It can use a full disk volume that is not partitioned, but that's not considered a good idea in a Windows/Linux dual boot environment. And you can't do that for your boot disk, either...)

Quote:
But really, in a linux partition generally its better practice to make 1 primary for /boot then the rest LVM.
It's a matter of preference. What works best for you is the best.

On my Fedora systems, I have two primary partitions. The first is 100MB for the /boot filesystem; the second has the rest of the space, and is an LVM Physical Volume that gets "sliced up" into a / (root), /home, /var, /opt, swap and other Logical Volumes.

On my little Ubuntu HP Mini netbook, there is no LVM at install time, so three primary partitions: /boot, /, and swap. No need for an extended partition with logicals in it. Simple and somewhat immutable.

As I said, it's a matter of preference and what works best.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change linux distrabution on first primary partition from opensuse to ubuntu? Gutsy_Iain_08 Linux - Newbie 5 12-07-2009 04:36 AM
linux in primary partition Scarlett_987 Linux - General 2 01-28-2007 03:56 AM
Resizing primary partition to make room for a linux distro Bakoulou Linux - Newbie 5 12-13-2005 07:02 AM
setting up a linux partition and primary/extended partitions joemamma Linux - Newbie 6 02-23-2003 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration