Subject: Re: Installing from dos-formatted ZIP drive
To: Martin Loeffler <martin.loeffler@utoronto.ca>
From: Eric S. Hvozda <hvozda@netcom.com>
List: port-i386
Date: 02/27/1996 07:50:54
On Mon, 26 Feb 1996 20:48:28 -0500  martin.loeffler@utoronto.ca wrote:
> 
> Now, in the FAQs I've noticed mention made of enabling the kernel for
> 'MSDOSFS'. Is there something I yet need to do to the kernel to support
> this?

Yes, you need a disklabel on the drive where MS-D0G lives and then
you need to add the partition info for MS-D0G to the disklabel
(I use 'disklabel -e' myself).  This might be some aid to you; Ken
Hornstein posted this awhile back; (Ken do you have a more up to date
copy of this document?)

To: current-users@sun-lamp.cs.berkeley.edu
Subject: Accessing your MS-DOS parition from NetBSD
	WIn3jU;bql;{2Uq%zw5bF4?%F&&j8@KaT?#vBGk}u07<+6/`.F-3_GA@6Bq5gN9\+s;_d
	gD\SW #]iN_U0 KUmOR.P<|um5yP<ea#^"SJK;C*}fMI;Mv(aiO2z~9n.w?@\>kEpSD@*e`
Date: Tue, 23 Aug 1994 14:12:39 -0400
From: Ken Hornstein <kenh@wrl.EPI.COM>

There was some discussion on netbsd-help on the right way to access a MS-DOS
parition from NetBSD.  Here's the instructions I posted there, with some
improvements suggested by Mike Long.  I figure this might help someone who's
having problems doing this.  As always, corrections and suggestions are
welcome.

		ACCESSING MS-DOS PARTITIONS FROM NetBSD-i386

First off, it's important to understand BSD disklabels.  The disklabel is a
description of the Unix parition layout and other disk parameters stored
on-disk, usually somewhere in the first couple of sectors.  There is a
maximum of 8 partitions, labelled "a" thru "h".  Typically partition "a" is
assigned to the root partition, partition "b" is configured as a swap area,
and partition "c" is defined as the whole disk.  You can change these, but
it's a good idea to stick with this scheme, as many programs assume that's
the way things are going to be.

If you're whole disk is dedicated to Unix, then that's all you need to know.
But if you're sharing your disk with DOS, then there are a few magical things
happening.

DOS has it's own partitioning scheme.  The way NetBSD co-exists with this is to
fit all of the Unix partitions into one DOS partition.  So partitions a-h all
fit inside one DOS partition, which has a partition type of 165 (each MS-DOS
partition has a "partition type" associated with it.  The BSD partition type
is 165).  In this setup, partition "c" refers to the entire BSD partition.
But in this scheme, partition "d" refers to the ENTIRE disk, MS-DOS partitions
and all.

So, if you want to access your MS-DOS partition from NetBSD, first you'll have
to create a partition that points to the MS-DOS partition.  You'll want to
run the command:

disklabel -e -r /dev/r??0d		(fill in with your disk type).

You'll get popped into an editor with all the disklabel stuff in it.  Go down
to the bottom.  You should see something like:

6 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:    30720   409600    4.2BSD     1024  8192    16   # (Cyl.  200 - 214)
  b:   129024   440320      swap                        # (Cyl.  215 - 277)
  c:  1617920   409600    unused        0     0         # (Cyl.  200 - 989)
  d:  2029568        0    unused        0     0         # (Cyl.    0 - 990)
  e:    61440   569344    4.2BSD     1024  8192    16   # (Cyl.  278 - 307)
  f:  1396736   630784    4.2BSD     1024  8192    16   # (Cyl.  308 - 989)

(or whatever it appropriate for your disk).  Note how partition "a" starts on
cylinder 200?  That's where my BSD partition starts on my disk.  Also note that
partition "c" starts at 200 as well and goes to the end of the disk.  You'll
also note that partition "d" goes from sector 0 all the way to the end of the
disk.

Add a new line that looks something like:

  g:   409568       32    MS-DOS                        # (Cyl.    0*- 199*)

(The comment on the end isn't necessary.  Only the partition letter, size,
offset, and parition type are needed.  You can put unused if you want).

*NOTE* Be sure to change the line that says "6 partitions" to the new number
of paritions that you have!!!  Otherwise you'll get an obscure error.  In my
case I'd change that line to be "7 partitions".  If you aren't sure what your
MS-DOS partition size and offsets are, you can use the NetBSD fdisk to find
them out.  Don't forget that there's a maximum of 8 partitions.

Once you do that and you have MSDOSFS configured into your kernel, you can
just do something like "mount -t msdos /dev/sd0g /msdos".  Or you can put
a line like this in your fstab:

/dev/sd0g /msdos msdos rw 0 0

If you want to access a DOS-only HD from NetBSD, here are some instructions
posted by Charles Hannum a while back.  I haven't tried them myself, but they
seem like they would work.

Date: Fri, 4 Mar 1994 07:50:08 -0800
From: Charles Hannum <mycroft@sun-lamp.cs.berkeley.edu>
To: current-users@sun-lamp.cs.berkeley.edu
Subject: Mounting an all-DOS disk in NetBSD


Assuming you don't have something (like OS-BS) which uses the extra
sectors in the boot track, you can do the following:

1) Use the NetBSD `fdisk' or DOS `pfdisk' to create a NetBSD partition
in the MBR which spans the entire disk.

2) Save a copy of the MBR:

	dd if=/dev/rsd0d of=my-mbr bs=1b count=1

3) Use `disklabel' to create a NetBSD label with the DOS partition and
whatnot.  Answer `y' when it asks you if you want to `overwrite [a]
disk with [a] DOS partition table'.

4) Put back the saved copy of the MBR:

	dd if=my-mbr of=/dev/rsd0d bs=1b count=1

This works for me.  Your milage may vary.