From: Rick Moen
Subject: Re: [svlug] Keeping Win partitions during migration
Date: Thu, 27 May 1999 01:00:00 -0700

[This is a long and possibly over-complex reply, for which I apologise, but you raised some issues that were more difficult to explain coherently than I thought they would be, when I started.]

Quoting hell-bent for naugahyde (

> I have two HDs, device C: is 3.5G with one partition, other drive is a
> 6.8G partitioned into two ext filesystems, attached to D: and E:.

The expression "two ext filesystems, attached to D: and E:", interpreted literally, actually doesn't make sense. Allow me to explain: When DOS, Win9x, WinNT, or OS/2 first boots up, it inventories the partitions it is capable of recognising as valid storage (partition types that the particular OS kernel understands) on all accessible drives, and assigns them drive letters at that time.[1]

Please note that the drive letters are assigned to partition entries in drives' partition tables, not to physical drives, and that this process is performed afresh each and every time the OS boots. Therefore a drive-letter assignment is not an inherent property of a given specific partition: Instead, what letter a partition receives at boot time depends on what other partitions the OS observes at that time, in the various physical drives' partition tables.

You follow? OK, therefore, you really shouldn't think of a partition as being inherently "D:" or "E:". For example, if you were to split the first drive's "C:" partition into three replacement partitions, all primary, then the second physical drive's partitions would, after the next reboot, be seen as "F:" and "G:", instead of "D:" and "E:". Drive-letter identities are dynamic, in that sense.

Getting back to your specific situation, please let me rephrase what I think you meant:

You have a physical hard drive with one 3.5GB FAT partition. Assuming this drive is IDE, that partition would be referred to by Linux as hda1. You also have a 6.8GB physical hard drive with two FAT partitions, created as logical drives inside an "extended partition" container.[2] Assuming this drive is IDE, and is also on the primary IDE chain, those partitions would be hdb5 and hdb6. (If on the secondary master drive, they would be hdc5 and hdc6. If on the secondary slave drive, they would be hdd5 and hdd6.)

> Given that, is it possible to store data that I want to keep on (for
> example) the E: partition, and install Linux while keeping the
> partition (and data) intact, then mounting it as a VFAT partition
> under Linux long enough to retrieve the data?

Yes. While inside your Linux distribution's partitioning tool, you could blow away hda1 and hdb5, while leaving hdb6 (your "E:" partition) intact. You could replace the former two with a couple of ext2 (Linux-native) partitions and a swap partition, complete your installation, reboot, mount your hdb6 partition as type "VFAT", and then unpack your tar-gzipped files off of them.

mkdir /mnt/edrive
mount -t vfat /dev/hdb5 /mnt/edrive

[1] DOS/Win9x assigns letters first to all primary FAT partitions on the first physical drive, then primary FAT partitions on the second physical drive, etc., then to all logical-drive partitions on the first physical drive, then all logical-drive partitions on the second physical drive, etc. WinNT applies the same logic, but gives letters to FAT, HPFS, and NTFS partitions. OS/2 also applies the same logic, but assigns letters to FAT and HPFS partitions.

[2] DOS/Win9x's brain-dead partitioning tool, FDISK.EXE, seems to steer people towards "logical-drive" partitions where primary ones would serve just fine and be less confusing. This is unfortunate.

A physical drive's partition table has exactly four entries. Linux always calls these entries (when on a primary master IDE drive) hda1, hda2, hda3, and hda4, whether they're used for anything or not. Each of the four entries may be either be unused, or describe a primary partition, or describe an extended partition.

A primary partition is a simple, regular, data-bearing partition (once it's formatted, which in Linux is done with mke2fs). Simple, easy to understand. An extended partition, by contrast, is a container. It points to a subsidiary partition table describing how the total space within the extended partition shall be divided up. The entries in the subsidiary partition table are called "logical drives".

Linux's partitioning tools allow you to use (if you wish) one of the four main partition entries as an extended partition. Used that way, the entry in the main partition table (of type "extended") will still be listed in Linux's partitioning tools, even though it is not, in itself, a data-bearing partition (but rather a container). It would therefore be assigned (by the Linux kernel) one of the first four partition numbers (1, 2, 3, or 4). Because the first four numbers are always assigned as described, any logical drives you create within the extended partition will get numbers starting with 5. Thus, finally, your existing setup on the second physical drive would be seen by Linux like this:

Device Boot Start End Blocks Id System
/dev/hdb1 1 1980 68000000 5 Extended
/dev/hdb5 1 990 34000000 b Win95/FAT32
/dev/hdb6 991 1980 34000000 b Win95/FAT32

...or something similar.

Last, please bear in mind that the entire scheme described above, derived from DOS/Windows and OS/2, is not the only one possible (or used) on Intel-standard hard drives. You may, at some point, encounter different top-level partitioning schemes characteristic of the BSD Unixes, Macintoshes, Amigas, etc. These can be comprehended by recent Linux kernels and partitioning tools. With luck, you won't come across them for a while.

'Hope this helps.

Cheers, My pid is Inigo Montoya. You kill -9
Rick Moen my parent process. Prepare to vi.

From: "Reginald B. Charney"
Organization: Charney & Day Incorporated
X-Mailer: Mozilla 4.51 [en] (Win95; I)
To: Rick Moen
Subject: Re: [svlug] Keeping Win partitions during migration
Date: Thu, 27 May 1999 01:07:26 -0700

Your reply is excellent, but the assignment of DOS drive letters is incorrect. The drive letter assignments follow two major phases:

PC DOS Partitions

Space on PC hard drives can have be one of four general types:

  1. Free - unallocated space, no one owns it and it does not get a DOS logical drive letter.

  2. Primary - normally allocated one DOS logical drive letter. It is also optionally bootable.

  3. Extended - a container for logical drives. Each logical partition gets a different DOS logical drive letter. An extended partition can not serve as a boot drive. The extended partition itself does not get a drive letter in DOS/Windows. You can only have one extended partition per physical hard drive.

  4. non-DOS - allocated partitions not recognized by DOS or Windows 95/98/NT and not assigned drive letters, such as partitions allocated to Linux file systems.

On a given physical hard drive, you are limited to either 1-4 primary partitions or 0-3 primary partitions and an extended partition. You can have up to 24 logical drives in an extended partition. The total number of DOS recognized logical drives per system is 26, i.e., since each logical drive and each floppy drive takes up a letter, you are limited to the 26 letters of the ANSI alphabet [I am unsure of which standard alphabet applies here.]. MS-DOS 5.0 and later and Windows can handle up to 8 physical disks.

Rules for General DOS drive letter assignments

E.g. Consider a system with 2 EIDE physical hard drives, a SCSI CD-ROM defined in the CONFIG.SYS file and a ram disk drive, where the first hard drive has a primary partition, an extended partition with 2 logical partitions, and a second primary partition. The second hard drive has two primary partitions and an extended partition with two logical partitions. Then, the drive letter assignments are: C for disk 1 primary partition 1, D for disk 2 primary partition 1, E and F for logical partitions 1 and 2 on the first disk, G and H for the logical partitions on disk 2, I for the second primary partition on disk 1 and J for the second primary partition on disk 2. The CD-ROM drive gets drive letter K and the RAM disk get drive letter L. Thus, the correspondence between DOS drive letters and Linux device names is:

C: hda1
D: hdb1
E: hda5
F: hda6
G: hdb5
H: hdb6
I: hda2
J: hdb2
K: sdc1
L: n/a

Hope this helps.


P.S. The reference document I have used can be found at - Microsoft "Order in Which MS-DOS and Windows Assign Drive Letters" (Knowledge Base article number Q51978)