mounting extended DOS partition in 386/ix

Steven H. Izen izen at amelia.nas.nasa.gov
Sat Sep 30 16:13:55 AEST 1989


Well, I've been inundated by mail request about mounting an extended DOS 
partition under 386/ix.

Those of you who are running 2.0.[12], it's a lot easier to set up, but as far
as I can tell you are limited to one additional 32 meg partition.  Those
of you who are still running 1.0.6, I think that you could get more than one
addtitional 32 meg partition up, but it was a real bitch to get any additional
partions configured at all (let alone build an extended partition if you have
a disk with more than 1024 cylinders).

WARNING:  Before attempting to set this up, back up everything on your hard
drive.  In order to configure the extra partition you need to do open heart
surgery to your partition table.  It is especially tricky if you are using a
big disk and version 1.0.6.  With 1.0.6 be very careful.  Any mistakes 
could blow away your boot sectors, requiring a re-format.  With 1.0.6 and a
300 Meg hard drive, that can take >3 hours. (I learned this the hard way
more than once while experimenting. :-( )

The basic idea is this.  The entry in the partition table for an extended
dos partition doesn't actually point to the partition, but rather to a 
secondary partition table.  This in turn points to the actual partitions.
The trick is to somehow tell unix where the partition actually starts.

For 1.0.6 people, I have paper notes on how I manged to build an extended
partition, and some more (incomplete) notes on how I told unix to find it.
As I recall, making the partition required a lot of work. Telling 386/ix
about it was somewhat easier.
The idea was to add an extra entry to /etc/partitions and then run mkpart.
If anyone wants details, send a SASE to me by snail mail at

	Department of Mathematics and Statistics
	Case Western Reserve University
	Cleveland, OH 44106
and I'll send you a copy of my notes. (I'm too lazy to type them in.)

For 2.0.[12] things were much easier.  The unix partition is /dev/dsk/0p1, the
primary DOS partition is /dev/dsk/0p2, and the extended DOS partition is 
/dev/dsk/0p3.  However, as mentioned above, this points to a table, not to the
partition itself.  However, there is one blank slot left in the partition 
table, known to unix as /dev/dsk/0p4.  All that needs to be done is to make
(by hand using a program such as Norton Utilities under REAL MODE DOS-not
VPIX) in the empty slot a dummy entry pointing to the actual start.  Make sure
that the partition type field is some  non-zero random value which is unknown
to DOS. I used 386/ix's partition signature.
That way DOS will effectively ignore that entry.

If it has been set up properly, the command
	/etc/mount -f DOS /dev/dsk/0p4 /wherever
should mount the extended partition on /wherever.  There should be a warning
message like "<DOS> mounted on /wherever".

The one extra partition limitation arises from the fact that there is only one
spare slot in the partition table.  

Here is what my partiton table looks like in NU (norton utitlities)
--------------------------------------------------------------------------------
      |    |  Starting location |  Ending location   |  Relative  | Number of
System|Boot|Side Cylinder Sector|Side Cylinder Sector|  Sectors   |  Sectors  
------+----+--------------------+--------------------+------------+-------------
      |    |                    |                    |            |
  ?   | No |  0     249      1  | 14    1023     35  |     130725 |    510300
DOS-16| Yes|  0       1      1  | 14     124     35  |        525 |     65100
EXTEND| No |  0     125      1  | 14     248     35  |      65625 |     65100
  ?   | No |  1     125      1  | 14     248     35  |      65660 |     65065
      |    |                    |                    |            |
------+----+--------------------+--------------------+------------+-------------Some explanation- The last line is the dummy entry.  Note that it points to side
one of the same cylinder as the start of the extended partition.  The extended
partition eats up the whole side (35 sectors on my disk) of that cylinder.
Thus, with a little arithmetic I obtain the relative start address
65660 = 65625 + 35, and the length- 65065 = 65100 - 35.  
Here is the hex for the partition table (as it appears from NU again)

|                               0000 01F9630E E3FFA5FE|
|01005CC9 07008000 0101040E 237C0D02 00004CFE 00000000|
|017D050E 23F85900 01004CFE 00000001 017D230E 23F87C00|
|010029FE 000055AA                       ^^
                                         ||

This is at the end of the boot sector (side 0, cyl 0, sector 1).

The 23 above the arrows is the system selector for the fourth entry.

Here is the partition table format:
It starts at offset 446 = 0x1BE

struct partition_table{
unsigned char boot;		/*00=not active, 0x80=active */
unsigned char start_head;	/*0 to 15 (on my disk) */
unsigned char start_sector;     /*1 to 35 (on my disk) */
unsigned char start_cyl;	/*0 to 1023 - overflow bits(high order) go
				  into high order of start_sector */
unsigned char system;		/*01=primary DOS,0x63=1.0.6 unix, 0x23=2.0.2
				  unix, 05=extended dos*/
unsigned char end_head;
unsigned char end_sector;
unsigned char end_cyl;		/*same format as start_cyl*/
unsigned int  relative_sectors;	/*4 bytes, starting sector (rel. from 0)*/
unsigned int num_sectors;	/* 4 bytes, length in sectors */
} table[4];
Here table=0x1BE, and the half-word *(table+4) is AA55.


Once I got the two dos partitions mounted simultaneously, I then needed to
configure real mode dos and vpix, so that everything looked the same to 
programs, no matter which environment they were under.  The problem was that
vpix has it's own C: drive, and real mode dos labels the extended 
partition as D:.  My solution was: Under vpix, dosmount as D: the unix directory
coreesponding to the extended partition, dosmount as f: the unix directory 
corresponding to the primary dos partition, and dosmount as E: /usr/tmp.
Under real mode dos, subst F: to C:.  Then have all the software configured
to use F: or D:, and E: as temporary storage.  Under vpix it gets /usr/tmp,
and under real dos it gets the ramdisk.

I would appreciate feedback if anyone else gets this working.
The top two addresses in the .signature are the preferred address due to
#$%# disk quotas on the VMS machine cwru.cwru.edu.
			 ^
			 |
			YUCK
-- 
Steve Izen: {sun,uunet}!cwjcc!skybridge!izen386!steve
or steve%izen386.uucp at skybridge.scl.cwru.edu
or izen at cwru.cwru.edu		"My second bike is a car."



More information about the Comp.unix.i386 mailing list