hard drive sector testing on Ubuntu

lazer100 lazer100 at talktalk.net
Thu Oct 4 09:43:26 UTC 2012


On 29-Sep-12 21:18:28 Rashkae wrote:
>On 09/29/2012 02:09 AM, Nils Kassube wrote:

>>
>> AFAIK badblocks wouldn't restore the data.
>>

>Badblocks non-destructive read-write (-n) test will, indeed, restore the 
>data.  Of course, it would still be a good idea to have a good backup 
>first, and use a UPS.

looks like the badblocks default is just a read test which will be
nondestructive.

eg I used:

sudo badblocks -sv /dev/sdc

this didnt find any problems and took about 13 hours for the 1tb drive,

unfortunately on completion I cut and pasted the output and 
this doesnt mention how long it took:

$ 
$ sudo badblocks -sv /dev/sdc
[sudo] password for lazer: 
Checking blocks 0 to 976762583
Checking for bad blocks (read-only test): done                                
Pass completed, 0 bad blocks found.
$ 



there seem to be conflicts between different command line options,
usually the program rejects the presented command line!



>Also note that by default, badblocks repeats the test with 4 different 
>patterns.  On a modern >1TB drive, that ... can take a while, so I would 
>usually use -t 0xaa (or -t random) to only do 1 pass.

there is an option to set the number of passes, but the program rejected
the command line when I tried this!

>Do not even thing of doing this on an SDD.  Probably not a good idea on 
>those hybrid drives either.  Reasons are outside the scope of this quick 
>e-mail, just don't do it.

now I'm curious what the reasons are!

not sure what you mean by a hybrid drive.


>And finally, this whole methology has been deprecated for almost a 
>decade.  Sector testing should be handled transparently by the drive 
>firware.  Use smartctl to examine the results (or initiate a full test.) 
>  At most, you should only ever have to do a read test to force the 
>drive to scan the entire thing end to end.  (something like ddrescue 
>/dev/sd? /dev/null -f will work nicely.)

I havent tried these yet, as I got bogged down with the initial suggestions,

I will send some feedback when I try these.


the drive would appear to have removed the bad sectors, but I just wonder
what happens if a bad sector is part of a file. The drive cannot just
replace that sector as that part of the file would become junk.

or are the bad sectors removed on a write?

if the drive has started to malfunction I'm a bit wary about continuing
to use the drive,

I have used many hard drives in the past, and this is only the second
one to fail. with the first problem drive, sector 0 the MBR stopped
functioning
and I could salvage the drive, but it could no longer be used. 

would you say that zeroing a modern drive would then remove the bad sectors?






More information about the ubuntu-users mailing list