View Full Version : Don't understand the whole partitioning setup in Linux
jacatone
04-21-2007, 02:19 AM
I installed Ubuntu 6.06 as a dual boot with XP Pro. I decided to add Kubuntu as well to see the differences and similarities between the distros. I created the partition for Kubuntu using GParted but when I tried using the manual install setting in the OS, it gave me this confusing array of ext 2,3,4 and 5 as well as hda1 (ntfs), hda2, hda3 and Primary, Logical drives so on. Plus there were swap files to configure. Could someone give me a simple explanation of this whole Linux partitioning thing? Thanks.
kilgoretrout
04-22-2007, 01:26 PM
ide primary master = hda
ide primary slave = hdb
ide secondary master = hdc
ide secondary slave = hdd
For sata drives the scsi protocol is used. first sata drive is sda, the second drive is sdb, etc.
The partitions on hd* or sd* are numbered in order, i.e. the first primary partition on hda is hda1. Logical drives start at number 5 regardless if all the four primary partitions are being used on the drive, i.e. the first logical partition on hda is hda5.
ext2, ext3, reiserfs and xfs are native linux filesystems. After you partition the drive you have to choose which filesystem you want to use for your install. ext3 and reiserfs are currently the most popular.
If you already have ubuntu installed with its own swap partition, almost all linux distros will detect the existence of that swap partition and use it during the install, i.e. swap partitions can be safely shared between distros.
jacatone
04-22-2007, 05:55 PM
Thanks kilgoretrout, it's all starting to make sense. What is the purpose of the Primary and Logical partitions? Does this distinction exist in Windows as well, or is it just a Linux feature?
kilgoretrout
04-22-2007, 06:21 PM
The distinction between primary and extended/logical drives is a hardware/bios limitation AFAIK. Back in the day you were limited to four partitions on a hard drive. This system was initially developed when 100MB was considered a huge hard drive so no one foresaw the need for more than four partitions on a drive.
As drives grew bigger, the 4 partition limit became more of a problem. "Extended" or "Logical" partitions were developed to get around this inherent 4 partition limit. The idea is that one old school "primary" partition can be used as a container for many "logical" drives or partitions.
However, some OSes still need to be installed on a primary partition to be bootable so the distinction is important to keep in mind. IIRC the older dos based windows OSes need a primary partition and will refuse to install on a logical partition. Not sure about NT based window OSes but I can't imagine vista still has the primary partition requirement. Linux can install on either primary or logical. Most unix BSDs require a primary partition.
Correct me if I'm wrong, but I was under the impression you could only have multiple logical drives on an extended partition.
kilgoretrout
04-22-2007, 09:34 PM
That's exactly my understanding as well. The terminology gets a little confusing however. The "extended partition" that contains the logical drives takes up one of the four primary partitions AFAIK. So if you make an extended partition with logical drives, you can only create three more primary partitions. For example, I have a hard drive with one primary partition and three logical partitions. Here's the output of fdisk -l which in linux lists the partition structure for that drive:
fdisk -l /dev/hde
Disk /dev/hde: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hde1 * 1 2095 16828056 c W95 FAT32 (LBA)
/dev/hde2 2096 9729 61320105 f W95 Ext'd (LBA)
/dev/hde5 2096 3070 7831656 b W95 FAT32
/dev/hde6 3071 7353 34403166 b W95 FAT32
/dev/hde7 7354 9729 19085188+ 83 Linux
Notice how the second primary partition, hde2, is listed as extended consisting of blocks 2096 through 9729. But the logical drives contained in the extended hde2 partition, hde5, hde6, and hde7, actually are the logical partitions taking up those blocks.
I believe that's the case. With a standard automatic linux install, you will get 1 primary partition and one extended partition. The primary contains the boot/OS partition, and the extended contains swap and any data partitions.
rhysox
04-26-2007, 07:44 PM
kilgoretrout is spot on here.
mojo- not correct. there is no "automatic linux install", you as as linux user can choose how you wish to partition your disk, and get linux to mount different directory structures where-ever you choose.
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.