Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2000 11:49:46 +1300
From:      David Preece <davep@afterswish.com>
To:        freebsd-hackers@freebsd.org, freebsd-small@freebsd.org
Subject:   disklabel madness, make it boot...
Message-ID:  <5.0.0.25.1.20001030110151.009fdeb0@mail.afterswish.com>

next in thread | raw e-mail | index | archive | help
It should be easy. I'm trying to get a 24Mb CF card to be a bootable drive 
from 4.0. I have it wired on the primary IDE as a slave drive, it is 
therefore ad1 and the following almost works:

fdisk -I ad1 #take the whole MSDOS partition table
dd if=/dev/zero of=/dev/rad1 bs=1k count=1 #Wipe the existing disk label
disklabel -rwB ad1 auto #write a disk label
newfs /dev/rad1c #create new file system

...when accompanied by copying over the kernel and other such (hints taken 
from handbook on making a rescue floppy for backups). The boot blocks run 
and complain because there's no kernel on ad(0,a), which is fair enough 
since it's on ad(0,c). So giving it the hint it boots the kernel then 
complains about failing to mount /sbin/init (which is also on 0,c). Anyway, 
it became clear to me that 'c' is the 'complete' unix partition and what I 
needed was an 'a' (or root) partition and that such a thing was set using 
disklabel (correct?).

Anyway, to get a first shot I used /stand/sysinstall and wrote the 
disklabel, which appeared to then bin out my real drive (which fixed itself 
on reboot), so this is a significant bug in itself. Anyway, I then got the 
disklabel, which is currently this:

# /dev/rad1c:
type: ESDI
disk: ad1s1
label:
flags:
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 4
sectors/cylinder: 128
cylinders: 368
sectors/unit: 47200
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0

8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
   a:    47200        0    4.2BSD     1024  8192    16   # (Cyl.    0 - 368*)
   c:    47200        0    unused        0     0         # (Cyl.    0 - 368*)

(sorry for the bloat), so we can see the whole disk is turned over to an 
'a' partition. I piped this to disk (file, disklabel.24meg) and modified my 
script to:

fdisk -I ad1
dd if=/dev/zero of=/dev/ad1 bs=1k count=1
disklabel -R -B ad1 disklabel.24meg
newfs /dev/rad1a #create new file system

And while I can mount the filesystem with mount /dev/ad1a if I now set this 
to be the master drive (and disconnect the other one), I get a 'Missing 
Operating System' from the BIOS - i.e. where are the boot blocks then?. It 
appears the -B in disklabel isn't working. Stunts I've tried include 
setting the disklabel to say 'disk: ad0s1' (for when it restarts being the 
master on the channel), doing a separate 'disklabel -B ad1' to force the 
boot blocks on and doing the -B within fdisk (i.e. 'fdisk -IB ad1'). The 
usual combinations of sleep, coffee and sacrifices to the gods also seem to 
do nothing.

Help help help. I have no idea what I'm doing wrong here and any pointers 
would be much appreciated.

As an aside, and a point of view that will no doubt not prove very popular, 
is this: I'm not a great hacker, but I'm not crap either and this is 
driving me up the wall. We are talking DCOM levels of frustration here and 
I can't help the feeling that the whole thing is just too damn complicated...

Anyway, advice _please_ and flames if you really must.

Dave :(

BTW, -B option in fdisk is ignored if -f is specified, yet there is no 
command in the configuration file to set boot blocks, what gives?. See fdisk(8).



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-small" in the body of the message




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