netboot issues, 8.0, mfsroot mount failure

Antony Mawer lists at mawer.org
Thu Feb 18 04:41:20 UTC 2010


On Thu, Feb 18, 2010 at 6:22 AM, Jeremy Chadwick
<freebsd at jdc.parodius.com> wrote:
> On Tue, Feb 16, 2010 at 11:43:30PM -0500, Charles Sprickman wrote:
>> >Footnote: This is why I tell folks to zero out the first 8192 bytes of
>> >any disk they've previously installed FreeBSD on (even if the disk has
>> >no filesystems/slices on it).  The way FreeBSD determines the size of
>> >the disk differs in RELENG_8; I believe GEOM "figures it out" on its own
>> >now, while previous releases relied on the "c" slice.  The method I've
>> >recommended: do dd if=/dev/zero of=/dev/adX bs=512 count=16.
>>
>> Is it also advisable to blot out any old glabel stuff at the end of
>> the disk?  What's the math to get that?  Get a sector count for the
>> whole disk, set "bs" to 512 and "skip" to (sector count - 1)?
>
> I don't think the glabel data (which goes at the end of the disk) is
> relevant to the above problem I described.  You can erase it if you
> want, but I doubt it's responsible for warnings like "Disk geometry does
> not match label!" or situations where a user is re-using a disk (that
> had its slices created on RELENG_7) on RELENG_8 and experiences
> problems.  An alternative to the dd method might be to try "gpart
> destroy"; I haven't tried to see if relieves the problem.
>
> As far as how to erase the glabel metadata -- "glabel clear" is supposed
> to do this for you.  What I don't know is whether or not addition of a
> glabel decreases what GEOM thinks the total size of the disk is, so I
> can't say for certain doing some math + zeroing the last sector of the
> disk would actually work.

I have recently been using the following snippet in an install script
to zero out any existing gmirror/etc metadata before the install
proceeds (and potentially reconfigures a new gmirror etc):

    # Specify the disk device to clear
    diskdev="da0"

    # Clear metadata from the last sector on the drive
    echo "Clearing any GEOM metadata on drive..."
    diskinfo=`diskinfo /dev/$diskdev`
    sector_size=`echo $diskinfo | cut -f2 -d\ `
    size_in_sectors=`echo $diskinfo | cut -f4 -d\ `
    geom_offset=$(($size_in_sectors-1))
    dd if=/dev/zero of=/dev/$diskdev bs=$sector_size
oseek=$geom_offset count=1 2> /dev/null

In preliminary testing it seems to do the job...

-- Antony


More information about the freebsd-stable mailing list