Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Aug 2006 22:36:57 -0500
From:      Joe Koberg <joe@osoft.us>
To:        Antony Mawer <fbsd-stable@mawer.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: The need for initialising disks before use?
Message-ID:  <44EBCD59.1060507@osoft.us>
In-Reply-To: <44E47092.7050104@mawer.org>
References:  <44E47092.7050104@mawer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Antony Mawer wrote:
> 
> Is it recommended/required to do something like:
> 
>     dd if=/dev/zero of=/dev/ad0 bs=1m
> 
> before use to ensure the drive's sector remappings are all in place, 
> before then doing a newfs?


It seems logical to read the whole device first with "conv=noerror" to 
be sure the drive has encountered and noted any correctable or 
uncorrectable errors present.

Only then write the entire drive, allowing it to remap any noted bad 
sectors. i.e.:

    # dd if=/dev/ad0 of=/dev/null bs=64k conv=noerror
    # dd if=/dev/zero of=/dev/ad0 bs=64k

The problem is that when dd hits the first bad sector, the whole 64k 
block containing the sector will be skipped. There could be more bad 
sectors there... or none... If you hit errors I would re-read the 
affected area with "bs=512" to get down to sector granularity.

I seem to recall a utility posted to a freebsd mailing list some time 
ago that worked like dd(1), but would "divide and conquer" a block that 
returned with a read error.  Intent being to get the job done fast with 
large blocks but still copy every sector possible off a failing drive by 
reducing to sector-sized blocks if necessary.... Unfortunately I can't 
find it now.



Joe Koberg
joe at osoft dot us




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