Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 May 2010 15:57:32 -0700
From:      Garrett Cooper <yanefbsd@gmail.com>
To:        rick-freebsd2009@kiwi-computer.com
Cc:        geom@freebsd.org
Subject:   Re: Getting useful diagnostics from geom(8) and friends
Message-ID:  <AANLkTilM87p770HkDKT2XbYuR5Ns5MeKbeFKPrQGKb_C@mail.gmail.com>
In-Reply-To: <20100527224627.GD82995@kay.kiwi-computer.com>
References:  <AANLkTimg6CKc0RTNpd-0oI5MegjVPd0eiS5pQCj-chvV@mail.gmail.com> <20100527220241.GA82995@kay.kiwi-computer.com> <20100527220821.GB82995@kay.kiwi-computer.com> <AANLkTikfGX20EzmhbrctGFdKGAKDxc19XIsRTNJDwErK@mail.gmail.com> <20100527224627.GD82995@kay.kiwi-computer.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 27, 2010 at 3:46 PM, Rick C. Petty
<rick-freebsd2009@kiwi-computer.com> wrote:
> On Thu, May 27, 2010 at 03:27:59PM -0700, Garrett Cooper wrote:
>> On Thu, May 27, 2010 at 3:08 PM, Rick C. Petty
>> <rick-freebsd2009@kiwi-computer.com> wrote:
>> > On Thu, May 27, 2010 at 05:02:41PM -0500, Rick C. Petty wrote:
>> >
>> > In any case, show us the output of "gpart show /dev/ad4" if there are
>> > any problems.
>>
>> =A0 =A0 Here's the entire operation; I realize there's a rounding error =
in
>> the size calculation with capacity...
>> Thanks,
>> -Garrett
>>
>> ./clear_and_rewrite_partitions ad4
>> + atacontrol cap ad4
>> + awk /^lba supported/ { print $3 }
>> + capacity=3D268435455
>> + dd if=3D/dev/zero of=3D/dev/ad4 bs=3D20m count=3D1
>> 1+0 records in
>> 1+0 records out
>> 20971520 bytes transferred in 0.610148 secs (34371204 bytes/sec)
>> + expr 0 + 268435455 / 1024 - 1
>> + dd if=3D/dev/zero of=3D/dev/ad4 bs=3D1m oseek=3D262142
>> dd: /dev/ad4: Input/output error
>> 1+0 records in
>> 0+0 records out
>> 0 bytes transferred in 0.021521 secs (0 bytes/sec)
>
> This last step is unnecessary, and there's something wrong with your math=
.
> 268435455 sectors is ~128 GiB, since each sector is 512 bytes. =A0So seek=
ing
> to 256 GiB won't work. =A0Also you probably want lba48 not lba, or you'll
> always be limited to 268435455 which is rarely (never?) the actual disk
> size.

Quote:

# GPT optionally caches a protective MBR at the end; trash it.
dd if=3D/dev/zero of=3D/dev/$1 bs=3D1m oseek=3D`expr 0 + $capacity / 1024 -=
 1`

Yes, it's required for some cases because of the way that some systems
setup with gpt partitioning; PCBSD for instance does install a PMBR
that confuses the hell out of sysinstall where geom keeps on restoring
the old disk layout when it tastes the provider.

The capacity drive is 250GB, and I intentionally want to blow away the
last couple of sectors:

%atacontrol cap ad4

Protocol              Serial ATA II
device model          WDC WD2502ABYS-18B7A0
serial number         WD-WCAT1F033778
firmware revision     02.03B04
cylinders             16383
heads                 16
sectors/track         63
lba supported         268435455 sectors
lba48 supported       488281250 sectors
dma supported
overlap not supported

Feature                      Support  Enable    Value           Vendor
write cache                    yes	yes
read ahead                     yes	yes
Native Command Queuing (NCQ)   yes	 -	31/0x1F
Tagged Command Queuing (TCQ)   no	no	31/0x1F
SMART                          yes	yes
microcode download             yes	yes
security                       yes	no
power management               yes	yes
advanced power management      no	no	0/0x00
automatic acoustic management  yes	no	254/0xFE	128/0x80

I don't doubt that my math is wrong though... I'll use lba48 instead.

>> + ls /dev/ad4s*
>> ls: /dev/ad4s*: No such file or directory
>> + gpart create -s MBR ad4
>> gpart: 22 scheme 'MBR'
>> + gpart bootcode -b /boot/mbr -p /boot/boot0 -i 5 ad4
>> gpart: No such geom: ad4.
>
> I'm not sure you want to use both -b and -p options at the same time..
> does that even work?

No idea. At this point I've just started throwing random stuff at geom
trying to figure out why things aren't working because trying the same
thing over and over expecting a different results is a sign of
insanity :D.

> Regardless, try my aforementioned suggestion of specifying the complete
> device path when running "gpart bootcode".

Did that and the basename for the provider (ad4 in this case). Neither
worked :(.

> Also, what is partition #5 here?

>From boot0cfg(8):

     -s slice
             Set the default boot selection to slice.  Values between 1 and=
 4
             refer to slices; a value of 5 refers to the option of booting
             from a second disk.

Probably user error, but it was worth trying I guess..

>> + gpart add -b 34 -s 128 -t freebsd ad4
>> gpart: 22 geom 'ad4'
>> + gpart show ad4
>> gpart: No such geom: ad4.
>> + ls /dev/ad4s*
>> ls: /dev/ad4s*: No such file or directory
>
> Are you sure geom_part_mbr and geom_part_bsd are kldload'd?

It's 7.1, so the names are different...

%kldstat -v | grep g_
		58 g_md
		133 g_bsd
		134 g_dev
		135 g_disk
		136 g_mbrext
		137 g_mbr
		138 g_vfs
		139 g_part
		206 g_class

geom is hardwired into the kernel.

Thanks!
-Garrett



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