a new hard-drive in a 2y/o laptop

Michael Powell nightrecon at hotmail.com
Sun Jan 2 06:36:01 UTC 2011


Ian Smith wrote:

> 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:
[snip]
>  > >  > 
>  > >  > > 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.
[snip]
> 
> 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?

No. I used the of=/dev/ad4 as described above. However, I think you've hit 
the nail on the head on one aspect. I believe that 6.2 disk was originally 
set up as "dangerously dedicated". It was so long ago and I had forgotten 
all about it, but this does dovetail with what your are getting at.

The machine that disk went into had been upgraded completely through the 7.x 
series and on to 8.0-Release before it's disk went up in smoke(literally). I 
was attempting to do a fresh 'minimal' install of 8.0-Release to the old 6.2 
disk pulled off a shelf prior to doing restore(s) of a dump from just the 
day before. It was only done because it could be done immediately, and a 
newer, larger, better replacement procured after the fact.

Exact copy of error from my notes here:

"Unable to find device node for /dev/ad4s1b in /dev! The creation of 
filesystems will be aborted." Then pressing "OK" brings this: "Couldn't make 
filesystems properly. Aborting."

This from sysinstall and occurs after fdisk, labeling, at the point when  
sysinstall then tries to write out the config to the disk and newfs.

 
> 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?

Or any other form of 'garbage'. I'd use the 8.1 LiveFS CD myself just as a 
personal preference - but either approach should do the job.
 
> 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:
> 
>  sysctl kern.geom.debugflags=16
>  dd if=/dev/zero of=/dev/ad4s1 bs=512 count=8
> 
> will remove slice 1's boot blocks entirely, including the bsdlabel.
> 

Yes - I agree. Would also be nice to examine it afterward with a hex editor 
to actually see *if* all writes were zero.  Any 'ones' sprinkled in there, 
especially in the region of the disk we are talking about would indicate 
corruption. And my wild guess if this is the situation it may possibly 
indicate some form of subtle hardware incompatibility most likely a clash of 
firmwares, e.g. controller and disk(s).  Some form of non-standard 
controller implementation, especially wrt to its firmware being buggy.

In the OEM world of the likes of HP, DELL, etc, when this happens a lot of 
times they kludge together a work around driver that you can get from their 
tech support. It masks the hardware/firmware problem in software, and is 
almost always a Windows-centric thing. 

Bad thing here is the old: "but it worked in 7.x, only fails with 8.x...". 
Whenever I see _that_ I think "developer involvement/smarter people than me 
required...".

> 
> [excuse broken threading, but unless cc'd I have to reply to the digest]

I use knode and gmane. I also know that (IIRC) you're supposed to reply by 
email and CC: the list. There is a set of configs which allow one to 
configure knode to do just this, however, the last two times I've tried it 
knode crashed horribly. That was a couple of small revisions of KDE ago, so  
I should soon revisit this myself and see if the bug has ever gotten any 
love.

-Mike





More information about the freebsd-questions mailing list