LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Primary vs. Logical (http://www.linuxquestions.org/questions/slackware-14/primary-vs-logical-487883/)

Jeebizz 09-28-2006 11:41 PM

Primary vs. Logical
 
On my notebook I have a ~ 115GB HD, I resized the NTFS partition to get ready for Slackware 11.0. NTFS is now 54.7GB, made a 26.5GB FAT32 partition for sharing files between Linux and XP, made a 100MB ext2 partiton for boot, 22GB ext3 for home, though I will probably change that to reiser or jfs, but thats far as I can get, I get limited to only 4 primary partitons... Why the limit to only 4? I originally wanted this kind of setup....

NTFS Primary 54.7GB
FAT32 Primary 26.5GB
ext2 boot Primary 100MB
home Primary 22GB
/ ReiserPrimary 8.97GB

I thought I heard that you could have a much higher number of primary partition, but apparantly not. So should I make / as a logical partition then?

dive 09-29-2006 12:50 AM

You can only have 4 primary partitions I think. You can make 1 primary NTFS for windows, then make an extended partition of the remaining space and create as many logical drives in that as you like. So it will look like:
Code:

[Primary][-------------Extended-------------]
[-------][logical1][logical2][logical3][etc-]

Anyway I think that's how it works. Someone correct me if I'm wrong.

Bruce Hill 09-29-2006 01:10 AM

You can have 4 primary maximum. If you want more than 4
partitions, you can make 1 (as dive said) or up to 3 as
primary, then the rest must be logical partitions in the
extended partition.

Windows is going to want to have it's boot partition in
the primaries -- Linux doesn't care -- it's just happy
to be selected and will run anywhere. :D

konsolebox 09-29-2006 01:14 AM

Dive's already correct. This is only for a bit of more info.

Code:

[HEADER][Primary][------------------Extended-------------------]
[HEADER][-------][ExtHEADER][logical1][logical2][logical3][etc-]

The ExtHEADER's consider as primary in HEADER and the logicals means nothing to the HEADER. The extended header's only as little as 1 sector i guess. And the number of logicals can be up to at least 15 depending on the partitioner. Please correct me too if I'm wrong.

Galaxy_Stranger 09-29-2006 01:27 AM

You can only have 4 primary partitions. If you need MORE partitions, you can have up to 3 primary and the last extended containing logical partitions.

So, you could have 1-3 be primary and 4 be extended while containing more logical partitions.

-=[EDIT]=-
Duh - you beat me to it.

mickyg 09-29-2006 02:59 AM

I know this has already been covered but I just thought I'd share the way I've partitioned my HD so you can perhaps put it into perspective....
Code:

[----------------------------HD-------------------------------]
[Primary][Primary][Primary][--------------Extended------------]
[--hda1-][--hda2-][--hda3-][--hda5-][--hda6-][--hda7-][--hda8-]

Where

hda1 - NTFS 10GB /mnt/windows for Windows XP
hda2 - ext2 60MB /boot
hda3 - ext3 15GB / for Main Linux distr
hda5 - swap 1GB
hda6 - ext3 25GB /home
hda7 - fat32 5GB /mnt/shared for sharing between Linux and XP, shows up as D:\ in XP
hda8 - ext3 4GB /mnt/extra for testing distros, or re-mastering knoppix etc, anything else basically.

So as you can see you can pretty much partition your HD anyway you want as far as Linux is concerned.

Galaxy_Stranger 09-29-2006 03:07 AM

That's an excellent illustration.

konsolebox 09-29-2006 03:32 AM

yes and as you can see there's no hda4. it's simply the extended partition header. btw it's not just 1 sector perhaps it's 1 head.

michaelk 09-29-2006 07:07 AM

Just to be more confusing....
When hard drives became available for the PC one could only create 4 total partitions. As hard drives started increasing in capacity this became a big limitation. The extended partition was developed to overcome this limitation but still retain backwards compatabilty. The original 4 partitions are now known as primary.

An IDE drive can be subdivided into 64 partitions, 4 primary (1 designated as extended) and 60 logical partitions. A SCSI can be subdivided into 16 partitions (AFAIK this is a linux limitation). BTW Windows has a limitation of 26 total partitions i.e. A-Z. Any primary partition can be designated as an extended partition.

konsolebox, I believe you are refering to the boot sector as a header. Each primary partition has a boot sector. The extended partition has an extended master boot record which is just a pointer to the first logical. Probably too much information for the OP to comprehend at this time.

onebuck 09-29-2006 07:09 AM

Hi,

Quote:

Originally Posted by konsolebox
yes and as you can see there's no hda4. it's simply the extended partition header. btw it's not just 1 sector perhaps it's 1 head.

I don't want to be agruementative here just to clarify this.
If you do a fdisk -l on your system you will find something like this;
Code:

Disk /dev/hda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1  *          1        499    4008186    c  W95 FAT32 (LBA)
/dev/hda2            500        561      498015  82  Linux swap
/dev/hda3            562        811    2008125  83  Linux
/dev/hda4            812        4864    32555722+  5  Extended
/dev/hda5            812        1061    2008093+  83  Linux
/dev/hda6            1062        1438    3028221  83  Linux
/dev/hda7            1439        1563    1004031  83  Linux
/dev/hda8            1564        2062    4008186  83  Linux

The partition /dev/hda4 exists but is an extended partion containing the logical partitions. As for the proper terms of disk layout I suggest that you read this tutorial. A good example of the ext2 filesystem layout.

Quote:

Originally Posted by Galaxy_Stranger
You can only have 4 primary partitions. If you need MORE partitions, you can have up to 3 primary and the last extended containing logical partitions.

So, you could have 1-3 be primary and 4 be extended while containing more logical partitions.

-=[EDIT]=-
Duh - you beat me to it.

You can create the extended partition anywhere on the device that has primary partition numbers available. If you have a /dev/hda that has /dev/hda3 available and you wish to create an extended on that partition then do it. Of course the first logical will be /dev/hda5.

My personal taste is too create my swap if needed as device /dev/hda2 as seen in the below fstab example. Reasoning is the device access times for primary vs extended. You could create the swap on an extended but there would be propagation.

A fstab example;
Code:

/dev/hda2        swap            swap        defaults        0  0
/dev/hda3        /                ext3        defaults        1  1
/dev/hda5        /home            ext3        defaults        1  2
/dev/hda8        /usr            ext3        defaults        1  2
#
#12-31-05 12:00 gws old /usr
#/dev/hda6        /usr            ext3        defaults        1  2

/dev/hda6        /archive        ext3        defaults        1  2
/dev/hda7        /tmp            ext3        defaults        1  2
/dev/hda1        /mnt/win98      vfat        defaults        1  0
/dev/cdrom      /mnt/cdrom      auto        noauto,owner,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0

#09-12-06 23:00 gws
#mount bookmarks
192.168.0.1:/mnt/bookmarks /mnt/bookmarks nfs rw,suid,nolock,soft,intr  0 0

#192.168.0.1:/mnt/bookmarks /mnt/bookmarks nfs defaults  0 0
#192.168.0.1:/mnt/bookmarks /mnt/bookmarks nfs rw,intr    0 0
#192.168.0.1:/mnt/bookmarks /mnt/bookmarks nfs
#192.168.0.1:/mnt/bookmarks /mnt/bookmarks nfs rw,suid,nolock,soft,intr  0 0

As others have stated, partition scheme are varied and personal. But the terminology is not.

edit: correct spelling missed by LQ spell check.

konsolebox 09-29-2006 07:56 AM

Quote:

Originally Posted by gwsandvik
The partitition /dev/hda4 exists but is an exetended partion containg the logical partitions. As for the proper terms of disk layout I suggest that you read this tutorial. A good example of the ext2 filesystem layout.

No need thanks. I believe you're correct. That's what I believed about extended partitions before and I don't know how it changed. Perhaps it was the time when I created perfect-sized partitions (i mean *,000,000,000 in size) and I found out that creating a partition next to the header makes this impossible as this require at least that the partition starts on a cylinder and the header's only 1 head and not 1 cylinder. I don't know how but suddenly I've been thinking that the extheader is a primary partition.

About the illustration I posted above I think there's still nothing to change.

Thanks for the correction.

gnashley 09-29-2006 02:13 PM

A bit of advice for keeping windows happy on the same HD as Linux:
Make the first and last logical partitions either NTFS or FAT. Otherwise Windows may have trouble reading the partition table. This is covered in several MS Knowledge Base advisories.
The easiest way to accomplish this is to create all your partitons as windows-type, then afterwards change the ones you want to be Linux using Linux fdisk, but without destroying them or changing the size.

About that tutorial -I never in my life saw so much disinformation in so little space. It may help you to understand in a round-about way, but that guy needs to read up before writing anymore...


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