Re: extended partitions

Andries.Brouwer@cwi.nl
Sat, 30 Sep 1995 22:12:16 +0100


Alain:

: Speaking of extended partitions:, has anybody else noticed that (raw)
: extended partitions have become inaccessible in the recent kernels?
: This makes it impossible to install lilo into the boot sector of an
: extended partition. Is this a bug or a feature?

Both, mostly a feature.
It is this line in genhd.c:

/* prevent someone doing mkfs or mkswap on
an extended partition */
hd->part[minor].nr_sects = 0;

Since nothing else depends on it, you can take it out.
But I think the advantages outweigh the disadvantages.

I have seen several horror stories from innocent newbies
who destroyed their file system on a logical partition
with mkswap on the extended partition, and variations
on this theme.
Not everybody realizes that doing things on /dev/hda4
might destroy /dev/hda5. In fact very few people know about
the properties of primary, extended and logical partitions.

So, the line quoted above sets the size of an extended partition
to zero, so that no-one can use it for swap or file system,
a protection for new users, and most users are new users.

The space actually available is 1 sector, sometimes 1 track.
But since Linux sizes are in blocks, and we typically only have
half a block, the size is set to zero. That is why you lose
the possibility to put lilo on this sector.

(The sector is of course still accessible via /dev/hda.)

In case it turns out that many people need this possibility
to install lilo, we may have to replace this simple statement
by more complicated code (or teach lilo how to use /dev/hda,
or teach the kernel how to handle partitions that end with a
fractional block).