LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 02-13-2007, 03:33 PM   #1
AphoxemaG
Member
 
Registered: Jan 2007
Location: Illinois
Distribution: Slackware 11
Posts: 37

Rep: Reputation: 15
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.
 
Old 02-13-2007, 03:44 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,786

Rep: Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170
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.
 
Old 02-13-2007, 03:51 PM   #3
AphoxemaG
Member
 
Registered: Jan 2007
Location: Illinois
Distribution: Slackware 11
Posts: 37

Original Poster
Rep: Reputation: 15
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?
 
Old 02-13-2007, 04:12 PM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
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.

Last edited by saikee; 02-13-2007 at 04:13 PM.
 
Old 02-13-2007, 04:24 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,786

Rep: Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170
Quote:
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.
 
Old 02-13-2007, 04:33 PM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 64
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.

Brian
 
Old 02-14-2007, 11:29 AM   #7
AphoxemaG
Member
 
Registered: Jan 2007
Location: Illinois
Distribution: Slackware 11
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by saikee
The way it works is... blah blah blah... a bunch of stuff... *helpful information*...
... Oh. Thanks! That explains everything ^^
 
Old 02-14-2007, 12:28 PM   #8
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
Moved to the General Forum because its not really a topic specific to Linux.
 
Old 02-14-2007, 01:10 PM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741Reputation: 741
Quote:
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.)
 
Old 02-15-2007, 12:00 AM   #10
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
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 ...

.

Last edited by alred; 02-15-2007 at 12:05 AM.
 
Old 02-15-2007, 02:14 AM   #11
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
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.
 
Old 02-15-2007, 03:00 AM   #12
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 960

Rep: Reputation: 35
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.
 
Old 02-15-2007, 03:24 AM   #13
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
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.
 
Old 02-15-2007, 05:54 AM   #14
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
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 ??


.
 
Old 02-15-2007, 06:27 AM   #15
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
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.

Last edited by saikee; 02-15-2007 at 08:27 AM.
 
  


Reply

Tags
partition


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
to many partitions? (IDE: 4 primary, 3 logical) drkstr Linux - Software 13 06-14-2006 10:16 AM
Logical drives, and Primary Partitions Infernolinux Linux - Hardware 19 01-09-2006 07:44 PM
Partition Problems: Bad primary partition 1: logical partitions overlap rovitotv Slackware 6 01-08-2006 06:55 PM
primary or logical partitions? blotch Slackware 10 09-09-2004 04:36 AM
Partitioning - Primary and Logical partitions quietguy47 Linux - General 2 07-06-2003 10:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 06:26 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration