no ad1s3a,b,d... on ad1s3 after bsdlabel

Snow Mountains snow.mountains.4 at gmail.com
Thu Mar 13 02:32:38 UTC 2008


2008/3/12, Josh Paetzel <josh at tcbug.org>:
> On Wednesday 12 March 2008 07:30:34 am Snow Mountains wrote:
>  > 2008/3/12, Lowell Gilbert <freebsd-questions-local at be-well.ilk.org>:
>  > > "Snow Mountains" <snow.mountains.4 at gmail.com> writes:
>  > >  > I try to understand bsdlabel.
>  > >  > I have former fat slice (ad1s3) on my disk and I want to make several
>  > >  > BSD partitions on it. I did this:
>  > >  >
>  > >  > # dd if=/dev/zero of=/dev/ad1s3 bs=1k count=1024
>  > >  > 1024+0 records in
>  > >  > 1024+0 records out
>  > >  > 1048576 bytes transferred in 0.318986 secs (3287217 bytes/sec)
>  > >  > # bsdlabel -w ad1s3
>  > >  > # bsdlabel -e ad1s3
>  > >  > (edit)
>  > >  > # bsdlabel ad1s3
>  > >  > # /dev/ad1s3:
>  > >  > 8 partitions:
>  > >  > #        size   offset    fstype   [fsize bsize bps/cpg]
>  > >  >   a: 10000000       16    4.2BSD        0     0     0
>  > >  >   b: 10000000 10000016    4.2BSD        0     0     0
>  > >  >   c: 47616660        0    unused        0     0         # "raw" part,
>  > >  > don't edit d: 27616644 20000016    4.2BSD        0     0     0
>  > >  > # newfs -U /dev/ad1s3a
>  > >  > newfs: /dev/ad1s3a: could not find special device
>  > >  > # ls /dev/ad1s3*
>  > >  > /dev/ad1s3
>  > >  > #
>  > >  >
>  > >  > What I miss because I don't have ad1s3a,b,d?
>  > >  > If repeat same procedure on disk (big file) mounted as /dev/md0, a see
>  > >  > /dev/md0,a,b,d,e... after this group of commands.
>  > >
>  > > On what version of FreeBSD?
>  >
>  > This happens on:
>  >
>  > # uname -r
>  > 6.2-RELEASE-p11
>  >
>  > SergiM
>
>
> Did you delete and recreate the slice or is it still marked as FAT when you do
>  fdisk /dev/ad1


Josh, you are right! No, I did not do it. It was still marked as FAT.
I thought that it is enough to overwrite first 1M of slice with zeros.

I entered sysinstall and just changed slice's type with T. That was
enough. Then, fresh bsdlabel appeared on it. After editing, I now have
all BSD partitions (a,b,d...) mountable. However, here handbook is not
precise, I think. Please see this:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/disks-adding.html

I deduced from it that fdisk is necessary only for dedicated and new
disks (fdisk -BI da1 #Initialize your new disk).


>  If it's still a FAT/DOS slice you might try deleting and recreating it as a
>  native FreeBSD slice, I'm not entirely sure putting a bsdlabel on a FAT slice
>  is going to do the right thing (although I could be wrong here)
>

It seems that you are right. But this still confuses me:

# dd if=/dev/zero of=/home/minidisk.bin bs=1k count=100000
.........
# mdconfig -a -t vnode -f /home/minidisk.bin -u 2
# ls /dev/md2*
/dev/md2
# bsdlabel -w md2
# ls /dev/md2*
/dev/md2        /dev/md2a       /dev/md2c
# bsdlabel -e md2
..........
# ls /dev/md2*
/dev/md2        /dev/md2b       /dev/md2d
/dev/md2a       /dev/md2c       /dev/md2e

and then

# fdisk /dev/md2
******* Working on device /dev/md2 *******
................
The data for partition 1 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 63, size 192717 (94 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 11/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

So bsdlabel was enough in this case. Why is this different from real hard disk?

And one more question: is disk geometry data somehow written in fdisk
W (write) actions? I mean, is it possible to spoil something on
existing FreeBSD slices (which contain data) if I set wrong geometry
for entire drive when I edit something in fdisk editor?


Thank you very much
SergiM


More information about the freebsd-questions mailing list