Brother xiaojun, I’m really sorry, the documentation for grub for dos 0.2.0 was not written in enough detail or comprehensively enough.
1。The hard disk emulation feature of grub for dos 0.2.0 can be used to emulate the “container” of an extended partition, but it cannot emulate a specific “extended partition” inside that “container.” I’m now trying to explain this concept clearly, but it really isn’t easy to explain clearly. Why? Because in DOS and Windows, “extended partition” is a very vague concept; at least, I myself feel it is very vague. When we use DOS FDISK to create an extended partition, what we first create is a framework for the extended partition (or for now, let’s call it the “container” of the extended partition), not the extended partition itself directly. This “container” contains a partition table, so it can be emulated as a virtual hard disk. Otherwise, if it were like an ordinary partition and had no partition table, then it could only be emulated as a virtual floppy disk (because a floppy image and a partition image are the same, both starting with a DOS boot record and containing a BPB table).
For example, we usually create a primary partition (hd0,0) on the hard disk 【that is, logical drive C:】, and then create something called (hd0,1) as a “container.” Inside this “container,” we then create some specific extended partition 【for example (hd0,4), that is logical drive D:】. Only (hd0,1) can be used to emulate a virtual hard disk. Both (hd0,0) and (hd0,4) can only be used to emulate a floppy disk.
Note that here, (hd0,1) is similar to the hard disk master partition table (hd0), equivalent to a complete hard disk structure, so it can be emulated as a hard disk. Specific partitions such as (hd0,0) and (hd0,4), however, do not have a partition table structure; they only have the DOS BPB structure, and therefore cannot be emulated as hard disks.
What was discussed above is using existing partitions to emulate floppies, and using existing “containers” to emulate hard disks. When an img file is used, all of the above limitations no longer apply. That is, when using an img file on the hard disk to emulate either a hard disk or a floppy disk, there are none of the limitations mentioned above. Because when you create this img file, you have already put a partition table into it 【because what you are emulating is a hard disk; as for a floppy image, of course there is no partition table】.
Using existing partitions and “containers” has two advantages: first, you do not need to create an additional img file; second, when you are not using emulation, you can still access the files in these partitions (and “containers”).
Correspondingly, using an img file for emulation has two disadvantages: first, you need to create a contiguous img file on the hard disk; second, when you are no longer using the emulation, the files in that img image cannot be directly accessed by DOS/Win98, and you must rely on utility software such as WinImage.
The above is an attempt to explain some of the technical issues encountered here, but I don’t know whether I’ve explained them clearly enough.
2。Next, let me explain the second problem you ran into:
Linux hda is (hd0) in grub
Linux hdb is (hd1) in grub
Linux hdc is (hd2) in grub
Linux hdd is (hd3) in grub
Linux hda1 is (hd0,0) in grub
Linux hda2 is (hd0,1) in grub
Linux hda3 is (hd0,2) in grub
Linux hda4 is (hd0,3) in grub
Linux hda5 is (hd0,4) in grub
Linux hda6 is (hd0,5) in grub
Linux hdb1 is (hd1,0) in grub
and so on.
Note that (hd0,0), (hd0,1), (hd0,2), and (hd0,3) are the four primary partitions on hard disk hda 【that is, grub’s (hd0)】. Among them, (hd0,1) is usually a “container,” and partitions from (hd0,4), (hd0,5), and so on are all included within this “container.”
hda 【that is, grub’s (hd0)】 itself is also a “container”; it contains the four partition table entries (hd0,0), (hd0,1), (hd0,2), (hd0,3).
You cannot emulate hard disk hda as a floppy disk, because hard disk hda contains a partition table, while a floppy disk does not. By the same reasoning, you cannot emulate the container (hd0,1) as a floppy disk either; it can only be emulated as a hard disk.
You cannot emulate partitions such as (hd0,0), (hd0,4), (hd0,5), and so on as hard disks, because they do not have partition tables; they can only be emulated as floppy disks.
Therefore, your hda5 or hda6 is destined to be emulated only as a floppy disk. If you want to emulate a hard disk, you must use (hd0,1), or in other words Linux hda2.
DOS/Win98 generally uses (hd0,1) as the “container.” But some other companies’ software may perhaps set the “container” differently, for example as (hd0,0), (hd0,2), or (hd0,3).
Only a primary partition can serve as a “container,” so on hard disk (hd0), the only possible partition table entries that can serve as a “container” are the following four:
(hd0,0)
(hd0,1)
(hd0,2)
(hd0,3)
Similarly, on hard disk (hd1), the only possible partition table entries that can serve as a “container” are also the following four:
(hd1,0)
(hd1,1)
(hd1,2)
(hd1,3)
All this may look very complicated, but it is not all that complicated. I hope this can help you solve the problem you ran into.
因为我们亲手创建,这个世界更加美丽。