# scan Hard Disk for bad sectors



## ccc (Dec 17, 2010)

hi

Howto scan a Hard Disk for bad sectors using for example Frenzy LIVE CD?


----------



## wblock@ (Dec 17, 2010)

Brute force:
`# dd if=/dev/ad4 of=/dev/null bs=128k`

Watch for errors.  See also sysutils/smartmontools, although SMART has been known to report no problems on drives with known problems.


----------



## jrm@ (Dec 17, 2010)

Another possible option... drive manufacturers often have bootable iso images, which include utilities to check their drives.


----------



## danbi (Dec 17, 2010)

These utilities don't do anything different than what dd is doing.

I have found many manufacturers utilities for 'low level format to recover the disk' do actually do the DOS (ah... Windows ) equivalent of

`# dd if=/dev/zero of=/dev/adX bs=128k`


----------



## Beastie (Dec 17, 2010)

wblock said:
			
		

> `# dd if=/dev/ad4 of=/dev/null bs=128k`


This block size may be (very) slow, unless it's an old disk. Is there any good reason for that?


----------



## carlton_draught (Dec 17, 2010)

When the disk is unformatted, I like to use an Ubuntu LiveCD and Palimpsest (Disk Utility). It is easy to use and informative. Unfortunately it's not in ports.

In FreeBSD, using ZFS and a
`# zpool scrub`
`# zpool status`
should uncover anything that would have resulted in a bad sector.


----------



## wblock@ (Dec 17, 2010)

Beastie said:
			
		

> This block size may be (very) slow, unless it's an old disk.



It's 128k, not 128.
`% man dd | less +/sizes`



> Is there any good reason for that?



Reading multiple blocks at a time greatly reduces overhead, making it much faster.


----------



## Beastie (Dec 17, 2010)

wblock said:
			
		

> It's 128k, not 128.
> `% man dd | less +/sizes`
> 
> Reading multiple blocks at a time greatly reduces overhead, making it much faster.


Yes, but what I meant is why are you not using bigger block sizes, such as 1m or so.


----------



## wblock@ (Dec 18, 2010)

Beastie said:
			
		

> Yes, but what I meant is why are you not using bigger block sizes, such as 1m or so.



Because it probably won't make a difference:


```
% time dd if=/dev/ada0 of=/dev/null bs=64k count=64k
65536+0 records in
65536+0 records out
4294967296 bytes transferred in 37.826251 secs (113544620 bytes/sec)
0.020u 0.873s 0:37.82 2.3%	29+1242k 65536+0io 0pf+0w

% time dd if=/dev/ada0 of=/dev/null bs=128k count=32k
32768+0 records in
32768+0 records out
4294967296 bytes transferred in 37.830190 secs (113532797 bytes/sec)
0.000u 0.684s 0:37.83 1.7%	27+1166k 32768+0io 0pf+0w

% time dd if=/dev/ada0 of=/dev/null bs=1m count=4k
4096+0 records in
4096+0 records out
4294967296 bytes transferred in 37.838443 secs (113508034 bytes/sec)
0.000u 0.637s 0:37.83 1.6%	23+977k 32768+0io 0pf+0w
```

Same amount of data, same time.  Once the overhead is reduced enough to be insignificant, increasing the buffer size doesn't make it go any faster.


----------



## ccc (Dec 19, 2010)

wblock said:
			
		

> Brute force:
> `# dd if=/dev/ad4 of=/dev/null bs=128k`
> 
> Watch for errors.  See also sysutils/smartmontools, although SMART has been known to report no problems on drives with known problems.



Thx, but howto use dd for just reading bad sectors without damaging any data on the hard disk?


----------



## wblock@ (Dec 20, 2010)

ccc said:
			
		

> Thx, but howto use dd for just reading bad sectors without damaging any data on the hard disk?



`% dd if=/dev/ad4 of=/dev/null bs=128k`

Only reads.  Please see dd(1).  fer clic en enllaÃ§!


----------



## User23 (Dec 20, 2010)

Just use a image from http://www.ultimatebootcd.com/ .


----------

