Since I have inadvertently caused a bit of a flap and some consternation,
let's see if I can document how partitioning works on PCs. If anyone can
fill in my question marks, or correct me, please do.

Any one hard drive on a PC can have up to 63 partitions on it, not all of
which can hold file systems. These come in three flavors: primary,
extended and logical. This is Microsoft's terminology, so don't expect it
to make sense. This scheme grew up, one could say, metastasized, over the
years. The culprits include Microsoft, Digital Research and others. As I
have just shown, it is confusing even to those who think they know what
they are doing.

At most one partition with a file system on it may be marked
bootable. BIOS, boot loader (e.g. lilo, System Commander) and operating
system limitations may prevent a marked partition from booting, however.

Primary partitions are numbered from one to four only. Each may hold one
and only one file system, of any type. There must be at least one primary
partition on a hard drive. Due to limitations of Mess-DOS and Windows 9x,
these operating systems are often placed on the first primary partition.

Extended partitions may also be numbered from one to four. (I have never
seen partition one made an extended partition, and have not done any
experiments on the point, so I could be wrong about that.) Extended
partitions are containers for logical partitions. As such they do not
contain file systems themselves.

The sum of primary and extended partitions may not be greater than four.

Logical partitions are contained within extended partitions. I conjecture
that you can have up to 16 (64 total possible partitions divided by 4
possible extended partitions) logical partitions to an extended partition,
but have never tested this.

Logical partitions may not overlap with other logical partitions
Similarly, extended partitions may not overlap each other, nor may primary
partitions overlap each other. Primary and extended partitions may not
overlap each other.

A logical partition must be wholly contained within one and only one
extended partition.

So the way to verify a partition table is:

* Identify the primary and extended partitions, one through four. Check
  for overlaps between them.

* Identify the logical partitions, 5 through 63 inclusive. Check for
  overlaps between them. Check that each partition is wholly contained
  within its extended partition.

* Check that one and only one partition is bootable. Check that the boot
  loader will support that partition.


That done, and with the high probability of corrections to come, let's
see Laurent's original partition table looks like.

Disk /dev/hda: 240 heads, 63 sectors, 1299 cylinders Units = cylinders of
15120 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1       277   2094088+   6  FAT16
/dev/hda2           278       556   2109240    5  Extended
/dev/hda3   *       557       563     52920   83  Linux
/dev/hda4           564      1268   5329800   83  Linux
/dev/hda5           278       556   2109208+   7  HPFS/NTFS

hda1    Primary.        No overlaps.
hda2    Extended.       Does not overlap with any primary or extended partitions.
hda3    Primary.        No overlaps.
hda4    Primary.        No overlaps.
hda5    Logical.        Contained entirely within, and fills up entirely HDA2,
                        and does not overlap any other partitions.

OK, now that I have done all that, I see the mistake I made earlier. I
incorrectly identified hda3 and hda4 as extended partitions when they are
in fact primary partitions.

My apologies to Laurent, and my thanks 

-- 

                -- C^2

No windows were crashed in the making of this email.

Looking for fine software and/or web pages?
http://w3.trib.com/~ccurley

Reply via email to