Subject: Re: err(3) and error handling
To: None <cp1!mimsy!NetBSD.Org!current-users@cs.UMD.EDU>
From: None <cp1!ganza!jes@cs.UMD.EDU>
List: current-users
Date: 02/10/1995 16:02:56
I followed this thread with interest, since I got the same
"mount_msdos: invalid argument" after attempting to edit my disklabel
to tell NetBSD where DOS lives.  In my gut, I knew that the invalid
argument was not one of the command-line parameters, but the
condition of the partition where mount was looking.

I had followed the FAQ instructions in building the disklabel, but
too literally!  This may be the problem that others have run into,
so please bear with me if it already works for you...

The 386FAQ (all rights reserved by them, etc.) says:

! 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...
! 	b:   129024   440320      swap                        # (Cyl...
! 	c:  1617920   409600    unused        0     0         # (Cyl...
! 	d:  2029568        0    unused        0     0         # (Cyl...
! 	e:    61440   569344    4.2BSD     1024  8192    16   # (Cyl...
! 	f:  1396736   630784    4.2BSD     1024  8192    16   # (Cyl...
! 
! (or whatever it appropriate for your disk).  Note that 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*)
                     ^^--> I used this first; see below.
! 
! (The comment on the end isn't necessary.  Only the partition 
! letter, size, offset, and parition type are needed.  You can 
! put unused in instead of MS-DOS 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 
     (I thought I was sure :-(
! 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

It seemed plausible to use 32 (nice 2 bit number) as the offset,
but the real answer was to use fdisk to get the actual offset,
which is supposed to be the number of sectors/track, i.e., skip 1
track.

! Information from DOS bootblock is:
! The data for partition 0 is:
! sysid 6,(Primary 'big' DOS (> 32MB))
!     start 57, size 123063 (60 Meg), flag 0
         (offset)    (size)
! 	beg: cyl 0/ sector 1/ head 1;
! 	end: cyl 143/ sector 57/ head 14

so my disklabel line looks like this, now:

  f:   123063       57    MS-DOS                    	# (Cyl.    0*- 143*)

/jes <cp1!ganza!jes@cs.UMd.Edu>