Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2006 10:17:34 -0400 (EDT)
From:      Jerry McAllister <jerrymc@clunix.cl.msu.edu>
To:        petermatulis@yahoo.ca (Peter)
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: seeking help on "adding a disk"
Message-ID:  <200604101417.k3AEHY3S015943@clunix.cl.msu.edu>
In-Reply-To: <20060410044418.98537.qmail@web60015.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Hi everyone.  I am having trouble adding a IDE 300 GB Maxtor to my 6.0
> system.  It is recognized as ad2.  Here is dmesg:
> 
> ad0: 39205MB <Maxtor 6K040L0 NAR61HA0> at ata0-master UDMA133
> ad1: 190782MB <Seagate ST3200826A 3.03> at ata0-slave UDMA100
> ad2: 286188MB <Maxtor 6L300R0 BAJ41G20> at ata1-master UDMA133
> 
> I want to devote the entire disk to FreeBSD and use a single slice and
> partition and mount it on directory /images.
> 
> This is what happened:
> 
> # dd if=/dev/zero of=/dev/ad2 bs=1k count=64
> 64+0 records in
> 64+0 records out
> 65536 bytes transferred in 0.005377 secs (12188086 bytes/sec)
> 
> # fdisk -B -I /dev/ad2
> ******* Working on device /dev/ad2 *******
> fdisk: invalid fdisk partition table found
> fdisk: Geom not found
> 
> # bsdlabel -w -B /dev/ad2s1
> 
> # fdisk ad2
> ******* Working on device /dev/ad2 *******
> parameters extracted from in-core disklabel are:
> cylinders=581463 heads=16 sectors/track=63 (1008 blks/cyl)
> 
> Figures below won't work with BIOS for partitions not in cyl 1
> parameters to be used for BIOS calculations are:
> cylinders=581463 heads=16 sectors/track=63 (1008 blks/cyl)
> 
> Media sector size is 512
> Warning: BIOS sector numbering starts with sector 1
> Information from DOS bootblock is:
> The data for partition 1 is:
> sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
>     start 63, size 586114641 (286188 Meg), flag 80 (active)
>         beg: cyl 0/ head 1/ sector 1;
>         end: cyl 854/ head 15/ sector 63
> The data for partition 2 is:
> <UNUSED>
> The data for partition 3 is:
> <UNUSED>
> The data for partition 4 is:
> <UNUSED>
> 
> # bsdlabel ad2s1
> # /dev/ad2s1:
> 8 partitions:
> #        size   offset    fstype   [fsize bsize bps/cpg]
>   a: 586114625       16    unused        0     0       
>   c: 586114641        0    unused        0     0         # "raw" part,
> don't edit
> 
> 
> Now shouldn't I have some values in the first (a:) row?
> 
> Anyway, when I try to create a filesystem with newfs I get an error:
> 
> # newfs /dev/ad2s1a
> ..., 450493504, 450869856, 451246208,newfs: wtfs: 65536 bytes at sector
> 451622560: Input/output error
> 
> Now please let me know if my method is sound.  I feel the drive size is
> not being properly recognized and that
> the last command is trying to write past the edge of the disk.  I would
> also like to not be using s1a but s1e instead.
> 
> Furthermore, the docs [1] for this drive say that an 80-wire cable is
> required.  I didn't have one handy so I had to
> use a 40-wire cable.  Could this be causing the trouble?
> 
> Thanks for any insights (I have a hell of a time working with disks on
> FreeBSD).

It looks like things worked up to the bsdlabel which didn't do anything. 
Namely, after doing the fdisk, even though you saw some errors,
you seem to have gotten a single slice with everything in it just
as you wanted.  

  > The data for partition 1 is:
  > sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
  >     start 63, size 586114641 (286188 Meg), flag 80 (active)
  >         beg: cyl 0/ head 1/ sector 1;
  >         end: cyl 854/ head 15/ sector 63
  > The data for partition 2 is:

I usually do fdisk -BI -v -b /boot/mbr ad2 
but, I believe the -b /boot/mbr is default with you use -B
and I think it will take /dev/ad2 as well as just ad2.   Actually I
am usually working on SCSI drives so it is da2, etc, but that shouldn't
be any different.

To answer your question on that, It looks like the data in the bsdlabel 
read you did is probably correct.  It shows values for size and offset
although the offset seems weird.   I would expect it to be 0.   Maybe
that is because you didn't do the first bsdlabel step.

For the disklabel you need two steps - noting that you were writing
the label to make it bootable, you need:

  bsdlabel -w -B ad2s1 auto
and then
  bsdlabel -e ad2s1

The first step (which you appear to have skipped) makes the base label
on the slice and the second edits it to be the way you want.

For the second bsdlabel it will come up in an edit session with what you 
saw before or maybe even more reasonable values.   The editor will be 
whatever you have set as your editor of choice in your EDITOR environment 
variable - probably vi, but you can set it however pleases you.

  > 8 partitions:
  > #        size   offset    fstype    [fsize bsize bps/cpg]
  >   a: 586114625       16    unused        0     0       
  >   c: 586114641        0    unused        0     0         # "raw" part,

Then, just edit the first line to be as follows

  >   e: 586114625       0    4.2BSD       2048     16384    89   

or do it this way

  >   e:        *       *     4.2BSD       2048     16384    89   

You may actually want bigger fsize, bsize and some different bps/cpg
I sometimes set bps/cpg to 64 on larger disks and 16 on smaller, but
I usually let it do whatever bps/cpg that it wants, but often specify
the fsize and bsize.  bsize should be 8X fsize.

By changing the a: to e: in that first column, you will change the
identifier it uses.   If you put in '*' for size and offset, bsdlabel
will figure it for you and use up all the remainder of the slice that
is available.  You may be able to put in * for fsize bsize and bps/cpg
as well.  I have not tried those.    Check the man page.

This all works nicely.   I have done it many times.

Then just get out of the edit session with a write and it will write
the label to the disk according to how you edited it.

The newfs should then work after the bsdlabel is fixed up.
On newfs, I like to specify -f and -b to be the same as fsize and bsize 
in the bsdlabel.    Sometimes I find I need to specify a -i that is 
different from the default as well to get enough inodes.  If you have 
a lot of small files it can run out.   You have to calculate that.  See
the newfs(8) man page. 

I think some people will advise skipping the fdisk and doing the bsdlabel 
doing the bsdlabel on just ad2 instead of ad2s1, but that gets you what
is referred to as "dangerously dedicated" disk.   It is not dangerous
in that it will not destroy anything, but it is less flexible if you
ever have trouble or want to move to another version or make it readable
by another OS.   Since it is easy and the amount of disk it uses is
negligible on modern large disks, just go ahead and do the fdisk and
make a slice.  Then it will always be happy.

Good luck,

////jerry

> --
> Peter
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 
> 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604101417.k3AEHY3S015943>