patch: partition type f

Janet Walz (jwalz@Radix.Net)
Fri, 16 Jan 1998 14:17:43 -0500 (EST)

As complained about by a number of people in comp.os.linux.* groups
over the last year, the Windows 95 fdisk will create large extended
partitions as type f instead of the DOSish type 5 or special-case Linux
type 85. Linux doesn't know about type f, so no partitions inside that
extended partion can be seen.

We found the problem when installing a new large SCSI disk for Windows 95,
and had hoped to mount the Windows partitions from Linux for ease of copying
and backing up and such. Poking at the disk with dd etc. showed that
inside that type f extended partition was a standard type 6 large DOSish
logical partition and a type 5 chain extended partition. The rest of
the chain was also all types 6 and 5.

Checking the kernel source, the fields Linux uses work the exact same way for
types f and 5 (based on the one sample on hand). Thus, the following trivial
patch to the kernel (of apparently any recent version -- 2.0.30, 2.0.33, and
2.1.76 have no differences in these areas.) This allows the kernel to find
the logical partitions inside a type f partition, changing the boot messages
munin kernel: sdc: sdc1 sdc2 sdc3 sdc4
munin kernel: sdc: sdc1 sdc2 sdc3 sdc4 < sdc5 sdc6 sdc7 sdc8 >
for the disk in question, and allowing mount to work on sdc5 etc. later
on (assuming fat/vfat filesystem support was compiled in the kernel).

This should really be as trivial as it looks, but there are only two test
cases at this point -- my system and that of a recent comp.os.linux.*

Also note that this is only a solution to half the problem. You can see
and access the existing partitions inside a type f, but until the Linux
fdisk knows how to deal with type f partitions, you still won't be able
to put Linux-type logical partitions inside a type f, and Windows 95
fdisk seemed to reject the idea of large type 5s. (This problem is more
complicated because fdisk has to write out more fields in the partition
table for Windows' benefit than the Linux kernel actually uses itself,
and while the one sample on hand now makes sense, I'd prefer some more
Windows tables with type f's to generalize from.)

*** include/linux/genhd.h.fcs Mon Oct 6 16:50:26 1997
--- include/linux/genhd.h Fri Dec 26 15:44:19 1997
*** 25,30 ****
--- 25,33 ----
confused about extended/logical partitions starting past cylinder 1023. */
+ /* Windows 95 uses this for LBA access; the sector numbers and chaining
+ seem to work exactly the same as for the DOS kind. */

#define DM6_PARTITION 0x54 /* has DDO: use xlated geom & offset */
#define EZD_PARTITION 0x55 /* EZ-DRIVE: same as DM6 (we think) */
*** drivers/block/genhd.c.fcs Wed Aug 21 02:18:07 1996
--- drivers/block/genhd.c Fri Dec 26 15:45:06 1997
*** 102,107 ****
--- 102,108 ----
static inline int is_extended_partition(struct partition *p)