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

Ian Smith smithi at nimnet.asn.au
Thu Dec 30 05:24:58 UTC 2010


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.

 > > I have seen this exact error before, and this is what took care of it.
 > >
 > > -Mike

Mmm .. it's not clear from Chris' original message exactly what he did.

 > Mike,
 > 
 > Thanks for that little tip, I tried it this morning and it hung for about 30
 > second w/ no cd/hd activity, then it resumed w/ a beep, it printed some
 > garbage on the console, the only ledgeable was the following
 > 
 > [..]
 > <GARBAGE>Invalid partition tableError loading operating systemMissing
 > operating system<GARBAGE><GARBAGE><GARBAGE>1+0 records in
 > 1+0 records out
 > 512 bytes transferred in 2.712151 secs (189 bytes/sec)
 > [..]

This doesn't make sense.  Rather than 'I tried it' please show the exact 
command/s you are issuing.  Given it's a new disk you can afford to make 
mistakes, but once you have anything valuable on a disk you need to take 
extreme care with dd(1), it's so easy to fatfinger something wrong.

eg, what you show above would indicate just what you'd get by running:

dd if=/dev/ad4 count=1

ie, using 'if=' not 'of=', with of=/dev/stdout implied, ie to console.

If you do want to look at one or more raw sectors, it's very much safer 
piping dd's stdout to hd (hexdump), as the delays and beep you mention 
are consistent with piping raw bytes out to the console .. often this 
can blow your console settings away (I've done it too many times :)

If you initialise a disk with the default MBR (or it came that way) then 
that's usually what's in /boot/mbr - or /boot/boot0 if you've chosen the 
FreeBSD boot manager, or something else if using (say) grub.

t23% dd if=/boot/mbr | hd
00000000  fc 31 c0 8e c0 8e d8 8e  d0 bc 00 7c be 1a 7c bf  |.1.........|..|.|
00000010  1a 06 b9 e6 01 f3 a4 e9  00 8a 31 f6 bb be 07 b1  |..........1.....|
00000020  04 38 2f 74 08 7f 75 85  f6 75 71 89 de 80 c3 10  |.8/t..u..uq.....|
00000030  e2 ef 85 f6 75 02 cd 18  80 fa 80 72 0b 8a 36 75  |....u......r..6u|
00000040  04 80 c6 80 38 f2 72 02  8a 14 89 e7 8a 74 01 8b  |....8.r......t..|
00000050  4c 02 bb 00 7c f6 06 bd  07 80 74 2d 51 53 bb aa  |L...|.....t-QS..|
00000060  55 b4 41 cd 13 72 20 81  fb 55 aa 75 1a f6 c1 01  |U.A..r ..U.u....|
00000070  74 15 5b 66 6a 00 66 ff  74 08 06 53 6a 01 6a 10  |t.[fj.f.t..Sj.j.|
00000080  89 e6 b8 00 42 eb 05 5b  59 b8 01 02 cd 13 89 fc  |....B..[Y.......|
00000090  72 0f 81 bf fe 01 55 aa  75 0c ff e3 be b9 06 eb  |r.....U.u.......|
000000a0  11 be d1 06 eb 0c be f0  06 eb 07 bb 07 00 b4 0e  |................|
000000b0  cd 10 ac 84 c0 75 f4 eb  fe 49 6e 76 61 6c 69 64  |.....u...Invalid|
000000c0  20 70 61 72 74 69 74 69  6f 6e 20 74 61 62 6c 65  | partition table|
000000d0  00 45 72 72 6f 72 20 6c  6f 61 64 69 6e 67 20 6f  |.Error loading o|
000000e0  70 65 72 61 74 69 6e 67  20 73 79 73 74 65 6d 00  |perating system.|
000000f0  4d 69 73 73 69 6e 67 20  6f 70 65 72 61 74 69 6e  |Missing operatin|
00000100  67 20 73 79 73 74 65 6d  00 90 90 90 90 90 90 90  |g system........|
00000110  90 90 90 90 90 90 90 90  90 90 90 90 90 90 90 90  |................|
*
000001b0  90 90 90 90 90 90 90 90  90 90 90 90 90 80 00 00  |................|
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200
1+0 records in
1+0 records out
512 bytes transferred in 0.079548 secs (6436 bytes/sec)

Look familiar? :)  That's what 'dd if=/dev/ad4 count=1 | hd' would show 
on a disk with default MBR, except there'd be the slice data in the MBR 
section of the boot sector, starting at 0x1be, ending with 'sig' 55aa.

 > Restarting the install process, again accepting defaults, I am again

Again, please be more explicit.  Defaults for what?  One slice covering 
the whole disk might be assumed for the disk slicing part of sysinstall 
(fdisk-like wrapper) but assuming can be unsafe re disk setup, eg:

Disk name:      ad0                                    FDISK Partition Editor
DISK Geometry:  232581 cyls/16 heads/63 sectors = 234441648 sectors (114473MB)

Offset       Size(MB)        End     Name  PType       Desc  Subtype    Flags
         0          0         62        -     12     unused        0
        63       4094    8385929    ad0s1      7        fat       11
   8385930      61436  134207009    ad0s2      8    freebsd      165
 134207010      16378  167750351    ad0s3      8    freebsd      165
 167750352          0  167750729        -     12     unused        0
 167750730      32561  234436544    ad0s4      8    freebsd      165
 234436545          2  234441647        -     12     unused        0

That's from 7.4-PRERELEASE sysinstall, if it matters (8.2-PRE is on s4)

And/or do you mean default sizes for labelling a FreeBSD slice, ie what 
creates the slice's bsdlabel with sizes and mountpoints / /var /usr etc?

 > 'Unable to find device node for /dev/ad4s1b in dev!
 > The creation of filesystems will be aborted.'
 > <OK>

/dev/ad4s1b is or should be the swap partition.  Did you allocate swap?  
Twice your memory size or larger?  Way too much left to guesswork here, 
but from that it rather looks like you may not have allocated any swap?

 > My question is this now, could this be the fact that this is a really large
 > drive and the bios is 'freaking' out (for lack of a better term) and not
 > properly presenting the disk to the system? While I don't think this is
 > something to consider, something in the back of my head suggests it is. The

Start worrying when you get near 2TB, when you'll _have_ to use gpart :)

 > disk is a different spindle-speed then the old one.
 > 
 > [..]
 > 250G -> 5400RPM
 > 750G -> 7200RPM

It should run about a third faster for sequential i/o, is all.

 > maybe a (stab in the dark here) bus translation issue, disk is giving the
 > bus too much information? *shrug I dunno, I'm babeling now and I don't have
 > an obnoxious fish in my ear :(.

I don't expect this to be anything like that.  Please show a) how many 
slices you allocated and how big this FreeBSD slice is and b) how you 
partitioned the FreeBSD slice into (and sizes of) / /var/ /usr [/tmp?] 
and especially swap.

I wouldn't allocate any less than 1GB for your root (/) partition esp. 
if building custom kernel/s; maybe that's fixed in sysinstall for 8.2?

cheers, Ian  (please cc me on any reply; I take -questions as a digest)


More information about the freebsd-questions mailing list