a new hard-drive in a 2y/o laptop
smithi at nimnet.asn.au
Sun Jan 2 03:21:02 UTC 2011
In freebsd-questions Digest, Vol 343, Issue 10, Message: 23
On Fri, 31 Dec 2010 19:37:10 -0500 Michael Powell <nightrecon at hotmail.com> wrote:
> Ian Smith wrote:
> > In freebsd-questions Digest, Vol 343, Issue 5, Message: 10
> > On Tue, 28 Dec 2010 11:02:45 -0500 Chris Brennan <xaero at xaerolimit.net>
> > wrote:
> > > On Tue, Dec 28, 2010 at 2:23 AM, Michael Powell
> > > <nightrecon at hotmail.com>wrote:
> > >
> > > > Try zeroing out the mbr:
> > > >
> > > > Boot a LiveFS CD, then at a root prompt do:
> > > >
> > > > sysctl kern.geom.debugflags=16 and:
> > > >
> > > > dd if=/dev/zero of=/dev/adx oseek=1 bs=512 count=1
> > > >
> > > > where x equals your drive number. This will zero out any old MBR.
> > Er, no, Mike. The MBR is in sector 0 of the disk; that would zero out
> > sector 1 as oseek=1 skips over sector 0. What's in sector 1 depends on
> > how/whether the disk is sliced. In a 'dangerously dedicated' (unsliced)
> > disk like a memory stick perhaps, this would usually be /boot/boot1 and
> > include the bsdlabel. In a sliced disk, sectors 1 to 62 are typically
> > unused, the first slice usually starting at sector 63.
> > t23% fdisk -s ad0
> > /dev/ad0: 232581 cyl 16 hd 63 sec
> > Part Start Size Type Flags
> > 1: 63 8385867 0x0b 0x00
> > 2: 8385930 125821080 0xa5 0x80
> > 3: 134207010 33543342 0xa5 0x00
> > 4: 167750730 66685815 0xa5 0x00
> > If you really want to zero out sector 0, leave out the oseek (or use
> > oseek=0) - but you're better off using 'fdisk -Bi' to init a new disk.
> Yes - true enough. Was thinking partition table and typed 'mbr'.
Well, what's commonly called 'the partition table' is bytes 0x1be-1ff of
the MBR, so I was confused by your writing to sector 1 rather than 0,
but have a new theory to test, seeing Chris isn't making any progress;
this maybe a victim of the old 'slice vs partition' terminology issue.
> In my case, a temporary replacement disk had FreeBSD 6.2 on it. Something
> changed wrt to disklabeling on the way to 8-Release and the old 6.2 being
> present created a situation where that region on the disk was invisible to
> the new labeling and wouldn't write out. A new install of 8-Release
> (sysinstall) would error out with the same message as Chris when it came to
> the point of writing out to the disk. For me, the above 2 commands fixed my
> situation. Even though his error is the same, I think his problem may be
> different from mine.
The bsdlabel lives in sector 1 (counting from 0) of the slice concerned,
specifically the first 0x114 (276d) bytes, in the second sector of the
boot blocks. As noted above, in unsliced disks such as memstick.img
that's sector 1 of the entire disk, but in ordinary sliced disks it's in
sector 1 of the _slice_, so if you'd used (here using Chris' ad4)
dd if=/dev/zero of=/dev/ad4s1 oseek=1 bs=512 count=1
- rather than of=/dev/ad4 - then you would indeed be zeroing out the
label, ie the 'partition table' in FreeBSD-speak. Is that perhaps what
you had to do to that 6.2 disk, which I suppose was a sliced disk?
At 6.x (and 7.x, I think) it could have been 'dangerously dedicated' ie
unsliced .. which option has been removed in 8.x _except_ regarding the
memstick.img (appearing as /dev/daXa) .. not half confusing, eh?
In any case, it'd be a cheap trick for Chris to try from Fixit, and
though it seems unlikely there'd be anything 'leftover' from an earlier
install, maybe earlier failure/s have left a broken bsdlabel there?
So at this still-uninstalled stage it couldn't hurt to zero that sector,
or even the first 4KB of ad4s1 .. which is /boot/boot1 plus /boot/boot2
(which equals /boot/boot !) before the label section gets written. ie:
dd if=/dev/zero of=/dev/ad4s1 bs=512 count=8
will remove slice 1's boot blocks entirely, including the bsdlabel.
[excuse broken threading, but unless cc'd I have to reply to the digest]
More information about the freebsd-questions