*BSD News Article 29089


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!uwm.edu!news.moneng.mei.com!howland.reston.ans.net!agate!boulder!cnsnews!benji.Colorado.EDU!frechett
From: frechett@benji.Colorado.EDU (-=Runaway Daemon=-)
Subject: I'm *this* close to mounting a dos partition in netbsd..
Message-ID: <CnMLBs.GvA@cnsnews.Colorado.EDU>
Summary: Help needed mounting a fully DOS formatted drive from netbsd
Keywords: NetBSD0.9 
Sender: usenet@cnsnews.Colorado.EDU (Net News Administrator)
Nntp-Posting-Host: benji.colorado.edu
Organization: University of Colorado, Boulder
Date: Sat, 2 Apr 1994 09:35:52 GMT
Lines: 82

Some time back Charles Hannun posted some tips on installing
a DOS partition from netbsd.  Something like this:

Quote:
1) Use NetBSD `fdisk' or DOS `pfdisk' to create a NetBSD partition
 spanning the whole disk in the MBR.
2) Save the MBR.  (dd if=/dev/rwd1d of=blah bs=1b count=1)
3) Create a NetBSD disk label containing the DOS partition, with the
 appropriate offset.
4) Write the label to the disk, blowing away the MBR and the rest of
 the boot track.
5) Restore the saved MBR.  (dd if=blah of=/dev/rwd1d bs=1b count=1)
I've done it many times now.
End Quote.

I am apparently lacking some critical bits of information or some
assumptions were made above that do not apply to my situation.
I have a Maxtor 7245 drive formated with geometry 966c/16h/31s.

1. I used a a dos based fdisk to have it create a partition the full
  length of the disk which should be cyl 0-165 size 479136 sectors.
  I set the type to 165 for NetBSD

Question: Assuming I want to use the whole drive this should be the ONLY
  parition on the drive.. correct?

Question: Do I do anything at this stage to indicate at all that I'm
  trying to create a DOS partition that spans the entire disk?

2. I saved the MBR as described above from netbsd.
3. I have a disktab entry that looks like
  maxtor245:Maxtor 7245: \
        :ty=winchester:dt=ST506:se#512:nt#16:ns#31:nc#967:rm#3600:\
        :pa#479136:oa#0:ba#8192:fa#1024:ta=MSDOS: \
        :pd#479136:od#0:bd#0:fd#0:td=unused:

Something odd happens when I look at the partition from netbsd with
fdisk.. It shows that the partition actually starts at sector 31
and thus the total size is decreased such that it is no longer a valid
multiple of the DOS block size 4096 bytes.
479136 - 31 = (47105s * 512 byte/s) / 4096 bytes/dos_block = 5888.125
and obviously I'm going to see
mountpcfs(): root directory is not a multiple of the clustersize in length
When I try to mount.
Undaunted I write the above disklabel with
> disklabel -w -r maxtor245

4. I follow the step above to restore the MBR

and try to mount from fstab or 
> mount -t msdos /dev/wd1a /msdos
and I do indeed get the above error.

Question: At what point do I actually go reformat the dos partition
  from DOS.  As soon as I write a disklabel DOS stops even recognizing
  that D: drive exists.  Only [p]fdisk can see it at all.

Question: How do I resolve the problem with it wanting to start
  at offset 31.  Obviously it looks like it needs room on the disk
  for the MBR starting at Sector 0.  Should the netbsd partition be
  from sector 0 to sector 47136 or from sector 31? 
  Does netbsd disklabel actually create a partition that DOS will
  be able to see?


Basically, the only setup I've seen work was when someone was working
with a little DOS partition somewhere right in the middle of their
netbsd formatted drive and it was conviently created with exact sizes  
such that the block size works out.   I really need to know where
the actual DOS side of it comes into play after I've basically destroyed
any knowledge DOS had of the disk.

BTW, I'm going through all this so I can backup my netbsd stuff to a
DOS formatted drive where I can then use my qic-02 tape to back
it all up, seeing as netbsd's and freebsd's wt.c can't seem to 
recognize my qic-02 controller.  One way or another I'm going to get
this crap backed up. 

Any and all information about mounting dos partitions or new and improved
qic controllers is appreciated.  Thanks.

	ian